Page 1 of 1

RouterOS Not sending DHCP-Server Option 66

Posted: Wed Feb 18, 2009 9:29 pm
by canniscam
There may be a be a bug in the dhcp server implementation used by Mikrotik. I have been trying to implement a FOG (Open Source Disk Imaging Server) to help with managing our workstations. When I used the dchp3-server daemon with Ubuntu and FOG it works perfectly fine with the following configuration:

# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# This file was created by FOG
use-host-decl-names on;
ddns-update-style interim;
ignore client-updates;

### This is the equivalent to option 66
next-server 10.22.1.27;

subnet 10.22.1.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
range dynamic-bootp 10.22.1.199 10.22.1.201;
default-lease-time 21600;
max-lease-time 43200;
option domain-name-servers 10.22.1.13;
option routers 10.22.1.253;
#### Equiv to Option 67
filename "pxelinux.0";
}
I have the following configuration setup in RouterOS:

/ip dhcp-server option
add code=66 name=TFTP-Server value=10.22.1.27
add code=67 name=PXE-FILE value=pxelinux.0
add code=60 name=Client-Redirect value=PXEClient


/ip dhcp-server network
add address=10.22.3.0/24 comment="" dhcp-option=\
Client-Redirect,TFTP-Server,PXE-FILE dns-server=\
10.22.3.2,10.22.0.2 gateway=10.22.3.1

When I review the logs in router OS with the dhcp topic and the debug prefix, I can see other options being sent, but 66 is never transmitted.

I can attach a supout.rif file if requested or I can e-mail it to support.

Best Regards,
Casey Annis
casey.annisATttiwirelessDOTcom

Re: RouterOS Not sending DHCP-Server Option 66

Posted: Wed Feb 18, 2009 9:57 pm
by changeip
on 3.20 ?

Re: RouterOS Not sending DHCP-Server Option 66

Posted: Thu Feb 19, 2009 6:46 pm
by canniscam
Doh!

Yes, on 3.20 for X86 with VIA and Realtek NICs...

Casey

Re: RouterOS Not sending DHCP-Server Option 66

Posted: Sat Apr 04, 2009 4:53 am
by ricrc
Same problem here.

Option 66, is not being transmitted. I can confirm it was not transmitted on packet capture.

Running RB600A ROS 3.13

Re: RouterOS Not sending DHCP-Server Option 66

Posted: Mon Aug 03, 2009 4:19 am
by dssmiktik
Option 66 setting:
/ip dhcp-server network set 0 next-server=
Option 67 setting:
/ip dhcp-server network set 0 boot-file-name=
This works on every 3.x version I've tried.

Re: RouterOS Not sending DHCP-Server Option 66

Posted: Mon Aug 08, 2011 11:34 pm
by hjoelr
I was having the same problem of my DHCP server not sending my TFTP option codes. I found that I had to add the "dhcp-option" parameter to each network:
/ip dhcp-server option
add code=66 name=tftp value=192.168.2.8
add code=150 name=tftp1 value=192.168.2.8

/ip dhcp-server network
add address=172.16.12.0/24 dhcp-option=tftp,tftp1 dns-server=\
    208.67.222.222,208.67.220.220 gateway=172.16.12.254
add address=192.168.0.0/24 dhcp-option=tftp,tftp1 dns-server=\
    208.67.222.222,208.67.220.220 gateway=192.168.0.254
This can also be done by going to IP -> DHCP Server -> Networks -> {double-click the network you want} -> DHCP Options.

I hope this helps!

Re: RouterOS Not sending DHCP-Server Option 66

Posted: Wed Nov 09, 2011 5:19 pm
by miahac
I am having an issue with some cisco phones on dhcp option 150 with some cisco phone. I put in:
add code=150 name=TFTP value=10.1.11.10
add code=66 name=tftp-66 value=10.1.11.10
and the phone tries to tftp from 49.48.46.96

I think it may be a cisco default or it is reading the value wrong.

Re: RouterOS Not sending DHCP-Server Option 66

Posted: Wed Nov 09, 2011 6:40 pm
by Chupaka
I am having an issue with some cisco phones on dhcp option 150 with some cisco phone. I put in:
add code=150 name=TFTP value=10.1.11.10
add code=66 name=tftp-66 value=10.1.11.10
and the phone tries to tftp from 49.48.46.96

I think it may be a cisco default or it is reading the value wrong.
49, 48, 46 are charcodes for '10.' - try to use HEX values:
add code=150 name=TFTP value=0x0a010b0a
add code=66 name=tftp-66 value=0x0a010b0a

