Page 1 of 1

tftp-server-name option in DHCP-SERVER

Posted: Fri Feb 17, 2012 9:51 pm
by cdman
Hello guys , I am trying to update my CISCO VoIP phone CP-7961G with new firmware and want after that to use it in my home network. For this I need DHCP server to give the phone TFTP IP address . I tried to make config but it seems it does not work.
/ip dhcp-server
add address-pool=dhcp_pool1 authoritative=after-2sec-delay bootp-support=static disabled=no interface=bridge1 lease-time=3d name=dhcp1
add address-pool=hs-pool-4 authoritative=after-2sec-delay bootp-support=static disabled=no interface=eth4-zhechko lease-time=1h name=dhcp2
/ip dhcp-server option
add code=150 name=tftp-server-name value=10.1.1.20
/ip dhcp-server config
set store-leases-disk=5m
/ip dhcp-server lease
add address=10.1.1.203 always-broadcast=yes client-id=1:0:18:ba:c8:c8:89 comment=CP-7961G disabled=no mac-address=00:18:BA:C8:C8:89 server=dhcp1
/ip dhcp-server network
add address=10.1.1.0/24 dhcp-option="" dns-server="" gateway=10.2.2.1 ntp-server=10.1.1.20 wins-server=""

Re: tftp-server-name option in DHCP-SERVER

Posted: Sat Feb 18, 2012 2:39 am
by changeip
i just did this yesterday. funny.

the option 150 is not straight ip address, you need to encode it in hex some weird way.

better way is to just set 'next-server' to your tftp ip on the 'dhcp-server network' to include the tftp server ip... works fine.

Re: tftp-server-name option in DHCP-SERVER

Posted: Sat Feb 18, 2012 2:40 am
by changeip
ps - i was not successful in using routeros tftp or centos atftp, i had to use windows tftpd32 version 3.23 on the local subnet to make it work. not sure why, files would time out using routeros and atftpd, probably some EOF block that it didnt like or something.

Re: tftp-server-name option in DHCP-SERVER

Posted: Sat Feb 18, 2012 4:43 pm
by cdman
Thanks for the answers I will try both now.

Re: tftp-server-name option in DHCP-SERVER

Posted: Mon Jun 04, 2012 2:05 pm
by nikolovski
Did you manage to configure option 150?
I'm having the same problem and it seems that it dosen't work.

Regards,
Marko

Re: tftp-server-name option in DHCP-SERVER

Posted: Tue Jun 05, 2012 10:00 am
by janisk
here is the description of the feature:
http://wiki.mikrotik.com/wiki/Manual:IP/DHCP_Server

and configure TFTP server properly to hand you requested files. Check compatibility of the TFTP client you are going to use as different clients support different features that vary from RFC.

Re: tftp-server-name option in DHCP-SERVER

Posted: Tue Jun 05, 2012 11:45 am
by nikolovski
Thanks for the reply.
This is how I have the option defined:

/ip dhcp-server option
add code=150 name=option150 value=10.20.1.2

/ip dhcp-server network
add address=192.168.188.0/24 dhcp-option=\
option150 dns-server=192.168.188.1 domain=x.x gateway=\
192.168.188.1 netmask=25 ntp-server=192.168.188.1 wins-server=""

If I define it on linux isc dhcp server it works without problem. On the Mikrotik it seems there is compatibility issue.
The client is a Cisco phone.
Any suggestion will be appreciated.

Regards,Marko

Re: tftp-server-name option in DHCP-SERVER

Posted: Tue Jun 05, 2012 12:03 pm
by janisk
in RouterOS you have to define DHCP server option as described in RFC or use already predefined field to enter the required value.

http://tools.ietf.org/html/rfc5859
              Code   Len   IPv4 Configuration Server Address(es)
             +-----+-----+-----+-----+-----+-----+
             | 150 |  n  |     IPv4 address      | ...
             +-----+-----+-----+-----+-----+-----+

Re: tftp-server-name option in DHCP-SERVER

Posted: Thu Jun 07, 2012 5:05 am
by itcoresys
Copy/pasting the ietf.org website is cool and all, but doesnt help us with Mikrotik and the DHCP options.


The only example in the wiki is a static route and the value is in hex.

Do all DHCP options need to be in hex to work? or in quotes? or in the case of option 150 in the example, perhaps "4,10.0.0.1" ?

Please show an example for option 150 to hand out the address 10.0.0.1 for Cisco phones in Mikrotik commands please.

Thanks
in RouterOS you have to define DHCP server option as described in RFC or use already predefined field to enter the required value.

http://tools.ietf.org/html/rfc5859
              Code   Len   IPv4 Configuration Server Address(es)
             +-----+-----+-----+-----+-----+-----+
             | 150 |  n  |     IPv4 address      | ...
             +-----+-----+-----+-----+-----+-----+

