Ubuntu - How to manually set DNS servers? | ATG Learning


Ubuntu - How to manually set DNS servers?

| Friday, Feb 3, 2017

It's pretty straightforward. To do this you'll need root access so you can modify /etc/network/interfaces. sudo nano /etc/network/interfaces If you're trying to set up a static address, you'll want an entry that reads something like the following for your primary network adapter (usually eth0 or wlan0):

auto eth0 iface eth0 inet static address netmask network broadcast gateway dns-nameservers

What this did is set a static IP of with a network mask of We're on the network (the IP address minus the last number) and the broadcast address is (the IP address with 255 as the last octet).

Do you feel like you're in over your head when dealing with this stuff?

Do lots of numbers scare you?

You might want to take our Network+ crash course-- in just four days, we can help you earn CompTIA's Network+ certification, but more importantly, you'll see past the numbers and abstract terms to be able to read this article in plain English-- it'll be like you just discovered the Rosetta stone! Plus it looks great on your resume.

Anyway, all of our internet traffic flows through a gateway. Usually these are indicated by a .1 as the last octet, hence Lastly, the reason you're here-- the DNS servers. We're specifying Verizon's and Google's DNS servers in this example, but do not recommend them for production use (use your ISP's DNS servers where possible). Just list them one after the other.

For DHCP (where your router or something else assigns your PC an IP address), you'll need a slightly different block: auto eth0 iface eth0 inet dhcp dns-nameservers With your DNS entries in place, restart your networking service and you should be good to go!

sudo service networking restart

Request Information

Please fill out the form below to contact a training consultant directly or call 888-862-3784

Full Name






Enter the text in the image