To allow your Ubuntu server to work with a static IP, you need to amend a couple of files. If you have Webmin installed, its much easier to do this in the network interface section of the System settings. However details below are how to do this from the command ssh terminal prompt.
Edit your interface file
sudo vi /etc/network/interfaces
Change it to look the same as the following – obviously amending it to have your relevant network details in.
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
Press shift ZZ to save the file once amended.
Amend DNS settings
We need to add in the DNS settings by editing the resolv.conf file:
sudo vi /etc/resolv.conf
On the line nameserver xxx.xxx.xxx.xxx replace the x with the IP of your name server.
Remove DHCP client
This will remove the now unecessary software used for acquiring DHCP
apt-get remove dhcp3-client
Restart interfaces
Restart your network services to initialise changes using the following command:
sudo /etc/init.d/networking restart
Add the gateway route
To allow your machine to get out to the internet you may need to add the gateway in manually. You can do this as follows:
/sbin/route add -net 0.0.0.0 gw x.x.x.x eth0
Where X is your gateway
Test it works
Then do a test to check all is working:
ping www.google.com
You should get a nice long list of replies if it is successful. Press Ctrl + C to stop this list.