I don't suppose it is possible for dnsmasq to assign IP addressed based on VLAN tags, can it?

shelzmike

New Member
Joined
Aug 16, 2020
Messages
3
Reaction score
0
Credits
36
I know there are several ways to solve this challenge, but wanted to eliminate one, if I need to, as I am not quite sure yet if this is not possible.

Using a USG router as my layer 3, I have a Cisco SG-500 (L2 only), and various LAN devices, wired and wireless. I am currently using 3 different VLANs, 2 of which are my primary and what I am referring to here.

I have 1 VLAN that is my pihole subnet and another that are devices that I don't want to use pihole with (for now).

I know that dnsmasq can handout multiple subnet DHCP and handle it's DNS, but I have only seen references to it being able to do this by way of multiple interfaces (as with a VM).

Is there a way to handle this the same way, but instead with a single NIC, using VLAN tags for the different subnets? TBH, this may not be the best way to handle what I am trying to do. I could have my PiHole handle DHCP for it's own subnet/VLAN and keep my existing linux sever as my other subnet/VLAN dhcp and DNS. However, what I want to do is to have both DNS servers know the hosts that are on each of the other subnets. I could do this easily with the USG if I made it my DHCP server, but I like to keep it off there as I change my router often for testing and such and having this service isolated is much easier.
 


It does support "tagging" based on DNS domains, and MAC addresses.

But in order to have multiple subnets all go out the same interface, you would have to have them concurrent. You could "cheat" by doing something like...

eth0 = 10.10.1.0/24
vip1 = 10.10.1.0/27
vip2 = 10.10.1.33/27
vip3 = 10.10.1.65/27

Then assign tags based on the range.
 
Interesting idea. I haven't worked too much with virtual IPs on a linux machine, so I'll have to look into it. I guess my first question is, how does the server know what VLAN the device sending out the DHCP broadcast is on? Meaning, I understand the concept of the VIPs, but when a request comes in, how does it know what address range it needs an IP from. Or are you saying it can do this, but I'd have to specify statically the MAC addresses in the config file? I suppose that would work, but isn't as flexible as I would like.
 
Oh wait, I just realized that I can set up a forwarder on the USG router per VLAN, so perhaps that is the way it would work. I'll have to check it out and play around.
 

Members online


Latest posts

Top