DHCP server setup

Sun 18 January 2015

[caption id="" align="alignright" width="350" class="zemanta-img"]Townhouses in Chelsea; much of this Manhattan ... neighbours' discovery (Photo credit: Wikipedia)[/caption]

My server's OS is an Archlinux, and I want to pratic a DHCP server set up both in IP v4 and IPv6

IPv4

The dependencies may already be install. It only consits of dhcp, as explained on the archlinux wiki. The setup is quite forward and consist in the following steps:

  1. determine the itercase the server should serve (eth0 in my case)

  2. assign at least 1 static IP configuration to this interface any valid method. In my case, I'll use ifconfig to assign an on the network 192.168.1.0/24: ifconfig eth0 192.168.1.53/24

  3. edit /etc/dhcpd.conf. The minimal config looks like:

    option domain-name-servers 8.8.8.8;
    option routers 192.168.1.53;
    subnet 192.168.1.0 netmask 255.255.255.0 {
            range 192.168.1.100-192.168.1.250;
    }
    subnet 10.235.8.0 netmask 255.255.255.0 {
    }
    

    Not having a subnet section set for each IPv4 adress set on an active interface may result on the deamon not starting. A subnet section with no directive tells the deamon to explicitly ignore this subnet.

The most explicit doc I found is the dhcpd.conf man page

IPv6

The DHCP should be needed only on rare and specific occasions. The neighbour discorevy (RFC4861)

DHCP6

This exists (RFC3315)! I supose it is to avoid disturbing old sysadmins'habits. Or to be used in specific environnement in which knowing exactly what are the assigned addresses and to whom it has been assigned. The required steps are the same as for DHCP4, except that the config file directive have a 6 attached to them:

subnet6 2001:0DB8:f00e:eb00::/64 {
range6 2001:0DB8:f00e:eb00::1000 2001:0DB8:f00e:eb00::2000;
}

Neigbour discovery

You should activate the Routed Advertisement (RA, RFC2461) on each of your routers. The arch way is to use radvd. I have't dig too much as the config is very similar to the one used in freeBSD. The minimal config file (/etc/radvd.conf) looks like:

interface eth0
{
        AdvSendAdvert on;
        IgnoreIfMissing on;
        prefix 2001:db8:1:0::/64
        {
                AdvOnLink on;
                AdvAutonomous on;
                AdvRouterAddr off;
        };
        route 2001:db0:fff::/48
        {
                AdvRoutePreference high;
                AdvRouteLifetime 3600;
        };

};

Troubleshoot

  • The dhcpd log are quite explicit when the config file is not consistent.
  • Wireshark is always a good debugging tool.
  • If you want to use a unified tool for both IPv4 ARP and IPv6 ND, the command ip neigh (man ip-neighbour) is usefull. With no other argument, it shows the content of both ARP table and neighbours table
  • Do not forget to configure a router/gateway. This post only address the automatic aacquisition of IP configuration, not routing nor firewalling

(Non-)Related articles

Category: tools Tagged: DHCPv6 Dynamic Host Configuration Protocol IPv6 how to tools


Page 1 of 1