DHCP Option 122 Calculator | docsis.org

You are here

DHCP Option 122 Calculator

7 posts / 0 new
Last post
DHCP Option 122 Calculator

Could someone point me in the direction of a Option 122 Calculator? I would be greatly appreciative.


What do you mean?

What do you mean?

What I mean is that I am

What I mean is that I am needing a program that I can give all the sub options and it generate the hex that's needed for my DHCP server to reply back with. My DHCP server lets me return any dhcp option but it does not know how to generate the hex needed for the 122 option. SO I need something that will give me the hex to fill in that option with.

Here is another thread that deals with this subject.



First of all which DHCP

First of all which DHCP server are you using?

Second you do not need a calculator just go look at RFC 3495 for option 122. The general dhcp options RFC is good to look at as well it is located here

but for reference the option is encoded like so (straight from RFC)

| 122 | Length | Sub-option 1 | Sub-option 2 |-----| Sub-option n |

| Sub-option Code | Length | Sub-option information |

So for example
option 122 with suboptions 1 and 2 set to and respectively would be encoded like so

all you need to do these calculations is a simple calculator with dec->hex capabilities windows calc works fine

7A---------------------------122 Option Number
12--------------------------- Length in bytes of all suboptions combined
01-----------------------------1 (suboption 1) (bytes 1)
04-----------------------------4 (suboption length in bytes) (bytes 1)
COA80101----------------- (encode each octet indivdually i.e. 192 == C0 168 == A8 (bytes 4)
02-----------------------------2 (suboption 2) (bytes 1)
04-----------------------------4 suboption length in bytes (bytes 1)
COA80102----------------- (bytes 4)

so the Hex encoded value would be


it is very simple, though somewhat hard to get your head around at first.

let me know if you still have troubles..

In your sample

In your sample the size of suboptions must be 12 or 0C ?

my values are
Option 1 value 01040A0A00CB
Option 2 the same
and according to the RFC the suboption 3 must have the size and 01 for ip or 00 for fqdn, in my case
value 030501BE0C7663

and the result 1301040A0A00CB02040A0A00CB030501BE0C7663

with tcpdump I see T122 Option 122, length 20: 318833674,167824130,67766784,3405972737,3188487779
If I pad with 0 I see T122 Option 122, length 21:
I already try changing the size to Hex 14 ...

but the MTA refuse to start the DHCP process ...
I already try without the 01, with the size in decimal, the name instead the IP ... really lost with this stuff



I Hope this could be helpful for someone...

MTA Arris 450, CMTS Arris C3

I was able to finally get working the MTA !!!!
I send to the Modem only 122 option 1 and to the MTA only options 3 and 6.
Option 1 is 0104 and the IP in Hexa (DHCP Router)
Option 3 is 030501 and the IP in Hexa (Softswitch IP)
Option 6 is 06090542415349430131 (The word BASIC.1 in Hexa)

and the other options needed (you can see in http://www.docsis.org/node/264)


glad to hear it is working ,

glad to hear it is working , that option 122 is a killer.

good catch on the length should be 0C not 12

I posted bellow ...

I posted bellow ...

Log in or register to post comments