Community discussions

MikroTik App
 
EvanTik
just joined
Topic Author
Posts: 3
Joined: Wed Aug 10, 2022 12:24 am

Single DHCP server for multiple VLANs?

Wed Aug 10, 2022 1:37 am

I was just wondering if there was a good way of setting up a DHCP server so that if we had a trunk port with multiple VLANs on it we could assign IP addresses, using the same IP pool?

This diagram shows what I'm going for.
Untitled Diagram.png
So devices on VLAN10 and VLAN20 would pull IPs from the same DHCP server.

Thanks for any help.
You do not have the required permissions to view the files attached to this post.
 
erlinden
Forum Guru
Forum Guru
Posts: 1900
Joined: Wed Jun 12, 2013 1:59 pm
Location: Netherlands

Re: Single DHCP server for multiple VLANs?

Wed Aug 10, 2022 1:44 am

Per VLAN a DHCP server.
 
felixka
Frequent Visitor
Frequent Visitor
Posts: 58
Joined: Mon Oct 19, 2020 4:12 am
Location: Canada

Re: Single DHCP server for multiple VLANs?

Wed Aug 10, 2022 1:46 am

I don't think it's possible and I also don't know why you'd want to do that.

Sounds like an XY Problem.
 
EvanTik
just joined
Topic Author
Posts: 3
Joined: Wed Aug 10, 2022 12:24 am

Re: Single DHCP server for multiple VLANs?

Wed Aug 10, 2022 2:01 am

Its likely an XY problem.
Basically I'm getting handed a cable that will have multiple VLANs on them, and I need to route them to the Internet.
DHCP server on the VLAN interface works - but I was hoping to not have to setup a DHCP server for each VLAN.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 18961
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Single DHCP server for multiple VLANs?

Wed Aug 10, 2022 2:14 am

Is this an MT question.
Think of the router as your DHCP server and it gives out IPs on a per VLAN basis............
 
EvanTik
just joined
Topic Author
Posts: 3
Joined: Wed Aug 10, 2022 12:24 am

Re: Single DHCP server for multiple VLANs?

Wed Aug 10, 2022 2:31 am

I don't know what an MT question is, can you elaborate?

But I am trying to have the Mikrotik be the DHCP server and hand out IPs on a per VLAN basis - but in Mikrotik, the DHCP server needs an interface to operate on. It works if I assign a DHCP server to the VLAN, but I can't assign the DHCP server to multiple VLANs.
 
User avatar
k6ccc
Forum Guru
Forum Guru
Posts: 1490
Joined: Fri May 13, 2016 12:01 am
Location: Glendora, CA, USA (near Los Angeles)
Contact:

Re: Single DHCP server for multiple VLANs?

Wed Aug 10, 2022 8:00 am

Not really sure why you want to do it, but although you can't assign the same DHCP server to multiple interfaces, you CAN assign multiple DHCP servers to the same DHCP pool. Don't know how well it works, but it let me do it as a test - only left that way for 20 seconds so did not test how well it works.
Test was on a 4011iGS+ running 6.49.6
 
holvoetn
Forum Guru
Forum Guru
Posts: 5327
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: Single DHCP server for multiple VLANs?

Wed Aug 10, 2022 10:57 am

I don't know what an MT question is, can you elaborate?
A question related to Mikrotik.
Which it is :lol:
But I am trying to have the Mikrotik be the DHCP server and hand out IPs on a per VLAN basis - but in Mikrotik, the DHCP server needs an interface to operate on. It works if I assign a DHCP server to the VLAN, but I can't assign the DHCP server to multiple VLANs.
If you define your VLANs properly, they are all separate interfaces.
On the same device, within the DHCP Server part, it is perfectly possible to define multiple DHP servers with their own pool and each assigned to the required VLAN interface.
[xyz@MTHex] /ip/dhcp-server> print
Columns: NAME, INTERFACE, ADDRESS-POOL, LEASE-TIME
# NAME    INTERFACE  ADDRESS-POOL  LEASE-TIME
0 VLAN2   VLAN2      VLAN2         1d        
1 VLAN10  VLAN10     VLAN10        12h       
2 VLAN99  VLAN99     VLAN99        1d        
3 VLAN20  VLAN20     VLAN20        12h       
4 VLAN30  VLAN30     VLAN30        12h       
[xyz@MTHex] /ip/dhcp-server> 

[xyz@MTHex] /ip/pool> print
Columns: NAME, RANGES
#  NAME    RANGES                       
0  VLAN2   192.168.2.100-192.168.2.254  
1  VLAN99  192.168.99.10-192.168.99.19  
2  VLAN20  192.168.20.100-192.168.20.199
3  VLAN10  192.168.10.100-192.168.10.199              
4  VLAN30  192.168.30.100-192.168.30.199
[xyz@MTHex] /ip/pool> 