Re: tftp-server-name option in DHCP-SERVER

Posted: Thu Jun 07, 2012 5:23 am
by bitsmt
Maybe what is missing is the Port number?

I get the impression that RouterOS is extreamly powerful, but very dumb on its own unless you tell it EXACTLY what you need it to do.

With this OS, knowledge is definitely power. Boy do I have lots to learn.

Re: tftp-server-name option in DHCP-SERVER

Posted: Tue Sep 11, 2012 8:17 pm
by foxpdll
Maybe what is missing is the Port number?

I get the impression that RouterOS is extreamly powerful, but very dumb on its own unless you tell it EXACTLY what you need it to do.

With this OS, knowledge is definitely power. Boy do I have lots to learn.
I have some trouble
i suppose that thomsing like this

/ip dhcp-server option
add code=150 name=my150 value=0x04C0A80B0A
/ip dhcp-server network set 0 dhcp-option=my150

where 0x04C0A80B0A is a string from 04 + 192 + 168 + 11 + 10 but in hex format
try this way and say me if it work please
i cant check this

Re: tftp-server-name option in DHCP-SERVER

Posted: Tue Sep 18, 2012 2:41 pm
by janisk
when using hex options you can check in packet sniff if values are correct and what happens afterwards wehn packet is received.

Re: tftp-server-name option in DHCP-SERVER

Posted: Tue Oct 16, 2012 2:42 pm
by zloba
We are migrating couple of branches from cisco to MT and need to push two values via option 150 (primary and secondary tftp servers to phone configurations).

If I define two options
/ip dhcp-server option
add code=150 name=primarytftp value=0x0a0a0a0a
add code=150 name=secondarytftp value=0x0a0a0a0b
and then point
add address=10.10.10.0/24 dhcp-option=primarytftp,secondarytftp dns-server="" gateway=10.10.10.1 netmask=24 ntp-server="" wins-server=""
Only first option is written into phones configuration. "secondarytftp" is just ignored.

I'm feeling that MT requires that both values have to be defined under ONE "dhcp-server option name=x", but MT rejects this kind of input. Tried comma;semicolumn,space as delimiters.

question:
how to feed several values within one dhcp option (150 / tftp).

ps:
config from cisco which i'm trying to replicate on MT
ip dhcp pool VOIP
network 10.10.10.0 255.255.255.0
default-router 10.10.10.1
option 150 ip 10.10.10.10 10.10.10.11

Re: tftp-server-name option in DHCP-SERVER

Posted: Tue Oct 16, 2012 3:59 pm
by patrickmkt
Also the option is defined for all dhcp server on all interfaces. Is there a way to define an option for one interface/dhcp server only.
I need option 150 with different value on different interfaces...

Re: tftp-server-name option in DHCP-SERVER

Posted: Tue Oct 16, 2012 4:02 pm
by janisk
can you try to set this up custom 150 option as you already did but in a way that is described in RFC as when you define custom options they are used as you wrote them.

http://tools.ietf.org/html/rfc5859
The format of the option is:

Code Len IPv4 Configuration Server Address(es)
+-----+-----+-----+-----+-----+-----+
| 150 | n | IPv4 address | ...
+-----+-----+-----+-----+-----+-----+

Figure 1

The option minimum length (n) is 4.

The "Len" field must specify a length that is an integral multiple of
4 octets (4, 8, 12, etc.). If an option is received where this is
not the case, the option information MUST be ignored, but further
option processing may continue. Dividing this "Len" value by 4 will
give the number of IPv4 VoIP configuration server addresses that are
specified in the option
so the result should look something like this:

ros code

/ip dhcp-server option
add code=150 name=customtftp value=0x0a0a0a0a0a0a0a0b

Re: tftp-server-name option in DHCP-SERVER

Posted: Tue Oct 16, 2012 4:52 pm
by zloba
kudos to janisk!
works.

Re: tftp-server-name option in DHCP-SERVER

Posted: Sun Sep 14, 2014 11:24 pm
by servaris
I think it is worth noting that code cannot be 66

Been playing with this all day and have found when using code 66 the phone does not connect to remote tftp server.

Re: tftp-server-name option in DHCP-SERVER

Posted: Tue Aug 16, 2022 3:44 pm
by MikeKulls
"Next Server" worked for me. I tried all sorts of other settings with option 66 and option 150, adding them to an option sets, putting a 0x04 in front of the IP address in hex, configuring the individual options in the DHCP server and network, configuring the option sets there too. The only thing that worked was Next Server

I am using phones 7941 and 7940 and using Tftpd64 on a windows box. I simply set Next Server to the IP of my windows box and everything suddenly started working. Before that the tftp server didn't get any connections.