You are on page 1of 2

Howto configure a Mikrotik as central DHCP server with switches as DHCP relays April 27, 2013 I ve found many

articles about how to configure a Mikrotik RouterOS as DHCP relay or as simple DHCP server, but I didn t find an article about following setup: central Mikrotik DHCP Server (e.g. in the data center) multiple VLANs/subnets for clients which are connected via a Layer3 Switch ( or even more hops) to the central data center According to the Mikrotik Wiki and the described options it is possible but ther e is no example shown and everyone uses the setup wizard to configure a DHCP Ser ver. I ll get most people don t know what happens in the background I ll show this the old fashioned way. ;-) Setup for this example/howto For this example we assume that we ve 4 VLANs with following subnets: 10.88.0.0/24 (data center VLAN 10.88.10.0/24 (clients network 10.88.11.0/24 (clients network 10.88.12.0/24 (clients network for the servers and the DHCP server) location 1) location 2) location 3)

The Mikrotik has the IP 10.88.0.100 and connected via ether1 to the data center VLAN. The Layer3 switches use always the .1 IP address in the clients networks. Layer3 Switches / DHCP Relay Most (if not all) switches which are able to perform at least simple layer 3 tas ks (often also labeled as Layer2+ switches) are able to forward DHCP requests. C heck the manual of the switch for this. One setting I came across sometimes lead s to problems. It is called DHCP Relay delay and is sometimes set to 1 or 2 second s in the the default configuration. This setting allows a local DHCP Server to a nswer faster, but sometimes (specially embedded clients) don t wait that long and run into an error. If there is no local DHCP server set this timer to 0 seconds. You ll need to set the DHCP Server IP on the switch to the IP of the Mikrotik. Mikrotik as DHCP Server First we configure our pools of the client networks, the mikrotik will give out IPs from this ranges: /ip add add add pool name=poolClientsLocation1 ranges=10.88.10.10-10.88.10.250 name=poolClientsLocation1 ranges=10.88.11.10-10.88.11.250 name=poolClientsLocation1 ranges=10.88.12.10-10.88.12.250

Now we need to set the configuration the DHCP Server will handout the clients: /ip add add add dhcp-server network address=10.88.10.0/24 dns-server=10.88.0.100 gateway=10.88.10.1 address=10.88.11.0/24 dns-server=10.88.0.100 gateway=10.88.11.1 address=10.88.11.0/24 dns-server=10.88.0.100 gateway=10.88.12.1

And at last we configure which DHCP Relay gets which configuration/pool: /ip dhcp-server

add address-pool=poolClientsLocation1 authoritative=yes disabled=no interface=et her1 lease-time=1w name=dhcpClientsLocation1 relay=10.88.10.1 add address-pool=poolClientsLocation2 authoritative=yes disabled=no interface=et her1 lease-time=1w name=dhcpClientsLocation2 relay=10.88.11.1 add address-pool=poolClientsLocation3 authoritative=yes disabled=no interface=et her1 lease-time=1w name=dhcpClientsLocation3 relay=10.88.12.1 This is all

You might also like