Dhcp Option 43 for Aironet Aps

Just a quick hacky script to generate dhcp option 43 for Cisco LAPs to join Wireless Lan Controllers (WLC). This script outputs a line to add to your dhcpd.conf subnet declaration. It takes a list of IPs as arguments and will convert them into a suitable dhcpd.conf entry.

Script invocation example:

user@work:~$ ./gen-dhcp-43.py
Please add the following line to the correct subject declaration.
option vendor-encapsulated-options f1:08:c0:a8:0a:05:c0:a8:0a:14;

Example subnet declaration

   subnet netmask {
       range dynamic-bootp;
       option broadcast-address;
       option routers;
       option vendor-encapsulated-options f1:08:c0:a8:0a:05:c0:a8:0a:14;
       max-lease-time 604800;
       default-lease-time 604800;
       host hostname {
         hardware ethernet xx:xx:xx:xx:xx:xx;


#!/usr/bin/env python3
# Configure Cisco LAPs to join WLC via dhcpd option 43.
# 11/16/2021 [email protected]

import sys

if len(sys.argv) < 1:
    print(f"Usage: {sys.argv[0]} <ip1> <ip2> <...>")

def gen_hex(ip):
    ipsplit = ip.split('.')
    hexxed = ':'.join(hex(int(i))[2:].zfill(2) for i in ipsplit)

def gen_prefix(num):
    type = "f1"
    length = hex(int(num * 4))[2:].zfill(2)

num_ips = len(sys.argv) - 1

prefix = gen_prefix(num_ips)

hexips = []
for ip in sys.argv[1:]:
    iphex = gen_hex(ip)

hexips = ':'.join(hexips)

print("Please add the following line to the correct subject declaration.")
print(f"option vendor-encapsulated-options {prefix}:{hexips};")

Illustration of Vince

Vince Hillier is the President and Founder of Revenni Inc. He is an opensource advocate specializing in system engineering and infrastructure. Outside of building solid infrastructure that doesn't break the bank, he's interested in information security, privacy, and performance.