How to build the Ultimate Linux Home Server - Part 2 - DHCP and DNS

July 17th, 2008

Today we will be setting up DHCP and DNS. While these two aren’t completely necessary, some people may benefit from this.

DHCP is a network protocol that is used to allocate IP addresses to client devices connected to the network. By default, any home router that you would buy uses DHCP to give the clients IP addresses, making it extremely easy to connect a new device to any home network. If you want to leave your home router to manage the allocation of IP’s, you can just skip to the DNS part.

DNS is used as a “phone book” to turn human readable names, such as www.32packets.com, into the IP address that the server/client uses.

If you missed the first part, Installing OpenSUSE, here is Part 1

Part two after the Jump

Setting up DHCP

Once you’ve logged in, click Computer on the bottom left corner and then select Install Software. This will launch OpenSUSE’s package manager.

[singlepic=40,320,240,,]

Scroll down or use the filters to find dhcp-server, yast2-dhcp, bind, and yast2-dns-server. You will need the OpenSUSE install disc in the computer

[singlepic=41,320,240,,]

Open YaST and select DHCP Server.

[singlepic=42,320,240,,]

Highlight your interface and click Select, then check Open Firewall for Selected Interface, click next.

[singlepic=43,320,240,,]

In the global settings, you need to set the information for your home network. The domain name will be the address that you are using for your network, such as network.home.

On a side note, using the .local top level domain may lead to some issues in SUSE and Mac OS X since .local uses multicast DNS. I ran in to some trouble not being able to resolve the IP address of some servers, so I suggest not using .local

For the Primary Name Server IP, you will be using the address of your home server’s NIC. For the secondary Name Server, I’d recommend using OpenDNS’s address 208.67.222.222 or 208.67.220.220.

The Default Gateway is the IP address of your router, usually 192.168._.1.

The NTP Time Server is the time server that you want to use for synchronization. I use time.nrc.ca.

I’m not going to be using a Print server or a WINS server, I assume that you won’t either.

I’ve upped the default lease time to 7 days since I won’t be running out of addresses and I want my machines to keep their addresses.

[singlepic=46,320,240,,]

The third step of the DHCP Server Wizard automatically fills in the Subnet information, and allows you to choose the range of IP’s you want to allocate to DHCP. I’d recommend leaving at least 10 addresses for devices that you want static IP’s for, such as printers and other servers you might have in your house. I’ve used 192.168.0.20-192.168.0.254.

On the last step, change it so that the DHCP service starts when booting and click Finish.

If you go back into the DHCP Server plugin in YaST, you will be able to assign addresses and hostnames to the MAC address of the client’s NIC.

That is it for DHCP. You will need to disable the DHCP server on your router to avoid possible conflicts.

Setting up DNS

DNS allows us to assign internal names that we can use inside of our network to resolve to different IP’s, such as laptop.network.home or homeserver.network.home.

You will need bind and yast2-dns-server installed via the YaST package manager, which I showed above in the DHCP setup guide. Launch the DNS Server guide in the YaST Control panel.

[singlepic=47,320,240,,]

The first step is to set up our DNS forwarders. These are used to resolve names that our server does not have in its database. I’ve included both of the OpenDNS name servers along with 4.2.2.1 and 4.2.2.2 which are well known name servers.

[singlepic=48,320,240,,]

Here we set up the DNS zones that we are going to be using for our internal network. I’ve gone ahead and added network.home as one of the master domains that we will be using. Click Next

[singlepic=49,320,240,,]

Open the port in the firewall and change it so that DNS starts up on boot. Click finish.

[singlepic=50,320,240,,]

Due to a bug in the DNS server guide, we have to create a TSIG key first. Open up the DNS Server guide again, select TSIG key in the menu. For the Key ID, use a value of 1, and for the filename, use /etc/name.d/tsig, then click generate and it will automatically generate the key.

[singlepic=52,320,240,,]

Go to DNS Zones and click edit for your home zone.

[singlepic=51,320,240,,]

Here we can go to Records, and then enter our subdomain. The record key is the value that we use for the subdomain, and we use the Value box for the IP address we want the subdomain to resolve to. You can add as many as you like.

That’s it, that is all you need to set up DHCP and DNS. All of the new clients that are added to your network will be able to resolve network.home addresses and will receive it’s IP with routing information.

Part 3 is available here.

You can view the next parts here:Part 4, Part 5

Like my articles and how to’s? Have a request? You can buy me a cup of joe or some music to listen to by donating! Donate via paypal or iTunes Gift Certificate to shawn@32packets.com


4 Responses to “How to build the Ultimate Linux Home Server - Part 2 - DHCP and DNS”

  1. How to build the Ultimate Linux Home Server - Part 1 | 32packets Says:

    [...] You can proceed onto part 2 here! [...]

  2. How to build the Ultimate Linux Home Server - Part 2 - DHCP and DNS | AdamDicker.com Says:

    [...] more: How to build the Ultimate Linux Home Server - Part 2 - DHCP and DNS Read the rest of the [...]

  3. How to build the Ultimate Linux Home Server - Part 4 - UPNP Media Streaming | 32packets Says:

    [...] missed a section of How to build the Ultimate Linux Home Server, you can view them here. Part 1, Part 2, Part 3 Part 4 of the guide is after the [...]

  4. How to build the Ultimate Linux Home Server - Part 5 - Installing a Web Administration tool and setting up VPN | 32packets Says:

    [...] missed a section of How to build the Ultimate Linux Home Server, you can view them here: Part 1, Part 2, Part 3, and Part [...]

Leave a Reply

What I'm Doing...

  • Ugh, the Smart car was almost in the ditch, one wheel was off the road and we had to push it in the snow. The hill is like sheer ice! 2 days ago
  • Great article about what is going on in Canada if you have no idea what has been happening over the past weeks http://tinyurl.com/5r3gf5 3 days ago
  • More updates...

Categories