Ubuntu Tips: 2 - Static IP Address
The following article will explain how to reconfigure your system to use a Static IP address
Author: Matthew Wittering | Published: 23rd October 2009
By default your Ubuntu installation will be configured to like other operating system to use the Dynamic Host Configuration Protocol (DHCP) to lease an IP address from your network router or DHCP server. I have found that there are benefits for configuring your computer to have a perminant IP address.
Step 1 - Open the configuration file
Start by opening the a Terminal window and enter the following command.
$ sudo nano /etc/network/interfaces
When the interfaces file has been opened your will find the following.
auto eth0 iface eth0 inet dhcp
Step 2 - Apply the new configuration
Start by commenting out the first two lines of the interfaces file and then paste the following seven lines below. In this example I have configured the machine's IP address as 192.168.1.2. Once editor resembles my example below, save the changes and close the editor.
#auto eth0 #iface eth0 inet dhcp auto eth0 iface eth0 inet static address 192.168.1.2 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1
Step 3 - Restart the network service
All the is left to do is restart the networking service and apply the changes you have made to the interfaces configuration file. To manually restart your network interface enter the following command in the terminal.
$ sudo /etc/init.d/networking restart
Once this command has finished executing you will have completed modifying your system to use a Static IP address.
This work is licenced under a Creative Commons Licence
I am a graduate of Lougborough University where I read Computing and Management BSc (Hons) earning a 2:1 classification.