This page was last modified: July 24 2008 00:54:01   
Too Cool for Internet Explorer

Network configuration

To make sure that the networking part of your server will work correctly, you need to take a look at /etc/rc.conf, /etc/resolve.conf and /etc/hosts.

/etc/rc.conf

The file rc.conf contains the local host name, configuration details for any potential network interfaces and any services you want to be able to start (both manually and at boot)

rc.conf could look something like this:

defaultrouter="12.34.56.789"
hostname="example.domain.tld"
ifconfig_fxp0="inet 12.34.56.788 netmask 255.255.255.0"
kern_securelevel_enable="NO"
keymap="danish.cp865"
keyrate="fast"
nfs_reserved_port_only="YES"
sendmail_enable="YES"
sshd_enable="YES"
usbd_enable="NO"

The values specified in this file, is only those which differ from the default values. The default values is found in /etc/defaults/rc.conf

Any changes to /etc/rc.conf, will take effekt after the next reboot.

.. and in the future, when adding new services to your server, remember to open the associated *.sh file (located in /usr/local/etc/rc.d/). The comment at the top of the file will tell if you must add, and what to add in rc.conf to enable the service.

/etc/resolv.conf

resolv.conf has nothing to do with routing. It allows you to configure the "resolver" which is a program that translates IP's to names and back. In other words: the resolver is an internal service. It doesn't respond to requests from the outside world.

Here's an example:

domain example.tld
nameserver 12.34.45.1
nameserver 12.34.45.2

domain example.tld, tells the resolver that it should assume that it belongs to that domain. The two following lines is a list of name servers, that will be used to do the resolving.

You will often see resolve.conf's where a search line is added:

domain example.tld
search example.tld elpmaxe.tld
nameserver 12.34.45.1
nameserver 12.34.45.2

The search line tells the resolver where to search for hosts. If for example you want to ping a machine named batman, you just write...

ping batman

ping will ask the resolver for the IP of batman. Because of the search line in resolv.conf, the resolver will first try to find the associated IP for batman, then it will search for an IP for batman.example.tld and then for an IP of batman.elpmaxe.tld

As soon as an IP is found, the resolver will stop searching. If it can't find an IP it returns the message "unknown host".

If you don't have a search line, it dos not mean that you can't access or talk to batman, it only means that you have to write both host and domain, also known as FQDN (Fully Qualified Domain Name).

ping batman.example.tld

It isn't necessary to reboot after making changes to resolv.conf ... the changes takes effect immediatly.

/etc/hosts

As your machine gets started, it will need to know the mapping of some hostnames to IP addresses before DNS can be referenced. This mapping is kept in the /etc/hosts file. In the absence of a name server, any network program on your system consults this file to determine the IP address that corresponds to a hostname.

For example, if your machine is robin.example.tld with the IP address 123.154.93.32, your /etc/hosts would look like

127.0.0.1 localhost
123.154.93.32 robin.example.tld robin