Community discussions

MikroTik App
 
mangust
Member Candidate
Member Candidate
Topic Author
Posts: 224
Joined: Thu Jun 14, 2007 11:14 am

DHCP-OPTIONS example.

Mon Oct 15, 2007 12:11 pm

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 ;(.
 
mangust
Member Candidate
Member Candidate
Topic Author
Posts: 224
Joined: Thu Jun 14, 2007 11:14 am

Re: DHCP-OPTIONS example.

Wed Oct 17, 2007 10:50 am

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”
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7188
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: DHCP-OPTIONS example.

Wed Oct 17, 2007 2:37 pm

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
 
User avatar
tgrand
Long time Member
Long time Member
Posts: 667
Joined: Mon Aug 21, 2006 2:57 am
Location: Winnipeg, Manitoba, Canada

Re: DHCP-OPTIONS example.

Wed Oct 17, 2007 6:07 pm

Be sure and add the option to the DHCP Server.
Defining the option alone is not enough...
 
pedja
Long time Member
Long time Member
Posts: 684
Joined: Sat Feb 26, 2005 5:37 am

Re: DHCP-OPTIONS example.

Thu Oct 18, 2007 5:02 pm

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 :(
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7188
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: DHCP-OPTIONS example.

Thu Oct 18, 2007 5:43 pm

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 <id> 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.
 
User avatar
BrianHiggins
Forum Veteran
Forum Veteran
Posts: 720
Joined: Mon Jan 16, 2006 6:07 am
Location: Norwalk, CT
Contact:

Re: DHCP-OPTIONS example.

Thu Oct 18, 2007 10:27 pm

/ 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.
 
mangust
Member Candidate
Member Candidate
Topic Author
Posts: 224
Joined: Thu Jun 14, 2007 11:14 am

Re: DHCP-OPTIONS example.

Fri Oct 19, 2007 12:03 pm

[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";
 
mangust
Member Candidate
Member Candidate
Topic Author
Posts: 224
Joined: Thu Jun 14, 2007 11:14 am

Re: DHCP-OPTIONS example.

Fri Oct 19, 2007 12:06 pm

/ ip dhcp-server option 
add name[color=#FF0000]="TFTP"[/color] 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" \
    [color=#FF0000]dhcp-option=TFTP comment="" [/color]
Is it cirrect ???
 
User avatar
BrianHiggins
Forum Veteran
Forum Veteran
Posts: 720
Joined: Mon Jan 16, 2006 6:07 am
Location: Norwalk, CT
Contact:

Re: DHCP-OPTIONS example.

Sat Oct 20, 2007 12:08 am

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
 
snark
newbie
Posts: 25
Joined: Fri Oct 19, 2007 3:47 pm

Re: DHCP-OPTIONS example.

Sat Oct 20, 2007 3:57 pm

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 :(
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?
 
User avatar
tgrand
Long time Member
Long time Member
Posts: 667
Joined: Mon Aug 21, 2006 2:57 am
Location: Winnipeg, Manitoba, Canada

Re: DHCP-OPTIONS example.

Sun Oct 21, 2007 5:05 am

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.
 
mangust
Member Candidate
Member Candidate
Topic Author
Posts: 224
Joined: Thu Jun 14, 2007 11:14 am

Re: DHCP-OPTIONS example.

Mon Oct 22, 2007 2:19 pm

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'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 ))
 
User avatar
tgrand
Long time Member
Long time Member
Posts: 667
Joined: Mon Aug 21, 2006 2:57 am
Location: Winnipeg, Manitoba, Canada

Re: DHCP-OPTIONS example.

Mon Oct 22, 2007 2:58 pm

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<enter> for dump
type q<enter> 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.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7188
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: DHCP-OPTIONS example.

Mon Oct 22, 2007 3:09 pm

 
User avatar
tgrand
Long time Member
Long time Member
Posts: 667
Joined: Mon Aug 21, 2006 2:57 am
Location: Winnipeg, Manitoba, Canada

Re: DHCP-OPTIONS example.

Mon Oct 22, 2007 3:32 pm

Fare enough..

I've used debug for various things for over 20 years.
It has always remained the same.
 
User avatar
BrianHiggins
Forum Veteran
Forum Veteran
Posts: 720
Joined: Mon Jan 16, 2006 6:07 am
Location: Norwalk, CT
Contact:

Re: DHCP-OPTIONS example.

Mon Oct 22, 2007 11:24 pm

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...
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...
 
User avatar
tgrand
Long time Member
Long time Member
Posts: 667
Joined: Mon Aug 21, 2006 2:57 am
Location: Winnipeg, Manitoba, Canada

Re: DHCP-OPTIONS example.

Tue Oct 23, 2007 6:42 am

That is because option 66 is clearly defined.
Option 242, on the other hand, is not clearly defined (reserved status).
 
mangust
Member Candidate
Member Candidate
Topic Author
Posts: 224
Joined: Thu Jun 14, 2007 11:14 am

Re: DHCP-OPTIONS example.

Fri Jan 11, 2008 9:20 am

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;
...
 
User avatar
thavinci
Member
Member
Posts: 335
Joined: Sat Aug 04, 2007 4:40 pm
Location: Johannessburg
Contact:

Re: DHCP-OPTIONS example.

Tue Feb 12, 2008 5:30 pm

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
 
pedja
Long time Member
Long time Member
Posts: 684
Joined: Sat Feb 26, 2005 5:37 am

Re: DHCP-OPTIONS example.

Tue Feb 12, 2008 6:19 pm

It seems you will not get it.

I've tried this:

I want to add static route for 10.80.0.0/24 with 10.80.0.1 as gateway.

According to the http://www.iana.org/assignments/bootp-dhcp-parameters option code for Classless Static Route Option is 121. That option is explained in http://www.ietf.org/rfc/rfc3442.txt.

So i have network 10.80.0.0 with subnet mask with 24. Destination descriptor is then 24.10.80.0.
Router is 10.80.0.1. Destination descriptor is four bytes and rouer is four bytes. So total option value length is 8. This means that I have to define option with values (LEN | DESCRIPTOR | ROUTER):

08 | 24 10 80 0 | 10 80 0 1

Convered to hex that is: 0x08180a50000a500001

So I have to submit commands:

/ip dhcp-server option add name="staticroute" code=121 value="0x08180a50000a500001"

/ip dhcp-server add address=10.10.10.0/24 gateway=10.10.10.1 netmask=24 \
dns-server=10.10.10.1 dhcp-option=staticroute comment=""


Well, it doesn't work... :(
 
User avatar
thavinci
Member
Member
Posts: 335
Joined: Sat Aug 04, 2007 4:40 pm
Location: Johannessburg
Contact:

Re: DHCP-OPTIONS example.

Tue Feb 12, 2008 8:22 pm

Well im so desperate on this i even mailed the mikrotik support email.

But im sure other people have tried this aswell.
 
changeip
Forum Guru
Forum Guru
Posts: 3833
Joined: Fri May 28, 2004 5:22 pm

Re: DHCP-OPTIONS example.

Tue Feb 12, 2008 8:27 pm

Im guessing RouterOS dhcp-client hasn't implemented these options... or are you trying with Windows clients ?

Sam
 
User avatar
thavinci
Member
Member
Posts: 335
Joined: Sat Aug 04, 2007 4:40 pm
Location: Johannessburg
Contact:

Re: DHCP-OPTIONS example.

Tue Feb 12, 2008 9:03 pm

No the clients all use routerboards with v3.2 on.


Hope thats not the case, would rather be proved stupid than told i can't do it... ;p
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7188
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: DHCP-OPTIONS example.

Tue Feb 12, 2008 10:17 pm

ROuterOS DHCP client doesn't recognize those options. Use linux box to test if you set everything correctly.
 
User avatar
thavinci
Member
Member
Posts: 335
Joined: Sat Aug 04, 2007 4:40 pm
Location: Johannessburg
Contact:

Re: DHCP-OPTIONS example.

Fri Feb 15, 2008 4:59 pm

Doesn't i test it on linux im afraid, as all clients will be using MT.
Did get the official answer...
Hello Marcel,

Yes, you are correct static route could be assigned with DHCP-option.
Currently DHCP-Option 121 is not supported by RouterOS DHCP server, but we have plans to add support for this DHCP-Option.

Regards,
Sergejs
 
redkurawa
just joined
Posts: 14
Joined: Sat Apr 15, 2006 4:13 am
Contact:

Re: DHCP-OPTIONS example.

Wed Feb 20, 2008 12:03 pm

still waiting the progress 8)
 
User avatar
thavinci
Member
Member
Posts: 335
Joined: Sat Aug 04, 2007 4:40 pm
Location: Johannessburg
Contact:

Re: DHCP-OPTIONS example.

Wed Feb 20, 2008 12:14 pm

you telling me? :p

I simply can't wait for another release, and then work through the bugs it will introduce....

Made another plan ;>

Good luck on the wait!
 
User avatar
thavinci
Member
Member
Posts: 335
Joined: Sat Aug 04, 2007 4:40 pm
Location: Johannessburg
Contact:

Re: DHCP-OPTIONS example.

Sun Mar 09, 2008 10:03 pm

Well the conclusion here is i found another way of doing what i needed without using the options as i intended before.

Pity, but progress cannot be halted. :lol:
 
User avatar
LZiX
Frequent Visitor
Frequent Visitor
Posts: 52
Joined: Wed Aug 13, 2008 8:33 pm
Location: Kazakhstan

Re: DHCP-OPTIONS example.

Tue Jun 09, 2009 1:52 pm

Have any progress ? I need using 121 option
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7188
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: DHCP-OPTIONS example.

Tue Jun 09, 2009 2:04 pm

for example
192.168.1.0/24 gw=192.168.9.212
is
0x18C0A801C0A809D4

More details in RFC
http://www.faqs.org/rfcs/rfc3442.html
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: DHCP-OPTIONS example.

Thu Aug 13, 2009 1:27 am

the reason you're not getting options to work is because the client requesting dhcp has to request the options it wants to receive specifically.

however, most dhcp servers will push dhcp options you configure to clients automatically.

as of this post (routeros 3.28) the dhcp-option specified in /ip dhcp-server network are only "access-control" values meaning the options you set in there are "allowed" to be given to a client, but not automatically pushed to the client.

I've sent a support ticket to add the "push" functionality to the dhcp server, as this is what most dhcp servers do.
 
sunshine
just joined
Posts: 4
Joined: Mon Jun 01, 2009 10:26 am

Re: DHCP-OPTIONS example.

Tue Oct 06, 2009 12:50 pm

anyone got a answer from MT regarding the netbios disabling (option 46)

i wan to disable netbios so that my clients are not allowed to talk to each other
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: DHCP-OPTIONS example.

Tue Oct 06, 2009 1:16 pm

anyone got a answer from MT regarding the netbios disabling (option 46)

i wan to disable netbios so that my clients are not allowed to talk to each other
Is the client receiving dhcp specifically requesting option 46?
You can confirm this by doing a simple packet sniff of the dhcp traffic.

Most dhcp servers can be given a list of dhcp options that will be sent as part of the dhcp lease being obtained.

Mikrotik has said they will not support this, so the client must specify the exact options it needs. If it doesn't you're out of luck, as it's not going to work at all.

The /ip dhcp-server network dhcp-options setting is merely an access-control setting, specifying whether or not a client is "allowed" to receive that dhcp option. The client still has to request dhcp options it's dhcp lease negotiation.
 
sunshine
just joined
Posts: 4
Joined: Mon Jun 01, 2009 10:26 am

Re: DHCP-OPTIONS example.

Wed Oct 07, 2009 6:50 am

So if there is noway ?

i am trying to do this because i got lot of clients connected on my AP and they are sharing files using netbios. Because of this my AP bandwidth also get slower.

any idea how i can achieve this
 
changeip
Forum Guru
Forum Guru
Posts: 3833
Joined: Fri May 28, 2004 5:22 pm

Re: DHCP-OPTIONS example.

Wed Oct 07, 2009 7:12 am

jsut block tcp/135-139, udp/135-139, and tcp/445. That should be standard practice nowdays anyhow.

Sam
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: DHCP-OPTIONS example.

Wed Oct 07, 2009 7:48 am

So if there is noway ?

i am trying to do this because i got lot of clients connected on my AP and they are sharing files using netbios. Because of this my AP bandwidth also get slower.

any idea how i can achieve this
setting dhcp options to give a client doesn't guarantee the client won't manually set them on their computer. a firewall as changeip mentioned would be a much better way to go since you have 100% control of it.
 
bigchirv
just joined
Posts: 2
Joined: Sat Jan 31, 2009 4:08 pm

Re: DHCP-OPTIONS example.

Wed Mar 03, 2010 12:48 am

These are my results after experimenting with this. The network I tried to configure is described below:

network: 10.100.0.0/23
default-route: 10.100.0.1, hotspot, internet and stuff.
destination-route: 10.100.1.254
destination-network: 172.16.184.0/28, servers network.

The format of the hex chain varies a little from the spec in the RFC 3442. It doesn't need, for example, the hex chain length:
|Mask|d1|...|dn|r1|r2|r3|r4|(?)|dr1|dr2|dr3|dr4|
Mask: the mask of the destination network, according to RFC 3442
d(1...n): Destination network significant octets, according to RFC 3442. In my case they where four.
(?): I suppose this is the route cost. Anyone please confirm.
dr(1...4): Octets of the default dhcp client route. This overrides the configuration made before when creating the dhcp-server.

So, for my network the thing worked this way:
Option: 121,249
chain components, dec: 28,172,16,184,0,10,100,1,254,0,10,100,0,1
hex chain: 0x1CAC10B8000A6401FE000A640001
And finally, this is my /ip dhcp-server export:
# mar/02/2010 18:11:45 by RouterOS 4.5
# software id = H3LP-H3R3
#
/ip dhcp-server
add address-pool=pool1 authoritative=yes bootp-support=static \
    disabled=no interface=ether3 lease-time=1d name=dhcp1

/ip dhcp-server option
add code=121 name=static-route value=0x1CAC10B8000A6401FE000A640001
add code=249 name=static-alternative value=0x1CAC10B8000A6401FE000A640001

/ip dhcp-server config
set store-leases-disk=5m

/ip dhcp-server network
add address=10.100.0.0/23 comment="" dhcp-option=\
    static-alternative,static-route dns-server=172.16.184.132 domain=\
    int.example.com gateway=10.100.0.1 wins-server=172.16.184.165
I hope this helps. I spent almost an entire day figuring out how to make this thing work.
 
nikolas22t
just joined
Posts: 18
Joined: Thu Jan 12, 2012 1:03 pm

Re: DHCP-OPTIONS example.

Sat Jul 21, 2018 10:55 pm

I am trying to give default gateway via dhcp-option but doesn't seem to work , can someone give me an example how i can give the default gateway

192.168.51.1 ?

(for some clients connecting to my wifi i will give an ip from another range using a different gateway)


UPDATE: Found it. need ' instead of "
 
sayanrc1986
just joined
Posts: 1
Joined: Fri Dec 14, 2018 9:51 am

Re: DHCP-OPTIONS example.

Fri Dec 14, 2018 2:43 pm

Hi,
I am using the Mikrotik Router Board as a DHCP server. Is any way of disabling check for Option 55 (Parameter request List) on the router ? So our expectation is that if client is only sending Option-60 (vendor identifier) and not option 55 still the dhcp server should send back the configured options viz. Option 42, Option 43 or option 6 etc.

Thanks,
Sayan
 
jerryroy1
Member Candidate
Member Candidate
Posts: 170
Joined: Sat Mar 17, 2007 4:55 am
Location: LA and OC USA
Contact:

Re: DHCP-OPTIONS example. Option 242

Sat Mar 20, 2021 6:06 am

tried the following. It failed. Anyone with a working example?

/ip dhcp-server option> add name="option-242" code=242 value="MCIPADD=192.168.2.15,MCPORT=1719,HTTPSRVR=192.168.2.15,L2QVLAN=11"
failure: Unknown data type!
/ip dhcp-server option>
 
jerryroy1
Member Candidate
Member Candidate
Posts: 170
Joined: Sat Mar 17, 2007 4:55 am
Location: LA and OC USA
Contact:

Re: DHCP-OPTIONS example.

Sat Mar 20, 2021 6:09 am

Converted the string to hex and then appended 0x to the front. Does this make sense?

http://string-functions.com/string-hex.aspx

/ip dhcp-server option> add name="option-242" code=242 value=0x4d4349504144443d3139322e3136382e322e31352c4d43504f52543d313731392c48545450535256523d3139322e3136382e322
e31352c4c3251564c414e3d3131
 
User avatar
che
Member Candidate
Member Candidate
Posts: 111
Joined: Fri Oct 07, 2005 1:04 pm

Re: DHCP-OPTIONS example.

Sat Mar 20, 2021 10:30 am

I haven't checked your values and conversion, but if it doesn't work you could try specifying data type to be string by adding quotes:
/ip dhcp-server option
add code=242 name=option-242 value="'MCIPADD=192.168.2.15,MCPORT=1719,HTTPSRVR=192.168.2.15,L2QVLAN=11'"
That should have the same effect as explicitly declaring string type with s'VALUE' shown below:
/ip dhcp-server option
add code=242 name=option-242 value="s'MCIPADD=192.168.2.15,MCPORT=1719,HTTPSRVR=192.168.2.15,L2QVLAN=11'"
 
User avatar
bee
just joined
Posts: 4
Joined: Fri Jul 16, 2021 3:03 pm

Re: DHCP-OPTIONS example.

Mon Sep 05, 2022 7:27 pm

Hello,

I want my hexs to be dhcp server, and it is also my internet gateway. the hexs is represented as 192.168.2.3 as IP for the network 192.168.2.0/24. My default route should be that ip, 192.168.2.3.

It works with the default dhcp server configuration.

But now I want to add a static route to all dhcp clients for my vpn to my openvpn server 192.168.2.102.

I can successfully add static routes with the option 121, e.g. 10.8.0.0 via 192.168.2.102.. I add the options to the dchp network.
But with the static route, the default route is no longer present at the dhcp clients. I tried with a code=3 option, but this does not do anything on client-side.

/ip dhcp-server option
add code=121 name="VPN Static route" value=0x180A0800C0A80266
add code=3 name=default-route value=0xC0A80203

does anyone know how to enforce the default route on the clients when pushing also a static route?

thanks a lot,
 
User avatar
sindy
Forum Guru
Forum Guru
Posts: 11172
Joined: Mon Dec 04, 2017 9:19 pm

Re: DHCP-OPTIONS example.

Mon Sep 05, 2022 8:35 pm

does anyone know how to enforce the default route on the clients when pushing also a static route?
Add the default route to the Option 121, this is how it is standardized (the client must ignore Option 3 if Option 121 is present). This is the reason why Microsoft has defined Option 249, the only difference between Option 121 and Option 249 is this behavior.

0x0000C0A80203180A0800C0A80266
 
User avatar
bee
just joined
Posts: 4
Joined: Fri Jul 16, 2021 3:03 pm

Re: DHCP-OPTIONS example.

Mon Sep 05, 2022 10:45 pm


Add the default route to the Option 121, this is how it is standardized (the client must ignore Option 3 if Option 121 is present). This is the reason why Microsoft has defined Option 249, the only difference between Option 121 and Option 249 is this behavior.

0x0000C0A80203180A0800C0A80266
thanks a lot, this put some light to it.
In fact, it is 0x00C0A80203180A0800C0A80266 which worked finally for me:
00 - default route via C0A80203 = 192.168.2.3
180A0800 - 10.8.0.0/24 via C0A80266 = 192.168.2.102
It works now!
 
User avatar
sindy
Forum Guru
Forum Guru
Posts: 11172
Joined: Mon Dec 04, 2017 9:19 pm

Re: DHCP-OPTIONS example.

Mon Sep 05, 2022 11:20 pm

In fact, it is 0x00C0A80203180A0800C0A80266
Sorry, indeed the prefix length of 0 means that 0 bytes of prefix follow.

Who is online

Users browsing this forum: holvoetn, johnson73, kristovskis, lubeda, mgrlobo, mihai9125 and 44 guests