How to set a static IP in Ubuntu from the shell

<br />

and adjust it to your needs (in this example setup I will use the IP address
# This file describes the network interfaces available on your system<br />
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface<br />
auto lo<br />
iface lo inet loopback

# This is a list of hotpluggable network interfaces.<br />
# They will be activated automatically by the hotplug subsystem.<br />
mapping hotplug<br />
script grep<br />
map eth0

<br />
# The primary network interface<br />
auto eth0<br />
iface eth0 inet static<br />
address<br />
netmask<br />
network<br />
broadcast<br />

Then do

sudo /etc/init.d/networking restart

to restart the network.