[Dnsmasq-discuss] Tagging by interface?
Quintus
quintus at quintilianus.eu
Wed Sep 4 21:34:03 BST 2013
Am Tue, 3 Sep 2013 14:15:21 +0200
schrieb Quintus <quintus at quintilianus.eu>:
> I did, and to double-check I just tried again. This yields the same
> error as before.
Nevermind, I solved my problem by changing my network setup. Reading
dnsmasq’s manpage again, I found this:
> For directly connected networks (ie, networks on which the machine
> running dnsmasq has an interface) the netmask is optional: dnsmasq
> will determine it from the interface configuration.
I’ve given eth0 and wlan0 addresses from different subnets which the
machine running dnsmasq now connects (I’ve removed IPv6 stuff for
readability):
-------------------------------------
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000 link/ether b8:27:eb:fe:1c:c1 brd ff:ff:ff:ff:ff:ff
inet 10.37.59.2/26 brd 10.37.59.63 scope global eth0
5: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
qlen 1000 link/ether f8:1a:67:21:d2:a7 brd ff:ff:ff:ff:ff:ff
inet 10.37.59.65/26 brd 10.37.59.127 scope global wlan0
-------------------------------------
That is, eth0 is in a subnet 10.37.59.0/26 and wlan0 in 10.37.59.64/26.
I then changed my /etc/dnsmasq.conf to deliver IPs via DHCP like this:
-------------------------------------
dhcp-range=set:wired,10.37.59.3,10.37.59.62,12h
dhcp-range=set:wifi,10.37.59.66,10.37.59.126,12h
-------------------------------------
That is, I completely removed the "interface:" command, relying on
dnsmasq’s auto-determination of the netmask (see the quote from the
manpage above) instead. And indeed, this caused dnsmasq to give
addresses in the range 10.37.59.3-10.37.59.62 only to clients
requesting from eth0, whereas clients requesting on wlan0 got those in
the range of 10.37.59.66-10.37.59.126. The next step was simply to add
"set:wired" / "set:wifi" to the respective `dhcp-range' lines,
effectively allowing me to tag clients by interface. Once I had the
tags set, the rest was basically just using them in `dhcp-option':
-------------------------------------
dhcp-option=tag:wired,3,10.37.59.1
dhcp-option=tag:wifi,3,10.37.59.65
-------------------------------------
(10.37.59.1 is the internet gateway, 10.37.59.65 is the address of the
Raspberry Pi’s wlan0, as already shown further above).
Combining this with dnsmasq’s `domain' directive, I can even make
clients using different FQDNs based on whether they connect via WiFi or
cable network:
-------------------------------------
domain=cable.internal.example.org,10.37.59.0/26
domain=wifi.internal.example.org,10.37.59.64/26
-------------------------------------
Thank you anway.
Valete,
Marvin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20130904/c7f719b1/attachment.pgp>
More information about the Dnsmasq-discuss
mailing list