How to serve multiple search domains from Cisco IOS DHCP server?

Cisco Jan 27, 2021

Source - https://www.perkin.org.uk/

The expected

[code language="plain"]ip dhcp pool host.net.example.com
option 119 ascii net.example.com,example.com[/code]

doesn't work. So you need to encode search domains in hex using following example script written in Python:

[code language="python"]#!/usr/bin/env python
import syshexlist = []for domain in sys.argv[1:]:
for part in domain.split("."):
hexlist.append("%02x" % len(part))
for c in part:
hexlist.append(c.encode("hex"))
hexlist.append("00")print "".join([(".%s" % (x) if i and not i % 2 else x) \
for i, x in enumerate(hexlist)])[/code]

Execute it:

[code language="plain"]$ ./cisco.py net.example.com example.com
036e.6574.0765.7861.6d70.6c65.0363.6f6d.0007.6578.616d.706c.6503.636f.6d00[/code]

So the config in ios must look like:

[code language="plain"]ip dhcp pool host.net.example.com
option 119 hex 036e.6574.0765.7861.6d70.6c65.0363.6f6d.0007.6578.616d.706c.6503.636f.6d00[/code]

It's done!

Tags

Jordan Ostreff

2G/3G/4G/NSA-5G/SA-5G Mobile Packet Core, Telco Clouds, Ericsson CEE, OpenStack, NFV, Orchestration, SDN, Containerisation, Networking IPv4/IPv6, Industrial Computer Networks, Mathematics, Engineering

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Share with Me via Nextcloud