DHCP Option 119 Domain Search on Junos SRX
At times you will need to add dns domain suffix searches to be pushed down to your dhcp clients. The dns server will be using option 119 to do this. To set up option 119 on a Junos dhcp server you need to do the following:
First, we have to format the domain into a hex string. For our example we are going to use mydomain.local
Converting mydomain.local to hex we will get the following:
m y d o m a i n . l o c a l 6D 79 64 6F 6D 61 69 6E 2E 6C 6F 63 61 6C
Now – replace the . (2E) with the hexidecmal value for the number of characters after the . (dot) – since “local” is 5 characters we will replace the 2E with 05
m y d o m a i n . l o c a l 6D 79 64 6F 6D 61 69 6E 05 6C 6F 63 61 6C
count the number of characters before the . (dot) and add that value (in hex) to the start of the string. Since “mydomain” is 8 characters we will add 08
m y d o m a i n . l o c a l 08 6D 79 64 6F 6D 61 69 6E 05 6C 6F 63 61 6C
now add 00 (two zeros) at the end of the string
m y d o m a i n . l o c a l 08 6D 79 64 6F 6D 61 69 6E 05 6C 6F 63 61 6C 00
last step – add option 119 to your address-assignment. In my SRX the pool is named OFFICEPOOL so the command will be
set access address-assignment pool OFFICEPOOL family inet dhcp-attributes opion 119 array hex-string 086D79646F6D61696E056C6F63616C00
commit your changes and test them out!!!
If you need to add more than one domain search prefix, just repeat the above steps for each domain and add an additional option 119 for each domain for your dhcp pool
Reference:
https://blog.it-playground.eu/dhcp-option-119-domain-search-on-juniper-srx/
Additional notes:
For older versions:
cat /etc/resolv.conf
systemd-resolve --status | grep "DNS Domain"
( nmcli dev list || nmcli dev show ) 2>/dev/null | grep DNS