/etc/network/interfaces

Define network interface on Ubuntu Linux systems. See /etc/sysconfig/network-scripts/ifcfg-eth0 for RedHat systems and /etc/conf.d/net for Gentoo.

Dynamic IP Address (DHCP):

# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp

Static IP Address:

# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 192.168.168.9 netmask 255.255.255.0 network 192.168.168.0 broadcast 192.168.168.255 gateway 192.168.168.1 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 192.168.168.8 dns-search example.com

Change from DHCP client to Static or resetting static IP Address:

  1. Edit /etc/network/interfaces (shown above) as appropiate or run the following command:# ifconfig <dev> <ip> netmask <sub>
  2. edit the following line in /etc/resolv.conf with your correct DNS server. name server xxx.xxx.xxx.xxx
  3. Then remove the dhcp-client for the changes to stick. # apt-get remove dhcp-client
  4. Run the following command for the changes to take effect: # /etc/init.d/networking restart
  5. Finally, test your changes by running, say, "ping www.google.com".

From Gnome you can run System > Administration > Network > Devices.

Hostname

Incidently, you can change the hostname with the following:

  1. # hostname myhostname
  2. Edit /etc/hosts and /etc/hostname.
  3. For a DHCP client edit the following line in /etc/dhcp3/dhclient.conf send host-name "myhostname";