OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

10.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:


image

10.2.2.1. /etc/hosts


The /etc/hosts file 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

# 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.


image

10.2.2.2. /etc/resolv.conf


The /etc/resolv.conf file configures access to a DNS server, see Section 10.3.7. This file contains your domain name and the name server(s) to contact:


search mylan.com nameserver 193.134.20.4

search mylan.com nameserver 193.134.20.4

Read more in the resolv.conf man page.


image

10.2.2.3. /etc/nsswitch.conf


The /etc/nsswitch.conf file 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

[bob@tux ~] grep hosts /etc/nsswitch.conf

hosts: files dns

Top OS Cloud Computing at OnWorks: