This chapter tells you how the Erlang runtime system is configured for IP communication. It also explains how you may configure it for your own particular needs by means of a configuration file. The information here is mainly intended for users with special configuration needs or problems. There should normally be no need for specific settings for Erlang to function properly on a correctly IP configured platform.
When Erlang starts up it will read the kernel variable
Note that the usage of a
A second way to specify the configuration file is to set the
environment variable
Note that the kernel variable
If no user configuration file is specified and Erlang is started
in non-distributed or short name distributed mode, Erlang will use
default configuration settings and a native lookup method that should
work correctly under most circumstances. Erlang
will not read any information from system inet configuration files
(like /etc/host.conf, /etc/nsswitch.conf, etc) in these modes,
except for /etc/resolv.conf and /etc/hosts that is read and monitored
for changes on Unix platforms for the internal DNS client
If Erlang is started in long name distributed mode, it needs to
get the domain name from somewhere and will read system inet
configuration files for this information. Any hosts and resolver
information found then is also recorded, but not
used as long as Erlang is configured for native lookups. (The
information becomes useful if the lookup method is changed to
Native lookup (system calls) is always the default resolver method. This
is true for all platforms except VxWorks and OSE Delta where
On Windows platforms, Erlang will search the system registry rather than look for configuration files when started in long name distributed mode.
Erlang records the following data in a local database if found in system inet configuration files (or system registry):
This data may also be specified explicitly in the user
configuration file. The configuration file should contain lines
of configuration parameters (each terminated with a full
stop). Some parameters add data to the configuration (e.g. host
and nameserver), others overwrite any previous settings
(e.g. domain and lookup). The user configuration file is always
examined last in the configuration process, making it possible
for the user to override any default values or previously made
settings. Call
These are the valid configuration parameters:
Specify a system file that Erlang should read configuration
data from.
Specify a system file that Erlang should read resolver
configuration from for the internal DNS client
This may override the configuration parameters
If the file is specified as an empty string "", no file is read nor monitored in the future. This emulates the old behaviour of not configuring the DNS client when the node is started in short name distributed mode.
If this parameter is not specified it defaults to
Specify a system file that Erlang should read resolver configuration from for the internal hosts file resolver and monitor for changes, even if it does not exist. The path must be absolute.
These host entries are searched after all added with
If the file is specified as an empty string "", no file is read nor monitored in the future. This emulates the old behaviour of not configuring the DNS client when the node is started in short name distributed mode.
If this parameter is not specified it defaults to
Specify a system registry that Erlang should read configuration
data from. Currently,
Add host entry to the hosts table.
Set domain name.
Add address (and port, if other than default) of primary
nameserver to use for
Add address (and port, if other than default) of secondary
nameserver for
Add search domains for
Specify lookup methods and in which order to try them.
The valid methods are:
Set size of resolver cache. Default is 100 DNS records.
Set how often (in millisec)
the resolver cache for
Set the time to wait until retry (in millisec) for DNS queries
made by
Set the number of DNS queries
Tells the DNS client
Tells the DNS client
Sets the EDNS version that
Sets the allowed UDP payload size
Tell Erlang to use other primitive UDP module than inet_udp.
Tell Erlang to use other primitive TCP module than inet_tcp.
Clear the hosts table.
Clear the list of recorded nameservers (primary and secondary).
Clear the list of search domains.
Here follows a user configuration example.
Assume a user does not want Erlang to use the native lookup method,
but wants Erlang to read all information necessary from start and use
that for resolving names and addresses. In case lookup fails, Erlang
should request the data from a nameserver (using the Erlang
DNS client, set to use EDNS allowing larger responses).
The resolver configuration will be updated when
its configuration file changes, furthermore, DNS records
should never be cached. The user configuration file
(in this example named
%% -- ERLANG INET CONFIGURATION FILE -- %% read the hosts file {file, hosts, "/etc/hosts"}. %% add a particular host {host, {134,138,177,105}, ["finwe"]}. %% do not monitor the hosts file {hosts_file, ""}. %% read and monitor nameserver config from here {resolv_conf, "/usr/local/etc/resolv.conf"}. %% enable EDNS {edns,0}. %% disable caching {cache_size, 0}. %% specify lookup method {lookup, [file, dns]}.
And Erlang could, for example, be started like this: