DHCP Option creation (119)

Hello,

I faced to some difficulties to create a new DHCP option on the Sophos, so I would like to share my procedure with the community.

Based on this documentation:
community.sophos.com/.../123529

My need was to add two domains in the search list . The DHCP option is the 119.
Domains:
- test.com
- in.test-domain.com

1. Connect by SSH on the Sophos

2. Select: 4. Device console

3. Create a DHCP-Option if it's not in the list: 

To check the list:
> system dhcp dhcp-options list
The firewall will only display option numbers 1 to 76 but supports all 255 option objects.

Create the new option:
> system dhcp dhcp-options add optioncode 119 optionname Domain_Search_List optiontype string

4. Assign this new dhcp option to the dhcp

> system dhcp dhcp-options binding add dhcpname DHCP_LAN optionname Domain_Search_list(119) value 04:74:65:73:74:03:63:6f:6d:00:02:69:6e:0b:74:65:73:74:2d:64:6f:6d:61:69:6e:c0:05

Note: For the option 119, you need to translate it in HEX with this syntax 4test3com0002in12test2ddomainc005 (https://tools.ietf.org/html/rfc3397).
Start with the number of characters between the dots, end with C0. 05 is to point the .com already set with the first domain.

You can use this python script to translate yours domain search list:
https://gist.github.com/SmartFinn/be417c7a7e0b3d9bee9c29e74d08ff78

5. Check the DHCP options
> system dhcp dhcp-options binding show dhcpname DHCP_LAN


That's all, verify on your client that you received the get the search list.
Do not hesitate to capture the traffic with wireshark, it helped me to debug this.