Search This Blog


DNS, DHCP and Static IP with Ubuntu

I finished setting up an Ubuntu server a test lab, and quickly learned a few tips for DHCP and static IP addresses.

Setting and Interface for DHCP

If you want to change an interface to use DHCP, edit /etc/network/interfaces making sure you remove the static config

nano /etc/network/interfaces

iface eth0 inet static
address 192.168.0.x
network 192.168.0.x
gateway 192.168.0.x


iface eth0 inet dhcp

The reverse can be done to change from DHCP to static.

Adding Alternative DNS server

Since DNS servers are handled by the DHCP, I wanted to add an alternative DNS server. Editting the dhclient.conf lets you do this and adding the following the lines to the file.

nano /etc/dhcp3/dhclient.conf

prepend domain-name-servers

or use supersede to replace them.

supersede domain-name-servers

Now the your Ubuntu server can run with DHCP with alternative DNS servers.

Use /etc/init.d/networking restart to apply the changes for the DHCP and DNS right away.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.