Static IP in Ubuntu

It's all in the file /etc/network/interfaces. You should see an entry like this:

auto eth0
iface eth0 inet dhcp

Change it to something like this

auto eth0
iface eth0 inet static
address 192.168.1.192
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1 192.168.1.2

Then…

/etc/init.d/networking restart

At this point…you'll usually lose connection 🙁

…but that's good, because your static IP should be working! 🙂 Just reconnect!

(You'll lose connection unless you're working directly on the console, or your static IP is the same as your dynamic IP. In which case, good for you! You're much more on-the-ball than I usually am.)

Here's more info on converting from dhcp to static IP.

Leave a Reply

Your email address will not be published.