Community discussions

MikroTik App
 
cdman
newbie
Topic Author
Posts: 29
Joined: Sun Jan 01, 2006 11:47 pm
Location: Bulgaria/Sofia

tftp-server-name option in DHCP-SERVER

Fri Feb 17, 2012 9:51 pm

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=""
 
changeip
Forum Guru
Forum Guru
Posts: 3830
Joined: Fri May 28, 2004 5:22 pm

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

Sat Feb 18, 2012 2:39 am

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.
 
changeip
Forum Guru
Forum Guru
Posts: 3830
Joined: Fri May 28, 2004 5:22 pm

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

Sat Feb 18, 2012 2:40 am

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.
 
cdman
newbie
Topic Author
Posts: 29
Joined: Sun Jan 01, 2006 11:47 pm
Location: Bulgaria/Sofia

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

Sat Feb 18, 2012 4:43 pm

Thanks for the answers I will try both now.
 
nikolovski
just joined
Posts: 3
Joined: Sun Mar 07, 2010 4:12 pm

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

Mon Jun 04, 2012 2:05 pm

Did you manage to configure option 150?
I'm having the same problem and it seems that it dosen't work.

Regards,
Marko
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

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

Tue Jun 05, 2012 10:00 am

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.
 
nikolovski
just joined
Posts: 3
Joined: Sun Mar 07, 2010 4:12 pm

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

Tue Jun 05, 2012 11:45 am

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
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

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

Tue Jun 05, 2012 12:03 pm

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      | ...
             +-----+-----+-----+-----+-----+-----+
 
itcoresys
newbie
Posts: 26
Joined: Mon Oct 03, 2011 7:14 am

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

Thu Jun 07, 2012 5:05 am

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      | ...
             +-----+-----+-----+-----+-----+-----+
 
bitsmt
just joined
Posts: 10
Joined: Tue Jun 05, 2012 9:04 pm

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

Thu Jun 07, 2012 5:23 am

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.
 
foxpdll
just joined
Posts: 10
Joined: Tue Jul 31, 2012 3:47 pm

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

Tue Sep 11, 2012 8:17 pm

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
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

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

Tue Sep 18, 2012 2:41 pm

when using hex options you can check in packet sniff if values are correct and what happens afterwards wehn packet is received.
 
zloba
just joined
Posts: 2
Joined: Wed Feb 29, 2012 5:31 pm

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

Tue Oct 16, 2012 2:42 pm

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
 
patrickmkt
Member Candidate
Member Candidate
Posts: 200
Joined: Sat Jul 28, 2012 5:21 pm

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

Tue Oct 16, 2012 3:59 pm

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...
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

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

Tue Oct 16, 2012 4:02 pm

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
 
zloba
just joined
Posts: 2
Joined: Wed Feb 29, 2012 5:31 pm

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

Tue Oct 16, 2012 4:52 pm

kudos to janisk!
works.
 
servaris
Frequent Visitor
Frequent Visitor
Posts: 67
Joined: Tue May 20, 2014 4:30 pm
Location: Planet Earth
Contact:

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

Sun Sep 14, 2014 11:24 pm

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.
 
MikeKulls
Member Candidate
Member Candidate
Posts: 130
Joined: Thu Dec 22, 2016 4:31 am

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

Tue Aug 16, 2022 3:44 pm

"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.

Who is online

Users browsing this forum: Amazon [Bot], jamesperks, popecix, xristostsilis and 77 guests