Set up Static IP and Static DNS on Ubutunu 14.04
Many people seem to jump through a lot of hoops to figure this out, but according to the instructions on Ubuntu’s site, you update the following:
sudo nano /etc/network/interfaces
This is the default file:
# This file... # and how to activate... # The loopback... auto local iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp
This is the updated file below “# The primary network interface”. Replace x’s with your IPs, of course. Also, Google’s DNS servers shown as example.
#iface eth0 inet dhcp iface eth0 inet static address x.x.x.x netmask 255.255.255.0 gateway x.x.x.x #nameservers # you may not need dns-search # I use it because I'm running this on a Windows network # so its useful to have # dns-search x.y dns-nameservers 4.4.4.4 8.8.8.8
Works every time for me. That said, I don’t know why there are so many other ways people do this and that makes me think I’m missing something. Let me know below if you agree/disagree.
[…] Looking for a way to set static IP and DNS on Ubuntu? […]