Re: RouterOS Not sending DHCP-Server Option 66

Posted: Wed Nov 09, 2011 7:13 pm
by miahac
I will try it! I had tried coping the line directly out of the cisco router that had been using and got a completely different result
ip 10.1.11.10 10.1.11.11

Re: RouterOS Not sending DHCP-Server Option 66

Posted: Thu Nov 10, 2011 5:30 pm
by miahac
49, 48, 46 are charcodes for '10.' - try to use HEX values:
add code=150 name=TFTP value=0x0a010b0a
add code=66 name=tftp-66 value=0x0a010b0a
WOW HEX WORKED, GOOD EYE!!!

Re: RouterOS Not sending DHCP-Server Option 66

Posted: Sun Sep 14, 2014 10:01 am
by servaris
I tried adding it via Mikrotik GUI and do not see the phone able to connect to the tftp server. Turned off the dhcp server on Mikrotik for the wired network and used some windows based dhcp server, used option 66 with the IP and it connected immeditately.

/ip dhcp-server network
add address=192.168.10.0/24 dhcp-option=tftp-66,tftp dns-server=\
192.168.10.253 domain=internal gateway=192.168.10.1 ntp-server=\
206.108.0.132 wins-server=192.168.10.252

/ip dhcp-server option
add code=150 name=tftp value=0x6B063232
add code=66 name=tftp-66 value=0x6B063232

I would much rather use Mikrotik over a windows 7 solution. But for the life of me I cannot see why the above fails to work when the comments in this thread show they are.

What might be wrong here?
Thanks.

I found what I was doing wrong!

The code must be 150 using code 66 is not working. Not sure if this is a bug or not. code 150 is working for sure.

Re: RouterOS Not sending DHCP-Server Option 66

Posted: Sun Sep 14, 2014 11:28 am
by patrikg
I suggest to take a look at the new syntax for the dhcp options in the wiki.

http://wiki.mikrotik.com/wiki/Manual:IP ... CP_Options

Re: RouterOS Not sending DHCP-Server Option 66

Posted: Mon Sep 15, 2014 5:17 am
by servaris
I suggest to take a look at the new syntax for the dhcp options in the wiki.

http://wiki.mikrotik.com/wiki/Manual:IP ... CP_Options
Hi Patrikg,
My syntax is:

/ip dhcp-server option
add code=150 name=tftp-server value=0x63EE56AE

It works. However, if code=66 it will NOT work.

Re: RouterOS Not sending DHCP-Server Option 66

Posted: Mon Sep 15, 2014 6:39 pm
by patrikg
If you read the Cisco doc's.
Option 66 is for the tftp host name, not the ip.

Maybe you can use it, if you have a correct dns resolving on the cisco phones.
And use a correct host name as string.
ex: tftserver.local.lan

ros code

/ip dhcp-server option add code=66 name=tftp-server-host value="'tftpserver.local.lan'"

Re: RouterOS Not sending DHCP-Server Option 66

Posted: Thu Apr 20, 2017 8:36 pm
by FIPTech
DHCP Option 66 can be used for a host name or an ip address. In both case it is normally a string.

If used for an IP address, according to what i'm used to, it is necessary to convert the IP address to a string. Using four hex values does not work, at least with Aastra phones.

https://wiki.mikrotik.com/wiki/Manual:IP/DHCP_Server

So you need to put "s" before the IP address to convert it to an string :

s'192.168.112.150'

and you'll get this raw value :

0x 31 39 32 2e 31 36 38 2e 31 31 32 2e 31 35 30

dhcp-server option print
# NAME CODE VALUE RAW-VALUE
6 TFTP server 66 s'192.168.112.150' 3139322e3136382e3131322e313530

If you try to use four hex values for the IP (like this : '192.168.112.150' ), a phone or Wireshark will not decode it correctly, as shown here in Wireshark :

When using four hex values for the option 66 code value you will get something like this :
TFTP Server Name: \300\250\310d

The same goes in the phone. So the phone will not take it and will try another method to get the tftp file server address, or will fail to download the config file.

When using hex values converted as a string (like this : s'192.168.112.150') you'll get the right IP address decoded inside Wireshark and it will work in the phone :

TFTP Server Name: 192.168.112.150

Another solution is to use an mDNS server on the IPBX side. Aastra / Mitel phones do know how to get the tftp server address from it.

I prefer to use DHCP option 66, as i have seen frequent crashes on the mDNS linux deamon.