How To Set A Static IP In Ubuntu or Linux Using The Command Line
Sunday, January 6th, 2008After installing Ubuntu Linux 7.10 Server Edition, I found that the IP address was assigned by DHCP served by my home router. This is fine for getting the server installed, but under most conditions, you will want to assign a static IP for your server. This Blog post will show you how to do just that. One of the issues with the Ubuntu server editions is that everything is done from a command line. There is no pretty windowed GUI.
One thing to note is that these commands need to be issued from either root or using sudo. I prefer to use the sudo su method to avoid having to type sudo each time I issue a command. (WARNING) if you do use sudo su, remember to exit the root when you are done.
In this example, I will be assigning the a static IP address of 192.168.1.2 to the primary network interface on my server.
My network subnet is 192.168.1.0
My network gateway is 192.168.1.3
And my netmask is 255.255.255.0
(more…)