It is also possible (I think, I'm not even going to try. k6ccc seems to have tested it a bit) to use the same pool for different DHCP servers but I can't understand why you may want to do that.

So what you certainly need to do, is define a server per VLAN.
What you next need to do is determine for yourself if you want to use a separate pool per VLAN, or a common pool (which I personally think is to be avoided but it seems to be possible).

But as others already have pointed out: WHY do you want to put everything in one common pool ? For what purpose ?
Because in the first post and then another one you are contradicting yourself.
First you say one common pool, then you say on a per VLAN basis.
Two different things.

@felixka:
nice link to XY problem. Never saw it being explained like that but very appropriate !
 
felixka
Frequent Visitor
Frequent Visitor
Posts: 58
Joined: Mon Oct 19, 2020 4:12 am
Location: Canada

Re: Single DHCP server for multiple VLANs?

Wed Aug 10, 2022 6:47 pm

Why would they need to be in the same IP address range to begin with?
VLANs create a separate Layer 2 domain per VLAN, so trying to overlay a single Layer 3 IP subnet over it sounds like asking for trouble.
 
Zacharias
Forum Guru
Forum Guru
Posts: 3459
Joined: Tue Dec 12, 2017 12:58 am
Location: Greece

Re: Single DHCP server for multiple VLANs?

Wed Aug 10, 2022 9:13 pm

but I can't assign the DHCP server to multiple VLANs.
I guess because the DHCP server is not your MikroTik router and its not aware of the VLANs...
Right ?

You could create the VLAN interfaces on your DHCP server then...
Or a second cable, one for each VLAN between the DHCP server and the Router... that's just a simple solution.. It could be done without VLANs as well...

Both of the above examples need appropriate configuration on your Router.
 
User avatar
Buckeye
Forum Veteran
Forum Veteran
Posts: 883
Joined: Tue Sep 11, 2018 2:03 am
Location: Ohio, USA

Re: Single DHCP server for multiple VLANs?

Wed Aug 10, 2022 9:32 pm

But I am trying to have the Mikrotik be the DHCP server and hand out IPs on a per VLAN basis - but in Mikrotik, the DHCP server needs an interface to operate on. It works if I assign a DHCP server to the VLAN, but I can't assign the DHCP server to multiple VLANs.
I think the diagram in the OP is confusing, since it appears there as if the DHCP server is on an external host (like a windows server with a dhcp server)

For dhcp to work, you need to have a "server" per broadcast domain (LAN or vlan). Because that's how dhcp works, it starts with the client sending a broadcast to discover the dhcp server(s) available.

What is the problem you are trying to solve? You never really stated it, but instead stated what you think will solve your problem, thus the response about this being an XYProblem, which it does appear to be.

If you have multiple vlans, then you would normally have separate subnets on each vlan. Again, what problem are you trying to solve?

Give us more information about vlan 10 and vlan 20, and the purpose of having two vlans.

From a dhcp point of view, having two dumb switches connected to two routed interfaces is identical to having two vlan interfaces on the same base interface (whether the base interface is a bridge or an ethernet interface that isn't part of the bridge). You need one dhcp server for each interface connecting to the each subnet you want to serve.
 
felixka
Frequent Visitor
Frequent Visitor
Posts: 58
Joined: Mon Oct 19, 2020 4:12 am
Location: Canada

Re: Single DHCP server for multiple VLANs?

Wed Aug 10, 2022 11:47 pm

I mean one solution could be to just bridge VLAN10 and VLAN20 right on the Mikrotik and make them one L2 broadcast domain because it sounds you are handed two VLANs that you actually don't want to be separate in the first place.
 
sygys
just joined
Posts: 4
Joined: Wed Jul 19, 2023 12:07 pm

Re: Single DHCP server for multiple VLANs?

Sat Aug 26, 2023 6:19 pm

i was trying something similar.

I have 2 vlans on trunk port 5 on the router. i then put ether 4 and ether 5 in a bridge and assigned a DHCP server to that bridge. According to the leases the pc is getting an ip but the pc is not comming online. So as i read allot here i guess its not possible to assign one subnet to multiple vlans on an ether port.
 
erlinden
Forum Guru
Forum Guru
Posts: 1900
Joined: Wed Jun 12, 2013 1:59 pm
Location: Netherlands

Re: Single DHCP server for multiple VLANs?

Sun Aug 27, 2023 11:34 am

So as i read allot here i guess its not possible to assign one subnet to multiple vlans on an ether port.
Why would one assign one subnet to multiple VLANs?
 
sid5632
Long time Member
Long time Member
Posts: 552
Joined: Fri Feb 17, 2017 6:05 pm

Re: Single DHCP server for multiple VLANs?

Sun Aug 27, 2023 12:54 pm

This thread is just bizarre.
People attempting this should go back to networking school (or even go there for the first time as they are seemingly clueless).

Have you guys ever tried to put a huge single tyre on a 4 wheeled vehicle? And then wondered why it's very hard to do, makes no sense, and doesn't work?

Who is online

Users browsing this forum: No registered users and 45 guests