I will show how to set a static IP of 192.168.0.101 on a network with a gateway of 192.168.0.1.
Open the configuration file in your favorite editor (mine is nano)
sudo nano /etc/network/interfaces
Comment out the section where dhcp is being used (put the # in front of the line):
#auto eth0
#iface eth0 inet dhcp
Add a section like this example:
auto eth0
iface eth0 inet static
address 192.168.0.101
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
Reboot and you’re done!
Source: http://usefulubuntu.blogspot.nl/2009/01/create-static-ip-from-command-line.html
Leave a Reply