Under certain circumstance you need to specify a static IP address. There are 2 different ways you can achieve this.


ifconfig eth0 [the.ip.you.want]

This command effect is temporary so the change will be swiped after ubuntu reboot or restart of network.

Interface file

In Ubuntu OS, what you need to do is to modify /etc/network/interfaces:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address [the ip you want]
netmask [real net mask]
network [network]
gateway [gateway]

Change the interface name eth0 if you wish to modify other interfaces.
After edition, you need to restart your network.
You can simply reboot ubuntu or use network restart. Notice by editing interface file, the change are permanent and will also be effective after reboot.


17 August 2015