[Dnsmasq-discuss] Help with dnsmasq and vlans tags

jmperrote jmperrote at policia.rionegro.gov.ar
Mon Dec 10 12:36:53 GMT 2018


El 2018-12-06 15:56, Geert Stappers escribió:
> On Thu, Dec 06, 2018 at 06:52:11PM +0100, john doe wrote:
>> On 12/6/2018 3:50 PM, jmperrote wrote:
>> >>>> dhcp-option=eth0,6,10.11.37.15 #dns primario
>> >>>> dhcp-option=eth0,1,255.255.255.0 # mascara de red
>> >>>> dhcp-option=eth0,option:router,10.11.37.1 # gateway
>> >>>>
>> >>>> dhcp-range=interface:eth1,set:VLAN_137,10.11.137.90,10.11.137.98,6h
>> >>>> dhcp-option=eth1,6,10.11.37.15 #dns primario
>> >>>> dhcp-option=eth1,1,255.255.255.0 # mascara de red
>> >>>> dhcp-option=eth1,option:router,10.11.137.1 # gateway
>> >>>>
>> >>>> dhcp-range=interface:eth2,set:VLAN_237,10.11.237.50,10.11.237.200,6h
>> >>>> dhcp-option=eth2,6,10.11.37.15 #dns primario
>> >>>> dhcp-option=eth2,1,255.255.255.0 # mascara de red
>> >>>> dhcp-option=eth2,option:router,10.11.237.1 # gateway
>> >>>>
>> >
>> > Hello, ok trying a solution to resolv dnsmasq with vlans and one nic, I
>> > do next
>> >
>> > I reconfigured the dnsmasq with this and the mikrotik router with tagged
>> > vlans.
>> >
>> > dhcp-range=tag:eth0,set:eth0,10.11.37.50,10.11.37.200,6h
>> > dhcp-range=tag:eth0,set:eth0,10.11.137.50,10.11.137.200,6h
>> > dhcp-range=tag:eth0,set:eth0,10.11.237.50,10.11.237.200,6h
>> > dhcp-option=tag:eth0,option:dns-server,10.11.37.15
>> > dhcp-option=tag:eth0,option:dns-server,10.11.37.15
>> > dhcp-option=tag:eth0,option:dns-server,10.11.37.15
>> > dhcp-option=tag:eth0,option:router,10.11.137.1
>> > dhcp-option=tag:eth0,option:router,10.11.37.1
>> > dhcp-option=tag:eth0,option:router,10.11.237.1
> 
> Check the above config again.
> 
> | dhcp-range=tag:eth0.37,set:eth0,10.11.37.50,10.11.37.200,6h
> | dhcp-range=tag:eth0.137,set:eth0,10.11.137.50,10.11.137.200,6h
> | dhcp-range=tag:eth0.237,set:eth0,10.11.237.50,10.11.237.200,6h
> | dhcp-option=tag:eth0.37,option:dns-server,10.11.37.15
> | dhcp-option=tag:eth0.137,option:dns-server,10.11.37.15
> | dhcp-option=tag:eth0.237,option:dns-server,10.11.37.15
> | dhcp-option=tag:eth0.137,option:router,10.11.137.1
> | dhcp-option=tag:eth0.37,option:router,10.11.37.1
> | dhcp-option=tag:eth0.237,option:router,10.11.237.1
> 
> Is what I would expect.
> 
> 
>> > The assign of ip work fine, each PC on each vlan pickup a IP on
>> > corresponding vlan, but on 3 PCs allways assign the same gateway -->
>> > 10.11.237.1
>> >
>> 
>> If it is working for most of the hosts,
> 
> If, only if.
> 
> 
>> my guess is that you need to renew the lease on those hosts.
>> 
>> EG with dhclient:
>> 
>> $ dhclient -r <INT-NAME> && dhclient <INT-NAME>
>> 
>> Where <INT-NAME> is the name of the interface on which the lease need 
>> to
>> be released and acquired.
> 
> 
> No, start with a static address at the clients.
> Then check if connecting the "dnsmasq host with 3 VLANID" works.
> Me and Murphy say that it doesn't work.
> I say that the switch needs additional configuration.
> Feel free to proof me wrong.
> 
> 
> Groeten
> Geert Stappers



Finally we find a solution for dnsmasq with vlans

interface=eth0

#propiedades genericas
dhcp-option=6,10.11.37.15 #dns primario
dhcp-option=1,255.255.255.0 # mascara de red

dhcp-range=interface:eth0,set:vlan37,10.11.37.50,10.11.37.200,8h
dhcp-option=tag:vlan37,3,10.11.37.1 # #gateway/router
dhcp-option=tag:vlan37,28,10.11.37.255 # broadcast

dhcp-range=set:vlan137,10.11.137.50,10.11.137.200,8h
dhcp-option=tag:vlan137,3,10.11.137.1 #gateway/router
dhcp-option=tag:vlan137,28,10.11.137.255 #broadcast

dhcp-range=set:vlan237,10.11.237.50,10.11.237.200,8h
dhcp-option=tag:vlan237,3,10.11.237.1 #gateway/router
dhcp-option=tag:vlan237,28,10.11.237.255 #broadcast


The last problem was "dnmasq allways assign the same router for all 
clients" the solution was use the tag: option on dnsmasq.conf to 
identified the vlan comming the request. On the dnsmasq log Just next on 
the request we found -->

dnsmasq-dhcp[7800]: 2756951124 DHCPREQUEST(eth0) 10.11.237.95 
00:0a:e6:bf:1c:5d
Dec 10 12:30:59 dnsmasq-dhcp[7800]: 2756951124 tags: vlan237, eth0

The tag entry mark the vlans where become the request, so we to adjust 
the dnsmasq.conf to tell that use tag option on each option we want, for 
example on the roiter option.

Ragards





More information about the Dnsmasq-discuss mailing list