Community discussions

MikroTik App
 
mherbst01
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 64
Joined: Mon Dec 01, 2008 8:09 pm

Multple DHCP for VLANs

Tue Sep 19, 2017 7:37 pm

Good day everyone,

I'm racking my brain trying to figure this out and hoping I can get some help or clarity here, I've tried searching here and haven't found the solution. So here's the setup we some access points connected to a UBNT edgeswitch with a couple of VLANs (1,100), Edgeswitch connected to a router. For test bench purposes I'm using an RB 750UP. So what we need is for VLANs 1,100 to hand out different IP addresses. However, what we've come across in testing is the being able to create the VLANs, create DHCP servers for both VLANs but its not handing out IPs, UNLESS we put one of those DHCP servers on the interface connected to the switch, of course we can only have 1 DHCP server on that interface. I'll try to illustrate it more how I've set up the router to hopefully help, but essentially I need tagged traffic (VLAN100) to get a different IP address than untagged traffic (VLAN1). Again thank you for any light that might be shed on this

[admin@MikroTik] > ip address print
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK INTERFACE
0 172.16.0.1/23 172.16.0.0 ether1
1 172.16.1.1/24 172.16.1.0 vlan1
2 172.16.100.1/24 172.16.100.0 vlan100

[admin@MikroTik] > inter print detail
Flags: D - dynamic, X - disabled, R - running, S - slave
0 name="ether1" default-name="ether1" type="ether" mtu=1500 actual-mtu=1500
l2mtu=1600 max-l2mtu=4076 mac-address=4C:5E:0C:71:57:D1 fast-path=yes
link-downs=0
1 R ;;; poe-out status: short_circuit
name="ether2" default-name="ether2" type="ether" mtu=1500
actual-mtu=1500 l2mtu=1598 max-l2mtu=2028 mac-address=4C:5E:0C:71:57:D2
fast-path=yes last-link-up-time=jan/02/1970 00:29:00 link-downs=0
2 name="ether3" default-name="ether3" type="ether" mtu=1500 actual-mtu=1500
l2mtu=1598 max-l2mtu=2028 mac-address=4C:5E:0C:71:57:D3 fast-path=yes
last-link-down-time=jan/02/1970 00:28:58
last-link-up-time=jan/02/1970 00:27:26 link-downs=2
3 name="ether4" default-name="ether4" type="ether" mtu=1500 actual-mtu=1500
l2mtu=1598 max-l2mtu=2028 mac-address=4C:5E:0C:71:57:D4 fast-path=yes
link-downs=0
4 name="ether5" default-name="ether5" type="ether" mtu=1500 actual-mtu=1500
l2mtu=1598 max-l2mtu=2028 mac-address=4C:5E:0C:71:57:D5 fast-path=yes
link-downs=0
5 R name="vlan1" type="vlan" mtu=1500 actual-mtu=1500 l2mtu=1594
mac-address=4C:5E:0C:71:57:D2 fast-path=yes
last-link-up-time=jan/02/1970 00:29:00 link-downs=0
6 R name="vlan100" type="vlan" mtu=1500 actual-mtu=1500 l2mtu=1594
mac-address=4C:5E:0C:71:57:D2 fast-path=yes
last-link-up-time=jan/02/1970 00:29:00 link-downs=0

[admin@MikroTik] /ip pool> print
# NAME RANGES
0 dhcp_pool1 172.16.1.11-172.16.1.254
1 dhcp_pool2 172.16.100.11-172.16.100.254

[admin@MikroTik] /ip dhcp-server> print detail
Flags: X - disabled, I - invalid
0 name="dhcp1" interface=vlan1 lease-time=10m address-pool=dhcp_pool1 bootp-support=static authoritative=yes
lease-script=""
1 name="dhcp2" interface=vlan100 lease-time=10m address-pool=dhcp_pool2 bootp-support=static
authoritative=yes lease-script=""
[admin@MikroTik] /ip dhcp-server network> print
# ADDRESS GATEWAY DNS-SERVER WINS-SERVER DOMAIN
0 172.16.1.0/24 172.16.1.1 8.8.8.8
1 172.16.100.0/24 172.16.100.1 8.8.8.8
 
User avatar
evince
Member
Member
Posts: 355
Joined: Thu Jul 05, 2012 12:11 pm
Location: Harzé - Belgique
Contact:

Re: Multple DHCP for VLANs

Wed Sep 20, 2017 5:32 pm

Hello,

You have a mistake in your addresses :

[admin@MikroTik] > ip address print
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK INTERFACE
0 172.16.0.1/23 172.16.0.0 ether1
1 172.16.1.1/24 172.16.1.0 vlan1

2 172.16.100.1/24 172.16.100.0 vlan100

vlan1 subnet is a part of your ether1 subnet (/23)
 
User avatar
blajah
Member Candidate
Member Candidate
Posts: 222
Joined: Fri Jun 12, 2015 8:58 pm
Location: Belgrade, Serbia
Contact:

Re: Multple DHCP for VLANs

Fri Sep 22, 2017 8:45 pm

Hi,
Besides what evince said, you have not told us how you are sending traffic between router and switch. Is VLAN 1 untagged ( native) or tagged on trunk port on both sides? What's configured on EdgeSwitch part? Are VLANs created under correct interface on MT side? Pretty much if you want VLAN 1 to send as untagged its enough to set IP and DHCP to eth port you have connected switch to. Create VLAN under same interface, add IP and dhcp and that should work instantly. You do not need VLAN1 as interface on MT. Its hard to guess what are you trying to achieve.