CCIE Wireless · CCIEW Lab · CCIEW Written · Enterprise Wireless

Converting IP to Hexadecimal for Option43

Either my google searches are terrible or there is a surprising dearth of articles when it comes to this topic.

The scenario is you’re building a DHCP scope on a Cisco switch and need to convert your WLC IP from 192.168.23.52  into a hex value. This hex value is used in something called DHCP Option 43 by the Cisco APs to discover a WLC if they haven’t already found one through other means such as Layer 2/3 broadcasts, local WLC lists in their NVRAM and even a DNS discovery. Option 43 is the most convenient way to control which APs join which WLC when they are in different subnets but it can be niggly when setting up on a switch or windows server.

I assume there are quicker methods but I’ll detail my one here. This is assuming you don’t have a simple online converter available e.g. during an exam.

Before you start

For Option 43 the hex value will always begin with f10<#> where # = 4*the number of WLC IPs. Sounds irritatingly complicated, right? These first four values are used to tell the AP the number of WLC Management IP Addresses that may follow with 1 being f104 (4*1), 2 being f108 (4*2) and 3 being, you guessed it, f112. I’m not sure if there is a limit of IPs here but chances are you’ll never be using more than three addresses for this.

You will require a basic understanding of binary with regards to IP addressing for this manual process.

Converting to binary

As outlined above, I am converting  a single WLC IP 192.168.23.52 into hex. As this is only one WLC IP that means I immediately have the first four values of f104. Now, lets convert 192.168.23.52 into binary and place a space after every four binary digits. You’ll see why very soon! I’ve placed a . in between each octet below just to help track what we’re doing but it isn’t necessary.

192.168.23.52

= 1100 0000.1010 1000.0001 0111.0011 0100

Converting binary to numerical

Once you get used to this process you can probably skip straight to the hex conversion but to take it more slowly, each four digit binary sequence needs to be converted into a decimal format. As there are four digits the maximum value that can be gained is 15. This is due to the values being 1,2,4,8 from right to left as with any other IP Address. The only difference here is we are cutting off at 4 instead of the usual 8 digits.

1100 0000.1010 1000.0001 0111.0011 0100

= 12 0 10 8 1 7 3 4

Converting to hex

Almost there! The final step is to use the table below to convert each decimal value above into hex.

12 0 10 8 1 7 3 4

= c0a81734

Decimal to Hex Table
Decimal to Hex Table

Final Value and Implementation

Your final value, in lower case, is f104c0a81734. This can be added to the DHCP scope of a Cisco router with the sub-command option 43 hex f104c0a81734 under the DHCP pool settings.

Implementing DHCP Option 43 hex
Implementing DHCP Option 43 hex

Verifying shows that the router has broken this 12 hexadecimal value into 3 parts. This is automatic and will not affect your deployment at all.

Verification of option 43 hex
Verification of option 43 hex

Representing two IP Addresses as hex

If you are required to convert and implement two IP Addresses you simply follow the process above and write out the values in a single long string. For example, we have worked out 192.168.23.52  so lets add 192.168.23.53 as another WLC IP. Because there are now 2 WLCs the intial value will be f108. We know that c0a81734 is the first hex value and a quick bit of maths reveals the second hex value for 192.168.23.53 as c0a81735. The final value to be used on the router will be:

f108.c0a8.1734.c0a8.1735

Hex - Two WLC IP string
Hex – Two WLC IP string

Useful Resources

http://www.cisco.com/c/en/us/support/docs/wireless-mobility/wireless-lan-wlan/97066-dhcp-option-43-00.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s