Page 1 of 1

DHCP option add bug? (SOLVED)

Posted: Wed Apr 17, 2013 1:18 pm
by fatboy
Hi, I try to add DHCP-Server option 252
RoS version 6.0rc13 on CCR1016-12G

/ip dhcp-server option add name=wpad code=252 value=http://192.168.0.235/wpad.dat

and get error “failure: Unknown data type!”

In RoS version 5.24 this option works fine.

Re: DHCP option add bug?

Posted: Thu Apr 18, 2013 2:14 am
by patrikg
Look at this to se how to do it..

http://forum.mikrotik.com/viewtopic.php ... 97#p364932

You have to add " and ' to the beginning and to the end of the string.

Like this
/ip dhcp-server option add name=wpad code=252 value="'http://192.168.0.235/wpad.dat'"

Re: DHCP option add bug?

Posted: Thu Apr 18, 2013 9:21 am
by fatboy
It works, thanks!
SOLVED.

Re: DHCP option add bug? (SOLVED)

Posted: Thu Apr 18, 2013 9:38 am
by janisk
if you are adding hex value, you can simply use
value="0xaa0a0b0c"

when printing you will see raw value set to aa0a0b0c

if you want to add some text as a value for option use
value="'your text'"

result raw-value=796f75722074657874
if you add text and hex value in one value option use
value="'your text'0xaa0a0b0c"

result raw-value=796f75722074657874aa0b0c0d

Re: DHCP option add bug? (SOLVED)

Posted: Tue Jan 07, 2014 5:40 pm
by BelWave
So, we have a client asking us this morning as well.

I need is option 156 set to:

FtpServers=10.230.11.51,country=1,launguage=1,Layer2Tagging=1,vlanid=111


Simply adding the ' ' on the ends of the string worked!

Thanks!

Brad

Re: DHCP option add bug? (SOLVED)

Posted: Mon Aug 25, 2014 12:30 am
by interpoint
Hi,

Could someone in Mikrotik confirm if this is a bug or not. I have only seen this issue on latest ROS 6.18.

When I upgraded to 6.18 and started testing the DHCP option function. I use Option 43 on lots of sites (over 50) and it always works pretty well.

I have been / in the past entering it like this on ROS 6.1
/ip dhcp-server option add code=43 name=option43 value="'172.17.30.253'"

Correct Result:

/ip dhcp-server option> print
# NAME CODE VALUE RAW-VALUE
0 option43 43 '172.17.30.253' 3137322e31372e33302e323533

However on ROS 6.18 when I use the same command
/ip dhcp-server option add code=43 name=option43 value="'172.17.30.253'"

Incorrect Result:

/ip dhcp-server option> print
# NAME CODE VALUE RAW-VALUE
0 option43 43 '172.17.30.253' ac111efd

Obviously there is a difference in HEX values 3137322e31372e33302e323533 and ac111efd
My option 43 did not work as a result.

Fix: I entered the string value that I wanted as HEX using this website http://chxo.com/scripts/hex2string.php

/ip dhcp-server option add code=43 name=option43 value=0x3137322e31372e33302e323533

It Works

/ip dhcp-server option> print
# NAME CODE VALUE RAW-VALUE
0 option43 43 0x3137322e31372e33302e323533 3137322e31372e33302e323533

Re: DHCP option add bug? (SOLVED)

Posted: Mon Aug 25, 2014 1:08 am
by patrikg
Mikrotik has updated the wiki on this.
It's more clear now how to edit this.


Copy from the :Wiki

Parameter's value.
Starting from v6.8 available data types for options are:

0xXXXX - hex string (works also in v5)
'XXXXX' - string (works also in v5 but without ' ' around the text)
$(XXXXX) - variable (currently there are no variables for server)
'10.10.10.10' - IP address
s'10.10.10.10' - IP address converted to string
'10' - decimal number
s'10' - decimal number converted to string
Now it is also possible to combine data types into one, for example: "0x01'vards'$(HOSTNAME)"

For example if HOSTNAME is 'kvm', then raw value will be 0x0176617264736b766d

Re: DHCP option add bug? (SOLVED)

Posted: Mon Aug 25, 2014 1:43 am
by interpoint
Thanks.. Didn't see the update on the wiki.

I can confirm that this works in ROS 6.18

/ip dhcp-server option add code=43 name=option43 value="s'172.17.30.253'"

/ip dhcp-server option> print
# NAME CODE VALUE RAW-VALUE
0 option43 43 s'172.17.30.253' 3137322e31372e33302e323533

Re: DHCP option add bug? (SOLVED)

Posted: Thu May 04, 2017 2:12 am
by redy
Hello,

i need a little help with moving DHCP configuration (options) from ISC DHCP server to MikroTik. I have two separate vlans and subnets (one for untag and other for tagged traffic). Here is my configuration.

Global dhcpd.conf:
option space genexis;
option genexis.gaps code 1 = text;
option space vivso code width 4 length width 1;
option vivso.genexis code 25167 = encapsulate genexis;
option vivso.iana code 0 = string;
option op125 code 125 = encapsulate vivso;
class "drgos" {match if substring (option vendor-class-identifier, 0, 6) = "drgos-";}

Untagged vlan.conf
option genexis.gaps = "m=0;v=10;s=IP ADDRESS;";
option vivso.iana 01:01:01;

Tagged vlan.conf
option genexis.gaps = "m=0;v=10;s=IP ADDRESS;";
option vivso.iana 01:01:01;

Thanks in advance!