Re: [Dnsmasq-discuss] Can't get tags to apply with dhcp-circuitid

2023-02-10 Thread Simon Kelley

Luckily, we have the  complete data being added by the relay

option: 82 agent-id  01:04:00:64:00:02:02:06:5c:f4:ab:af:6f:9c

That's at circuit-ID (01) of length four (04) value 00:64:00:02
and a remote-id (02) length six (06) value 5c:f4:ab:af:6f:9c

So you can either match against the remote-id


dhcp-remoteid=set:iot,06:5c:f4:ab:af:6f:9c

or against the circuitid

dhcp-circuitid=set:iot,00:64:00:02


In the first case you nearly got it, but matched against circuitid not 
the remoteid, and in both cases you've accidentally copied the length 
byte into the pattern you're matching.


Please be gentle with the facepalm: we don't want to be responsible to 
injuries to dnsmasq users :)


Simon.


On 09/02/2023 19:50, Justin Ellison wrote:

I'm sure the solution to this is really going to make me facepalm, but I've 
been working on this for hours and can't figure out what I'm doing wrong.

I'm using dnsmasq on a pi-hole docker container.  I'm trying to set up dnsmasq 
so that it hands out DHCP requests for multiple vlans.  I've configured my 
switch to relay and to add option 82.  I have pcaps from the docker host that 
show option 82 is being added.  I can also see in the logs that dnsmasq sees 
the option 82 information.  For the life of me, I can't get the tag to apply 
using dhcp-circuitid.  Here's the relevant config where I try to match on the 
agentid:

dhcp-circuitid=set:iot,06:5c:f4:ab:af:6f:9c

I've also tried matching on the circuitid a few different ways:
dhcp-circuitid=set:iot,04:00:64:00:02
dhcp-circuitid=set:iot,0400640002

I then try to use that tag to set a custom range like so:

dhcp-range=tag:iot,set:shared,192.168.3.1,192.168.3.254,255.255.254.0,24h

With debug logging, I can see option 82 with the correct values being sent, but it just 
won't assign the "iot" tag:

Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 available DHCP range: 
192.168.3.1 -- 192.168.3.254
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 available DHCP range: 
172.31.10.99 -- 172.31.10.199
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 client provides name: 
KRY-MB-AE-021
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 DHCPDISCOVER(enp3s0) 
f4:d4:88:5f:05:2f
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 tags: enp3s0
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 DHCPOFFER(enp3s0) 172.31.10.103 
f4:d4:88:5f:05:2f
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 requested options: 1:netmask, 
121:classless-static-route, 3:router,
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 requested options: 6:dns-server, 
15:domain-name, 108:ipv6-only,
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 requested options: 114, 
119:domain-search, 252, 95, 44:netbios-ns,
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 requested options: 
46:netbios-nodetype
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 next server: 172.31.10.2
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  1 option: 53 
message-type  2
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option: 54 
server-identifier  172.31.10.2
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option: 51 
lease-time  1d
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option: 58 T1  12h
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option: 59 T2  21h
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option:  1 netmask 
 255.255.255.0
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option: 28 
broadcast  172.31.10.255
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option:  6 
dns-server  172.31.10.2
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size: 14 option: 15 
domain-name  techadvise.com
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option:  3 router  
172.31.10.1
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size: 14 option: 82 
agent-id  01:04:00:64:00:02:02:06:5c:f4:ab:af:6f:9c
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 available DHCP range: 
192.168.3.1 -- 192.168.3.254
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 available DHCP range: 
172.31.10.99 -- 172.31.10.199
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 client provides name: 
KRY-MB-AE-021
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 DHCPDISCOVER(enp3s0) 
f4:d4:88:5f:05:2f
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 tags: enp3s0
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 DHCPOFFER(enp3s0) 172.31.10.103 
f4:d4:88:5f:05:2f
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 requested options: 1:netmask, 
121:classless-static-route, 3:router,
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 requested options: 6:dns-server, 
15:domain-name, 108:ipv6-only,
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 requested options: 114, 
119:domain-search, 252, 95, 44:netbios-ns,
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 requested options: 
46:netbios-nodetype
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 next server: 172.31.10.2
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 sent size:  1 option: 53 

