10.1.2. Network configuration and information
10.1.2.1. Configuration of local network interfaces
All the big, userfriendly Linux distributions come with various graphical tools, allowing for easy setup of the computer in a local network or for connecting it to an Internet Service Provider. These tools can be started up from the command line or from a menu:
Ubuntu configuration is done selecting S+y+s+t+e+m+Administration ->Networking .
RedHat Linux comes with redhat-config-network , which has both a graphical and a text mode interface.
Suse's YAST or YAST2 is an all-in-one configuration tool.
Mandrake/Mandriva comes with a Network and Internet Configuration Wizard, which is preferably started up from Mandrake's Control Center.
Your system documentation provides plenty of advice and information about availability and use of tools.
Information you'll need to provide:
For connecting to the local network, for instance with your home computers, or at work: hostname, domainname and IP address. If you want to set up your own network, best do some more reading first. At work, this information is likely to be given to your computer automatically when you boot it up. When in doubt, it is better not to specify any information than making it up.
For connecting to the Internet: username and password for your ISP, telephone number when using a modem. Your ISP usually automatically assigns you a hostname, IP address and all the other things necessary for your Internet applications to work.
10.1.2.2. Network configuration files
The graphical helper tools edit a specific set of network configuration files, using a couple of basic commands. The exact names of the configuration files and their location in the file system is largely dependent on your Linux distribution and version. However, a couple of network configuration files are common on all UNIX systems:
/etc/hosts : always contains the localhost IP address, 127.0.0.1, which is used for interprocess communication. Never remove this line! Sometimes contains addresses of additional hosts, which can be contacted without using an external naming service such as DNS (the Domain Name Server).
A sample hosts file for a small home network:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.52.10 tux.mylan.com tux
192.168.52.11 winxp.mylan.com winxp
Read more in man hosts .
/etc/resolv.conf : configure access to a DNS server. This file contains your domain name and the name server(s) to contact:
search mylan.com
nameserver 193.134.20.4
Read more in the resolv.conf man page.
/etc/nsswitch.conf : defines the order in which to contact different name services. For Internet use, it is important that dns shows up in the "hosts" line:
[bob@tux ~] grep hosts /etc/nsswitch.conf
hosts: files dns
This instructs your computer to look up hostnames and IP addresses first in the /etc/hosts file, and to contact the DNS server if a given host does not occur in the local hosts file. Other possible name services to contact are LDAP, NIS and NIS+.
More in man nsswitch.conf .
10.1.2.3. Network configuration commands
The distribution-specific scripts and graphical tools are front-ends to ip (or ifconfig and route on older systems) to display and configure the kernel's networking configuration.
The ip command is used for assigning IP addresses to interfaces, for setting up routes to the Internet and to other networks, for displaying TCP/IP configurations etcetera.
The following commands show IP address and routing
* License

