Mikrotik DHCP Option 43 Tutorial



Step by step instructions to get DHCP Option 43 working on Mikrotik RouterOS 6.x

Many consumer devices allow you to pass configuration parameters like auto provisioning servers and such via dhcp. DHCP option 43 is used by Yealink, Ubiquiti and Ruckus as well as many others.

My need was to use it to send the address of the provisioning server to a number of Yealink T23G IP phones to make deployment easier.


I will assume that you already have the Mikrotik Router up and running, and that you have connected to it using Winbox. You also need to make sure that you have the DHCP package installed. In my examples I will show each step using the GUI as well as using terminal commands to achieve the same result.

Step 1: Add an IP Address in the IP range that you will be serving DHCP


1. In Winbox, click on IP then Addresses:

2. Click on "+" and add the appropriate IP details:
Code:
ip address add address=192.168.50.1 interface=ether5

Step 2:Set up the DHCP server

1. Click on IP then DHCP Server:

2. Click on DHCP Setup, and select the interface that you want the server running on:

3. Click next, and enter the subnet that the DHCP server will serve, this will be the same subnet of the IP you set up in step 1:

4. Click next and enter the gateway for the network, most often (but not always) this will be the IP selected in step 1:

5. Click next and enter the range of IP addresses that will be issued by this DHCP server. I normally reserve the first twenty IPs for static devices:

6. Click next and enter the IP for your DNS server(s):
7. Click next and enter the lease time, I normally just leave it as is.

8. Click next and Ok to complete DHCP setup:
Code:
/ip dhcp-server add address-pool=dhcp_pool1 disabled=no interface=ether5 name=dhcp1
/ip dhcp-server network add address=192.168.50.0/24 dns-server=8.8.8.8 gateway=192.168.50.1

Step 3: Adding DHCP Options

1. On the DHCP Server go to the "Options" tab and click on the "+" button:

3. Fill in the appropriate parameters for your system, in my case I wanted to supply Yealink IP Phones with the address for the provisioning server:

Name: yealink-prov-srv
The name field can be anything to help you identify the value easily
Code: 43
The Yealink phones use DHCP option 43 to request the address of the provisioning server
Value: 'IP and path of provisioning server'
Note the single quotes around the value, this tells Mikrotik that it is a string value, and is very important!

The Mikrotik Wiki supplies the following information regarding DHCP value types vir ROS 6.8+:

  • 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
4. Go to the "Networks" tab of the DHCP Server window, and double click the entry we created earlier.

5. Under "DHCP Options" select the Option we created earlier and click OK to apply:


Code:
/ip dhcp-server option add code=43 name=yealink-prov-srv value="'192.168.1.10/yealink/'"
ip dhcp-server network set dhcp-option=yealink-prov-srv numbers=0

That's it, if you reboot your phones, they should now get the provisioning server via DHCP. This works equally well for Ruckus and Ubiquiti devices that make use of DHCP to supply the device with basic config data.

Comments

Popular posts from this blog

DMASOFTLAB RADIUS MANAGER BILLING SYSTEM v 4.1 Finally Released

How To Configure Nano Station M2 As Access point