[Dnsmasq-discuss] Can't get tags to apply with dhcp-circuitid

2023-02-09 Thread Justin Ellison
I'm sure the solution to this is really going to make me facepalm, but I've 
been working on this for hours and can't figure out what I'm doing wrong.

I'm using dnsmasq on a pi-hole docker container.  I'm trying to set up dnsmasq 
so that it hands out DHCP requests for multiple vlans.  I've configured my 
switch to relay and to add option 82.  I have pcaps from the docker host that 
show option 82 is being added.  I can also see in the logs that dnsmasq sees 
the option 82 information.  For the life of me, I can't get the tag to apply 
using dhcp-circuitid.  Here's the relevant config where I try to match on the 
agentid:

dhcp-circuitid=set:iot,06:5c:f4:ab:af:6f:9c

I've also tried matching on the circuitid a few different ways:
dhcp-circuitid=set:iot,04:00:64:00:02
dhcp-circuitid=set:iot,0400640002

I then try to use that tag to set a custom range like so:

dhcp-range=tag:iot,set:shared,192.168.3.1,192.168.3.254,255.255.254.0,24h 

With debug logging, I can see option 82 with the correct values being sent, but 
it just won't assign the "iot" tag:

Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 available DHCP range: 
192.168.3.1 -- 192.168.3.254
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 available DHCP range: 
172.31.10.99 -- 172.31.10.199
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 client provides name: 
KRY-MB-AE-021
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 DHCPDISCOVER(enp3s0) 
f4:d4:88:5f:05:2f
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 tags: enp3s0
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 DHCPOFFER(enp3s0) 172.31.10.103 
f4:d4:88:5f:05:2f
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 requested options: 1:netmask, 
121:classless-static-route, 3:router,
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 requested options: 6:dns-server, 
15:domain-name, 108:ipv6-only,
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 requested options: 114, 
119:domain-search, 252, 95, 44:netbios-ns,
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 requested options: 
46:netbios-nodetype
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 next server: 172.31.10.2
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  1 option: 53 
message-type  2
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option: 54 
server-identifier  172.31.10.2
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option: 51 
lease-time  1d
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option: 58 T1  12h
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option: 59 T2  21h
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option:  1 netmask 
 255.255.255.0
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option: 28 
broadcast  172.31.10.255
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option:  6 
dns-server  172.31.10.2
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size: 14 option: 15 
domain-name  techadvise.com
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size:  4 option:  3 router  
172.31.10.1
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3615888487 sent size: 14 option: 82 
agent-id  01:04:00:64:00:02:02:06:5c:f4:ab:af:6f:9c
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 available DHCP range: 
192.168.3.1 -- 192.168.3.254
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 available DHCP range: 
172.31.10.99 -- 172.31.10.199
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 client provides name: 
KRY-MB-AE-021
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 DHCPDISCOVER(enp3s0) 
f4:d4:88:5f:05:2f
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 tags: enp3s0
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 DHCPOFFER(enp3s0) 172.31.10.103 
f4:d4:88:5f:05:2f
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 requested options: 1:netmask, 
121:classless-static-route, 3:router,
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 requested options: 6:dns-server, 
15:domain-name, 108:ipv6-only,
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 requested options: 114, 
119:domain-search, 252, 95, 44:netbios-ns,
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 requested options: 
46:netbios-nodetype
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 next server: 172.31.10.2
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 sent size:  1 option: 53 
message-type  2
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 sent size:  4 option: 54 
server-identifier  172.31.10.2
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 sent size:  4 option: 51 
lease-time  1d
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 sent size:  4 option: 58 T1  12h
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 sent size:  4 option: 59 T2  21h
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 sent size:  4 option:  1 netmask 
 255.255.255.0
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 sent size:  4 option: 28 
broadcast  172.31.10.255
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 sent size:  4 option:  6 
dns-server  172.31.10.2
Feb  9 13:45:48 dnsmasq-dhcp[3033]: 3372121439 sent size: 14 option: 15 
domain-name