coova / coova-chilli

CoovaChilli is an open-source software access controller for captive portal hotspots.
Other
518 stars 260 forks source link

coova dhcp option 43 #193

Closed adrienb4 closed 8 years ago

adrienb4 commented 8 years ago

Hi

I would like to say if it's possible to use/implement option 43 in the dhcp of Coova. I want to resolve a dns name from the stations.

See this link (option 43 block)

https://help.ubnt.com/hc/en-us/articles/204909754-UniFi-Layer-3-methods-for-UAP-adoption-and-management

Adrien

gbaligh commented 8 years ago

Hi,

Can you try the coova-chilli configuration argument : --dhcpopt <hex-encoded-binary-dhcp-option>

adrienb4 commented 8 years ago

Sorry but I dont understand what do you mean with .

gbaligh commented 8 years ago

You can compile coova-chilli whith --enable-dhcpopt to activate the DHCP option setting.

To add a DHCP option, you can use the --dhcpopt command argument or the HS_DHCPOPT configuration parameter.

I don't know if this can feet your need ?

adrienb4 commented 8 years ago

The dhcpopt is activate in my coova-chilli. I want to set the controler to my Unifi AP with the option 43.

I have set the option with this value :

dhcpopt                           010452762e0
gbaligh commented 8 years ago

I think that you have to provide all options field :

From RFC2132: Code Len Vendor-specific information +-----+-----+-----+-----+--- | 43 | n | i1 | i2 | ... +-----+-----+-----+-----+---

So in you case it must start with 2B04.

adrienb4 commented 8 years ago

Sorry but even with your help it is not working. My Coova is compiled with --enable-dhcpopt and configured with

dhcpopt                           2B04052762e0

I cant display dhcp options with wireshark, 43 is not in the list.

gbaligh commented 8 years ago

you can not see option 43, because there is no 43 in your hex string. can you try dhcpopt 2B04052762e0 ?

adrienb4 commented 8 years ago

It's not necessary to set the vendor ID ?

gbaligh commented 8 years ago

Sorry, it surpass my knowledge :) You can check the RFC at 8.4. Vendor Specific Information All I know, is that all options must start with option number and length.

gbaligh commented 8 years ago

If I'm not mistaking, this is what I understand : Assuming that the IPv4 address, to encode into the vendor-extension code 1, is 201.10.7.31 dhcpopt must contains 2B070104C90A071FFF

2B: 43 07: length of the payload of the DHCP option 43 01: vendor sub option 1 04: length of the payload of the sub option 1 C90A071F: 201.10.7.31 FF: End of vendor extension

adrienb4 commented 8 years ago

Yes it's exactly that (you're faster than me to answer) :P In all the documentation I found, the '2B07' is deducted.

https://help.ubnt.com/hc/en-us/articles/204909754-UniFi-Layer-3-methods-for-UAP-adoption-and-management#Section_4

Cisco CLI

# assuming your UniFi is at 192.168.3.10
ip dhcp pool <pool name>
network <ip network> <netmask>
default-router <default-router IP address>
dns-server <dns server IP address>
option 43 hex 0104C0A8030A # 192.168.3.10 -> CO A8 03 0A

# Why 0104C0A8030A ?
#
# 01: suboption
# 04: length of the payload (must be 4)
# C0A8030A: 192.168.3.10

It is this block that I understand everything.

Thank for your help @gbaligh now my Unifi AP are directly connected to my controler without change the URL informer :P