Configuring your ip addresses (I will only mention Ipv4 here, sorry) can be quite a pain also, especially if you don't use X windows. But, once you understand how Linux determines the configuration of your network cards, you will find it quite easy to configure your network card(s).
Please note that this chapter uses Redhat 7.x as an example, other distributions might store their network configuration files at different places.
Let's get back to our example, the 3c509 NIC. Let's assume that the driver has been loaded, either in the kernel or with a module. You can verify this by typing dmesg and looking for lines that mention 3com (or whatever your NIC's vendor is), eth0 and similar network related things.
How does our Redhat installation know that we want an ip address assigned to this card and which one? During boot up it looks for a specific file pattern in the /etc/sysconfig/network-scripts/ directory. It looks for files starting with ifcfg-ethX, where X represents the interface number, usually 0 if you only have one NIC installed. So in our case we would need to create or edit the file /etc/sysconfig/network-scripts/ifcfg-eth0 to configure our ip settings. This is how the file should look like this for setting a static ip address:
DEVICE=eth0
IPADDR=184.12.10.100
NETMASK=255.255.255.0
NETWORK=184.12.10.0
BROADCAST=184.12.10.255
ONBOOT=yes
Mighty easy, isn't it? Now let's see how we can tell Redhat to use a name server too. For this we need to look at two files. First we look at the file /etc/nsswitch.conf. This file tells the OS what services are used for a particular resolution type. One resolution type, e.g., is hosts; another one (which we won't discuss further) is passwd.
Linux gives us several options, and more important even an order, to resolve an ip address. If you enter grep ^hosts /etc/nsswitch.conf (the ^ character matches only if hosts appears at the beginning of the line) you will see something similar to this:
hosts: files nisplus nis dns
This shows me that when I resolve a hostname to an ip address, Linux will first use the files service (/etc/hosts) and then the nisplus or the nis service, and if it still can't find that hostname it will query the configured dns servers. You configure your dns servers in the file /etc/resolv.conf. A typical resolv.conf file looks like this:
nameserver xx.xx.xx.xx1
nameserver xx.xx.xx.xx2
search netikus.net
The nameserver directive obviously tells your system which name servers to contact for the hostname resolution. You can list multiple nameserver by adding multiple nameserver directives. Now the search directive is not absolutely required and kicks in when you don't specify a fqdn (fully qualified domain name, like www.linuxdocs.org), but instead only a hostname. In that case the OS simply appends the domainname that you specified to the hostname. So if you where to type ping www, the OS would query the configured dns servers for www.netikus.net. This is probably most useful in an intranet.