Page 1 of 1

Help needed on DHCP-client v.6

Posted: Mon Jun 03, 2013 1:44 pm
by WirelessRudy
I don't understand how this new dhcp-client is working.
In v5 and before I used to set a cpe number in the dhcp-cl hostname field:
/ip dhcp-client
add add-default-route=yes default-route-distance=1 disabled=no host-name=A-003 interface=wlan1 use-peer-dns=yes use-peer-ntp=yes
So in the lease table of the dhcp-server this unit comes up with 'Active Host Name' "A-003". Just the way I want it.

But now in ros v.6;
 /ip dhcp-client
add dhcp-options="clientid,(unknown),hostname" disabled=no interface=wlan1
Where now to fill in the host-name?
If I try to make a new DCHCP Client Option in the "DHCP Client Options" section, I'll get an error "Couldn't add New DHCP Client Option - Unknown data type! (6)"

If I look in the lease table of the AP I see now the client has the full system ID in its 'Active Host Name' field. I don't want that, I just want the antenna number. Not the full ID..... :(

So obviously it has to be done another way. But I can't find any documentation about it and after trying some options I gave up. Why can't MT not come up with a manual if they bring out a new software version!
I mean, its not rc anymore, It's real.....

Re: Help needed on DHCP-client v.6

Posted: Tue Jun 11, 2013 3:41 pm
by janisk
similar to dhcp-server, starting RouterOS 6.0 it is possible to add client-side options that are sent to DHCP server. Mechanism used to do that is similar to dhcp-server.

Configuration item is available under '/ip dhcp-client option' where you can set up options used for client.

for example:

ros code

/ip dhcp-client option
set clientid code=61 name=clientid value="0x01\$(CLIENT_MAC)"
set hostname code=12 name=hostname value="\$(HOSTNAME)"
in this case values will be generated on the fly when request is created and CLIENT_MAC will be set to MAC address of interface and hostname will be taken from RouterOS identity. Other options can be added in a similar manner.

In your case you have to add option 12 with different value and name, and use your custom option 12.

Re: Help needed on DHCP-client v.6

Posted: Tue Jun 11, 2013 7:23 pm
by WirelessRudy
well that took some time...

Anyway, I have to use opcion 12, I guessed that. But then, how do I get my info in that field?

I want the client to surface in the dhcp-server 'active hostname' with a certain number, like ; "A3-005"

The hostname is actuall different, "A3-005 Mr. Mistername"
But I only want the CPE number to pop up in the dhcp-server. I'm in Spain here and people have long, looong names here.. I don't want that in my dhcp-server hostname overview....

I tried
set hostname code=12 name=hostname value="A3-005"
but that is rejected.

I tried serveral things in winbox but everytime I get an error message. Since there is no manual on how to do this :( I'm getting nowhere......

So please give me a example what to do to make the client pop up in the dchp-server active hostname with "A3-005"

It should be simple......

Re: Help needed on DHCP-client v.6

Posted: Wed Jun 12, 2013 9:34 am
by janisk
again, same as dhcp-server option- value="'random text'" or just use HEX - value="0x72616e646f6d2074657874"

note that hex strings do not require quotation marks around them text requires them and variables have a special syntax.

this applies to dhcp-client options:
http://wiki.mikrotik.com/wiki/Manual:IP ... CP_Options

Re: Help needed on DHCP-client v.6

Posted: Wed Jun 12, 2013 11:29 am
by WirelessRudy
again, same as dhcp-server option- value="'random text'" or just use HEX - value="0x72616e646f6d2074657874"

note that hex strings do not require quotation marks around them text requires them and variables have a special syntax.

this applies to dhcp-client options:
http://wiki.mikrotik.com/wiki/Manual:IP ... CP_Options
OK, your remark re quotation marks helped. I see now that 'xx' is with quotation marks, and "xx"is merely to quote or give the example.
Hence your "'xx'" was a bit confusiong to me, after I even red over it a hundred time....

Anyway, I've got it now...

Re: Help needed on DHCP-client v.6

Posted: Sat Jun 15, 2013 12:09 am
by dsobin
Even after reading the previous set of posts 10 times, I still couldn't get it to work. For those who come after me:

You need both apostrophe (looks like this: ' ) AND a quote (looks like this: " ) . If you spread it out (but don't do that) you see this:
 ...    value="  'myhostname'  "
Don't spread it out, though. You need the quote and the apostrophe next to each other to open and close the text.

I hope this helps the next person who looks at these posts.