Most networking is configured by editing two files:

  • /etc/network/interfaces
    • Ethernet, TCP/IP, bridging
  • /etc/resolv.conf
    • DNS

Other networking files:

  • /etc/hosts
  • /etc/dhcp3/dhcpd.conf

Typical default configuration of /etc/network/interfaces

Directive Description
auto Indicates the device should be setup at boot time.
lo Loopback interface.
iface "Interface".
eth0 Ethernet device 0, typically the primary network adaptor.
inet Indicates network adaptor has an IPv4 address space.
dhcp Network adapter gets its configuration from a DHCP server.

fix your server's IP address in /etc/network/interfaces

Directive Description
static Indicates the adaptor uses fixed IP configuration.
address The IP address of the host. netmask Network subnet mask.
gateway Gateway address.
network The network portion of the IP address.
nameserver The IP of a DNS.

For static interfaces, you may also need to edit /etc/resolv.conf to specify DNS servers.


Ubuntu refers to this file to resolve host names before contacting a DNS. Good for frequently used hostnames, or internal network hosts.


Network useful commands

Command Description
Ping Test that an internet host is reachable.
ifconfigtd> Administer a TCP/IP network interface.
sudo /etc/init.d/ networking stop, start, restart as arguments; controls network status.
route Examine and configure the host's routing table.

Previous: File system
Next: Backup

Follow us on Facebook and Twitter for latest update.