Ubuntu Server is a popular Linux distribution that is used by millions of people around the world. It’s a great choice for servers and it has a lot of features that make it an excellent choice for businesses. One of the things that Ubuntu Server lacks is DHCP, which is a feature that many businesses need in order to connect to their servers. There are several ways to get DHCP working on Ubuntu Server. One way is to use aptitude, which can be found in the aptitude package manager. Another way is to use the command line tool dhcpcd, which can be found in the ubuntu-server directory. The first way works best if you have a static IP address and you want to use DHCP for your server. The second way doesn’t work as well if you want to use DHCP for your server and also have an IP address assigned by your ISP. If you want both methods to work, you will need to find another method of getting DHCP working on Ubuntu Server.


Changing this setting without a GUI will require some text editing, but that’s classic linux, right?

Let’s open up the /etc/network/interfaces file. I’m going to use vi, but you can choose a different editor

For the primary interface, which is usually eth0, you will see these lines:

As you can see, it’s using DHCP right now. We are going to change dhcp to static, and then there are a number of options that should be added below it. Obviously you’d customize this to your network.

Now we’ll need to add in the DNS settings by editing the resolv.conf file:

On the line ‘name server xxx.xxx.xxx.xxx’ replace the x with the IP of your name server. (You can do ifconfig /all to find out what they are)

You need to also remove the dhcp client for this to stick (thanks to Peter for noticing). You might need to remove dhcp-client3 instead.

Now we’ll just need to restart the networking components:

Ping www.google.com. If you get a response, name resolution is working(unless of course if google is in your hosts file).

Really pretty simple.

Updated Thanks to Nickname007 in the comments for noting that I forgot the DNS entries in the guide.

RELATED: How to Set DNS Search Order in Ubuntu 18.04 using NetPlan