Linux network configuration files
May 15, 2011 14:18:54 Last update: May 15, 2011 14:19:49
-
/etc/resolve.conf: DNS server configuration.
Example:search localdomain nameserver 192.168.183.2
-
/etc/hosts: map hostname to IP address locally instead of using DNS, often take precedence over DNS.
Example:127.0.0.1 localhost 127.0.1.1 myserver # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
-
/etc/nsswitch.conf: system databases and Name Service Switch configuration file.
Example:# /etc/nsswitch.conf # # Example configuration of GNU Name Service Switch functionality. # If you have the `glibc-doc-reference' and `info' packages installed, try: # `info libc "Name Service Switch"' for information about this file. passwd: compat group: compat shadow: compat hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 networks: files protocols: db files services: db files ethers: db files rpc: db files netgroup: nis
-
/etc/sysconfig/network(for Fedora, Redhat, CentOS): specify network configuration - static IP, DHCP, NIS, etc. -
/etc/network/interfaces(for Ubuntu): specify network configuration - static IP, DHCP, NIS, etc.
Example:auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp auto eth1 iface eth1 inet static address 192.168.183.5 netmask 255.255.255.0 gateway 192.168.183.2