Hello,
I have grandstream phones in my network and i want them to grab dhcp option 2 and 42 automatically from mikrotik dhcp.
can someone please clarify in details on how to configure?
what is the pattern when adding the value ?
also, is hex always used for dhcp options ?
Thanks a lot.
You can set those in /ip dhcp-server option. I don’t use it but I know where to set it.
http://wiki.mikrotik.com/wiki/Manual:IP/DHCP_Server#DHCP_Options
I have read the wiki many times but it does not provide good information.
please i want details.
Are these the options you wanted?
/ip dhcp-server option
add name="Time Zone Offset" code=2 value="'-28800'"
add name="NTP Server" code=42 value="'1.2.3.4'"
The value is a bit odd. It requires a double and single quote on each end of the value if not a hex value.
Thanks SurferTim.
what is the difference between the dhcp option 42 and the ntp server option in dhcp networks.
what is the difference between the dhcp option 42 and the ntp server option in dhcp networks.
Probably nothing different. Just a different way of sending option 42. I have not tested it, but I don’t see another way using dhcp to send the NTP server IP.
SurferTim, i tried the options but for some reason it is not working correctly, i have around 10 grandstream telephones and the options 2 and 42 are enabled on the phones.
could there be something wrong?
please help.
many thanks ![]()
you can check frc for each DHCP option and what it accepts as value. In RouterOS dhcp value length is calculated automatically, so you have to only provide actual value.
if you want to give ip address as an value you can use 0x0a0a0a0a or ‘10.10.10.10’ and set in as a value. Since initial construct is value=“” when you place ‘10.10.10.10’ in it you get value=“‘10.10.10.10’” alternative to value=“0x0a0a0a0a”.
Of course, you can always use HEX value to set anything. However, use of special parsing of the value argument in dhcp options is suggested behaviour to improve readability.
can you tell me how to use the HEX method to calculate the ip address or a string for example?
Here is my code for IP phones that use option 66.
/ip dhcp-client option
add code=66 name=“tftp server” value=0xc0a8040aI use http://paulschou.com/tools/xlate/ to convert between hex, text, base64 and other formats.
string conversion happens liek this - get char → look up ASCII code for it → file it in.
so 10.11.12.13 becomes 0x31302e31312e31322e3133 so you get 11 hex numbers in a row
if you wanted ip address, you convert each section of ip address to hex. Example address - 10.11.12.13
10 = a; 11 = b; 12 = c; 13 = d.
now, it has to be double digit hex since ip address goes to FF or 255, so you get 0x0a0b0c0d
or just enter value=“‘10.11.12.13’” and see raw value of the option. when printing
/ip dhcp-server option print
1 test 43 s’10.11.12.13’ 31302e31312e31322e3133
1 test 43 ‘10.11.12.13’ 0a0b0c0d
I used to use option 66 for provisioning VOIP phones before I updated my router OS. Now no matter what method I try, my phones will not pull the option 66 configuration. I’m running 6.19 router OS and have tried setting the value in hex, decimal, and string. Previously, I would just put the value as this ‘IP adresss’. Then of course setting the next server and option in the network.
Any help is much appreciated.
try to set s’ip.add.ress.here’ as a value if you set option 66 yourself as it seem from RFC, that it expects host-name not an ip address. if you give ‘ip.add.re.ss’ then it is interpreted as an ip address and you get hex string os in length of 4.
If you enter next server, it should accept ip address as a value.