Mikrotik DHCP option 43 How to

 

 

Mikrotik DHCP option 43 How to

After doing a lot of searching, I could not find an easy guide on how to add the option 43 to DHCP on a Mikrotik and get my APs to connect to a remote Controller so I figured I would write one.

My Setup:
Mikrotik 750 (v5.4 os) (Default config)
Unifi 2.2 controller on ubuntu VMWARE guest (Public IP: 192.168.200.10)

1. Convert your public IP to hex. The option 43 value has to be in HEX to work.
192=C0
168=A8
200=C8
10=0A
2. Your option 43 value will be “0x0104” + the HEX of the IP.
So in my example it is: “0x0104C0A8C80A”
3. Open up a new terminal on your Mikrotik or ssh in and type:
/ip dhcp-server option add code=43 name=unifi value=0x0104C0A8C80A
/ip dhcp-server network set 0 dhcp-option=unifi
My router was using the default config so only one network was present ID 0. You could do “/ip dhcp-server network print” to see the list and pick the ID of the network you want to add the option to.
4. Plug in your UAP and it should grab the info and show up on the remote Unifi controller asking to be adopted.

Troubleshooting:
Older UAPs have older firmware. The older firmware does not ask DHCP for option 43. Pulled my hair out for a few hours on this one. The way I found this was by turning on DHCP logging and watched the DHCP Discover. It was not asking for “VendorSpecific” which is option 43. If you have these you have a few options.
1. Upgrade the firmware in the lab by connecting them to a local Controller, adopting them and then “paper-clip” them.
2. Use the discovery tool on them to make them connect.
3. Use DNS. I prefer not to use this method but it does work even on older firmware. In your DHCP server config put in a domain name that you control. Then add a unifi A record pointing to the remote unif controller. Some will say this is easier than Option 43. However if you are doing many different controllers you would have to setup lots of sub-domains and such. And that domain will be default domain name on any hosts connecting on that network.

分類: RouterOS。這篇內容的永久連結

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *