Sometimes you need to push the TFTP server value as part of the DHCP process, for example, this is used in most VoIP systems. The VoIP phone use the TFTP server to download configuration files. Here I will show you how to set this value in the Mikrotik DHCP server.
1. Boring stuff
The boring stuff for a start. The pushing TFTP server value with the DHCP server is described in RFC 5859. The part that we are interested in is the format of this option.
The format of the option is: Code Len IPv4 Configuration Server Address(es) +-----+-----+-----+-----+-----+-----+ | 150 | n | IPv4 address | ... +-----+-----+-----+-----+-----+-----+
DHCP Option 150 is Cisco proprietary. The IEEE standard that matches this requirement is Option 66. Like option 150, option 66 is used to specify the Name of the TFTP server.
Option 66 is an open standard juniper that supports it. RFC 2132 defines option 66.
The IP address should be in the hex format so we need to convert our IP to hex. Ok, now we have all the required knowledge lets go to config.
2. Prepare values
Ok for example let’s have the IP of TFPT server 192.168.65.150
We split the IP into separate octets. Convert decimal values to hexadecimal and then put it all together. We also need to add the 0x at the start, which will say to Mikrotik that the value is in hexadecimal format.
DEC | HEX |
192 | C0 |
168 | A8 |
65 | 41 |
150 | 96 |
So the final value for Mikrotik configuration is 0xC0A84196.
3. All together
Now we need to configure Mikrotik. We will connect to Mikrotik and use the terminal or you can follow the command in GUI. For an explanation of codes 150 and 66 see the first chapter.
/ip dhcp-server option
add code=150 name=primarytftp value=0xc0a84196
add code=66 name=secondarytftp value=0xc0a84196
/ip dhcp-server network
add address=192.168.65.0/24 dhcp-option=primarytftp,secondarytftp dns-server=\
8.8.8.8 gateway=192.168.65.1 ntp-server=192.168.65.150
... other standard settings of the dhcp-server ...