DHCP-OPTIONS example.

Hello ALL.

Have anybody real life example with dhcp-option? I mean that example that I’ve check ( http://www.mikrotik.com/testdocs/ros/2.9/ip/dhcp.php ) is not work for me.

I’ve get info from Mikrotic that “You have to set DHCP option settings in HEX form.”
How I can do that? Which tool is better to use for that?
Should I Use “” on the begin and end in value?
Should I use 0xSOME_HEX or just SOME_HEX.
Values for some VOip device should have something like “TFTP=192.168.100.1, HTTP=192.168.100.2”. How I can setup such value?

For example: I’ve try to setup dhcp-option domain-name (code 15) like mydomain.com

add name=domain-option code=15 value=6D79646F6D61696E2E636F6D
add name=domain-option code=15 value=”6D79646F6D61696E2E636F6D”
add name=domain-option code=15 value=0x6D79646F6D61696E2E636F6D
add name=domain-option code=15 value=”0x6D79646F6D61696E2E636F6D”

All examples are not working ;(.

Anyone ?

May anybody give me exapmle how to setup in dhcp “domain-name mydomain.com” ?

Next example do not work: (

add name=domain-option code=15 value=mydomain.com
add name=domain-option code=15 value=“mydomain.com
add name=domain-option code=15 value=6D79646F6D61696E2E636F6D
add name=domain-option code=15 value=”6D79646F6D61696E2E636F6D”
add name=domain-option code=15 value=0x6D79646F6D61696E2E636F6D
add name=domain-option code=15 value=”0x6D79646F6D61696E2E636F6D”

I suppose you need to add option value in hex only for those options that are not listed in IANA list:
http://www.iana.org/assignments/bootp-dhcp-parameters

Be sure and add the option to the DHCP Server.
Defining the option alone is not enough…

How about real examples?

I want to set dHCP to do two things:

  1. to turn NETBOIS off on client and
  2. to set specific static route (for example: to set default gateway 10.50.0.1 for network 10.50.0.0/16).

I’ve been searching for something that works for a long time, but all I get is bunch of documents that list DHCP parameters and no Mikrotik example how to use them :frowning:

ok here is working example.

Assume that you already have created working dhcp server.

add an option:
/ip dhcp-server option
add code=66 name=“option1” value=“10.10.1.1”

after that set option to use on dhcp network:
/ip dhcp-server network set dhcp-option=option1

Now dhcp client will receive TFTP Server Name. Thats it.
Note, that dhcp server sends this option to client only if client is requesting for it.

/ ip dhcp-server option 
add name="TFTP" code=66 value="10.120.10.10"
/ ip dhcp-server network 
add address=10.120.21.0/24 gateway=10.120.21.1 netmask=24 \
    dns-server=206.246.134.233,10.120.10.10 wins-server=10.120.10.10 \
    ntp-server=206.246.134.2,206.246.134.66,206.246.134.1 domain="asc.local" \
    dhcp-option=TFTP comment=""

this is essentially the same as what was posted by mrz, just has a few more parameters defined… we set the TFTP option for our VoIP phones to connect back to our asterisk server at our main office.

[quote="ForePoint]
this is essentially the same as what was posted by mrz, just has a few more parameters defined… we set the TFTP option for our VoIP phones to connect back to our asterisk server at our main office.[/quote]

How about next ??

option option-242 code 242 = string ;
option option-242 “MCIPADD=192.168.1.254,MCPORT=1719,HTTPSRVR=192.168.1.253”;

Is it cirrect ???

first:

/ ip dhcp-server option 
add name="option-242" code=242 value="MCIPADD=192.168.1.254,MCPORT=1719,HTTPSRVR=192.168.1.253"

then :

/ ip dhcp-server network 
add [insert your dhcp values here followed by] dhcp-option=option-242

i want it too …
on my ISC DHCPD i do following:

  • to disable NetBIOS:
option space Microsoft;
option Microsoft.disable-netbios-over-tcpip   code 1 = unsigned integer 32;
option Microsoft.release-on-shutdown          code 2 = unsigned integer 32;
option Microsoft.default-router-metric        code 3 = unsigned integer 32;

if substring(option vendor-class-identifier, 0, 4) = "MSFT" {
    vendor-option-space Microsoft;
    option Microsoft.disable-netbios-over-tcpip 2; # disable
    option Microsoft.release-on-shutdown 1;
}
  • for RFC 3442 aka “Classless Static Route”:
# for Windows Vista and other non Windows DHCP clients
option classless-static-route code 121 = array of unsigned integer 8;
# for Windows 2000 and XP DHCP clients
option classless-static-route-ms code 249 = array of unsigned integer 8;

and then, for example

subnet 192.168.0.0 netmask 255.255.255.0 {
    option routers 192.168.0.1;
    option domain-name-servers 192.168.0.1;

    option classless-static-route    24,192,168,1, 192,168,1,1, 24,192,168,2, 192,168,2,1;
    option classless-static-route-ms 24,192,168,1, 192,168,1,1, 24,192,168,2, 192,168,2,1;
}

how i can do it on MT?

Do a google search on dhcp options.

Options 44 - 46 pertain to netbios.
Option 121 pertains to classless-static-route.

You can not expect to not try on your own first, and have others do the work for you.
Please research for yourself, then ask for further detail.

You will ultimately walk away knowing more, in the end.

I’m sure that this not work. I’ve tried to setup that a lot of times. After that I’ve create ticket and answer from MT was

“You have to set DHCP option settings in HEX form”.

Has anybody test dhcp option code>224? ( http://www.iana.org/assignments/bootp-dhcp-parameters - >> (224-254 Private Use ))

Create a text file (MCI.TXT) containing only the following:

MCIPADD=192.168.1.254,MCPORT=1719,HTTPSRVR=192.168.1.253

Open a command prompt and type:
debug MCI.TXT > MCIHEX.TXT
You will not see any output on the display.
type d for dump
type q for quit
Now close the dos prompt and edit the MCIHEX.TXT
Remove what is not required and add the 0x in front of every byte, then add a 0x00 at the end.
Paste it into the Option.

this would be easier:
http://chxo.com/scripts/hex2string.php

Fare enough..

I’ve used debug for various things for over 20 years.
It has always remained the same.

odd, because it is working for me. that code was copied directly out of a working dhcp server running on 2.9.38

edit: I was referring to my TFTP option 66 example is working, the option 242 I am unfamiliar with, I was just using the provided text example…

That is because option 66 is clearly defined.
Option 242, on the other hand, is not clearly defined (reserved status).

Just for Info:
What’s new in 3.0rc14:

*) fixed bug - dhcp server failed to give out options with code > 127;

Looks like nobody did find a way to get this working…
Or the later part at least..


I desperately need to set my clients mikrotiks routes from the dhcp server. (Also running MT)

Anybody have a working example? Ive tried and failed…


Thanks


Marcel Grandemange