static IP addresses for OSX clients based on Hostname Option 12

Dan Langille dan at langille.org
Fri Jan 19 16:30:57 UTC 2018


I want to assign static IP addresses for OSX clients which connect via external wired ethernet devices.
Instead of MAC address, which cannot identify the client, I chose to use the value in Hostname Option 12.

The use case in question is laptops without a network jack.  They achieve a wired connection via a dongle
or a docking station / hub.  Such devices are external and thus the MAC address cannot be used
to identify the host. That is, I might use the docking station with the pro02 laptop on one day, but the next
day I am using the snorty laptop.

My use case for wireless connections is solved by using 'hardware ethernet' in a host declaration like this:

host pro2 {
        hardware ethernet 72:16:05:e3:93:c6;
        fixed-address air01.int.unixathome.org;
}

For wired connections, the solution I have found is a pool with a single IP address range.

class "pro02" {
        match if ( option host-name = "pro02");
}

subnet 10.12.34.0 netmask 255.255.255.0 {
        # option definitions common to all supported networks...
        option domain-name "int.unixathome.org";
        option domain-name-servers 10.12.34.1, 10.12.34.33, 10.12.34.113;

        option routers 10.12.34.1;

        pool {
                allow members of "pro02";
                range 10.12.34.103 10.12.34.103;
        }

        pool {
                range 10.12.34.200 10.12.34.250;
        }
}

This works, and I have implemented it for multiple hosts, but I write in case there is a better way.

I was also looking at doing something like this, but it seems that 'fixed address' is not valid in an IF statement.

        # the USB-C dongle
        host dongle01 {
                hardware ethernet 72:16:05:e3:93:c6;
                if option host-name = "pro02"
                {
                       fixed-address pro02.int.unixathome.org;
                }

                ddns-updates off;
                option domain-search "int.unixathome.org", "vpn.unixathome.org", "wifi.int.unixathome.org", "unixathom
        }

Thank you.

-- 
Dan Langille




More information about the dhcp-users mailing list