Server only for relayed requests, not broadcasts

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Server only for relayed requests, not broadcasts

Rob Janssen
I have a machine with 2 network interfaces.
ens224 is on a local network 192.168.1.0/26 where it has to handle DHCP requests.
ens192 is on a different network 172.22.16.0/21 internal to the company where it is connected to a router.
On another location, there is a relay agent that forwards DHCP requests on a VLAN 192.168.1.64/28  to this server.
These come in on ens192 but the DHCP server should NOT handle local requests on ens192, only those forwarded requests.
(local DHCP on the network connected to ens192 is handled by another server, also via a relay agent)

The forwarded DHCP requests are sent to the machine's IP on ens224 (the router knows to forward them to this machine),
however it appears that it is impossible to listen on an interface only for handling forwarded requests.  Is that true?

So I have included a dummy section for ens192 like this:

subnet 172.22.16.0 netmask 255.255.248.0 {
   deny unknown-clients;
   deny client-updates;
   not authoritative;
}

Not sure if the deny rules are really required, but the "not authoritative;" is, because the server
would reply to requests and informs when it is not there, even with no address pool available.
(there is an "authoritative" option in the global configuration)

Even with this config, the server is logging requests that it simply should not see, like:

Apr 24 10:02:47 unifi dhcpd[827]: DHCPDISCOVER from 00:8c:fa:d6:08:5f via ens192: network 172.22.16.0/21: no free leases
Apr 24 10:02:47 unifi dhcpd[827]: DHCPREQUEST for 172.22.18.199 (10.175.176.150) from 00:8c:fa:d6:08:5f via ens192: unknown lease 172.22.18.199.
Apr 24 10:02:48 unifi dhcpd[827]: DHCPINFORM from 172.22.18.199 via ens192: not authoritative for subnet 172.22.16.0
Apr 24 10:02:48 unifi dhcpd[827]: DHCPINFORM from 172.22.18.199 via ens192: not authoritative for subnet 172.22.16.0

and frequently it inserts this nagging section:

Apr 24 10:02:48 unifi dhcpd[827]: If this DHCP server is authoritative for that subnet,
Apr 24 10:02:48 unifi dhcpd[827]: please write an `authoritative;' directive either in the
Apr 24 10:02:48 unifi dhcpd[827]: subnet declaration or in some scope that encloses the
Apr 24 10:02:48 unifi dhcpd[827]: subnet declaration - for example, write it at the top
Apr 24 10:02:48 unifi dhcpd[827]: of the dhcpd.conf file.

Is there really no way for ISC DHCPD to receive forwarded requests on an interface (in this case, directed to 192.168.1.1 which
is the local address on ens224 which has a valid subnet declaration), without receiving broadcasts as well?

I even tried an nftables filter:

nft add table netdev filter
nft -- add chain netdev filter input { type filter hook ingress device ens192 priority -500 \; policy accept \; }
nft add rule netdev filter input iifname ens192 ip daddr != 192.168.1.1 udp dport 67 counter drop

This catches the "wrong" packets, counter increases, but DHCPD still sees them.
Version is: isc-dhcpd-4.3.5  (Debian Stretch)

Rob

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Server only for relayed requests, not broadcasts

Peter Rathlev
On Wed, 2019-04-24 at 10:40 +0200, Rob Janssen wrote:
> The forwarded DHCP requests are sent to the machine's IP on ens224
> (the router knows to forward them to this machine),
> however it appears that it is impossible to listen on an interface
> only for handling forwarded requests.  Is that true?

By default this is true. ISC DHCPd uses raw sockets unless compiled
otherwise. For it to receive packets on an interface, even if they're
actually destined to an address on another interface, it needs to
listen on the interface. And since it's a raw socket the server will
see local broadcasts.

You might try looking into compiling a version yourself with the
configure option "--enable-use-sockets". This will make the server not
use raw sockets but regular BSD sockets. And this again will make it
behave much more like you expect.

Take a look at this KB article:

https://kb.isc.org/docs/aa-00379

> So I have included a dummy section for ens192 like this:
>
> subnet 172.22.16.0 netmask 255.255.248.0 {
>    deny unknown-clients;
>    deny client-updates;
>    not authoritative;
> }
[...]
> Even with this config, the server is logging requests that it simply
> should not see, like:

Could you add "ignore booting" to that subnet declaration? It's valid
syntax though I'm not entirely sure does what you want.

> I even tried an nftables filter:
[...]
> This catches the "wrong" packets, counter increases, but DHCPD still
> sees them.

This is again because of the raw sockets. Just like "tcpdump" will
actually see packets dropped by a filter, DHCPd will also.

--
Peter


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Server only for relayed requests, not broadcasts

Rob Janssen
Peter Rathlev wrote:

> On Wed, 2019-04-24 at 10:40 +0200, Rob Janssen wrote:
>> The forwarded DHCP requests are sent to the machine's IP on ens224
>> (the router knows to forward them to this machine),
>> however it appears that it is impossible to listen on an interface
>> only for handling forwarded requests.  Is that true?
> By default this is true. ISC DHCPd uses raw sockets unless compiled
> otherwise. For it to receive packets on an interface, even if they're
> actually destined to an address on another interface, it needs to
> listen on the interface. And since it's a raw socket the server will
> see local broadcasts.
>
> You might try looking into compiling a version yourself with the
> configure option "--enable-use-sockets". This will make the server not
> use raw sockets but regular BSD sockets. And this again will make it
> behave much more like you expect.
>
> Take a look at this KB article:
>
> https://kb.isc.org/docs/aa-00379

Unfortunately it looks like this is a global compile directive, while in my use case I need it to
behave differently on the different interfaces: on ens192 I would like it to receive on a normal
UDP socket, but on ens224 I require the "raw socket" functionality as the clients are local there.

I fact I do not really mind that it uses a raw socket (although it of course wastes CPU), but I
would like to see a configuration directive to make dhcpd ignore broadcasts on an interface.
(not only "not reply" but also "don't bother to log anything")

It does not appear to be such an unusual use case.  Especially in a network that uses lots of
different VLANs to separate management and operational networks.

My use case is for the management interface of wireless access points in a company with
different locations, where the management server is at a single location and serves the local
devices directly on a management VLAN specific to that purpose, while devices at other locations
are on a similar VLAN locally, but this is routed towards the central location.
I have considered setting up an L2 or L3 tunnel between the management networks, but it seems
overly complex to work around such an issue (there are L3 firewall rules that prohibit traffic into-
and out of the management network towards other networks).

>
>> So I have included a dummy section for ens192 like this:
>>
>> subnet 172.22.16.0 netmask 255.255.248.0 {
>>     deny unknown-clients;
>>     deny client-updates;
>>     not authoritative;
>> }
> [...]
>> Even with this config, the server is logging requests that it simply
>> should not see, like:
> Could you add "ignore booting" to that subnet declaration? It's valid
> syntax though I'm not entirely sure does what you want.
Ok added that and see what happens (tomorrow when the clients on that network start again).
(It is accepted without warning or error)

>
>> I even tried an nftables filter:
> [...]
>> This catches the "wrong" packets, counter increases, but DHCPD still
>> sees them.
> This is again because of the raw sockets. Just like "tcpdump" will
> actually see packets dropped by a filter, DHCPd will also.
>

Indeed, it appears that the "ingress" filter is not as useful as I thought it would be.
(I hoped that it would also filter the traffic that tcpdump sees, but it doesn't)

Rob

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Server only for relayed requests, not broadcasts

glenn.satchell
"ignore booting" or "deny booting" are exactly what you want for that
subnet, causing the dhcp server to not respond to the requests. The
difference between the two is that deny will log the requests, while
ignore will not log. Given that it's a /21 network I would guess there
will be lots of requests and ignore might be a better chioce.

regards,
-glenn

On 2019-04-25 05:42, Rob Janssen wrote:

> Peter Rathlev wrote:
>> On Wed, 2019-04-24 at 10:40 +0200, Rob Janssen wrote:
>>> The forwarded DHCP requests are sent to the machine's IP on ens224
>>> (the router knows to forward them to this machine),
>>> however it appears that it is impossible to listen on an interface
>>> only for handling forwarded requests.  Is that true?
>> By default this is true. ISC DHCPd uses raw sockets unless compiled
>> otherwise. For it to receive packets on an interface, even if they're
>> actually destined to an address on another interface, it needs to
>> listen on the interface. And since it's a raw socket the server will
>> see local broadcasts.
>>
>> You might try looking into compiling a version yourself with the
>> configure option "--enable-use-sockets". This will make the server not
>> use raw sockets but regular BSD sockets. And this again will make it
>> behave much more like you expect.
>>
>> Take a look at this KB article:
>>
>> https://kb.isc.org/docs/aa-00379
>
> Unfortunately it looks like this is a global compile directive, while
> in my use case I need it to
> behave differently on the different interfaces: on ens192 I would like
> it to receive on a normal
> UDP socket, but on ens224 I require the "raw socket" functionality as
> the clients are local there.
>
> I fact I do not really mind that it uses a raw socket (although it of
> course wastes CPU), but I
> would like to see a configuration directive to make dhcpd ignore
> broadcasts on an interface.
> (not only "not reply" but also "don't bother to log anything")
>
> It does not appear to be such an unusual use case.  Especially in a
> network that uses lots of
> different VLANs to separate management and operational networks.
>
> My use case is for the management interface of wireless access points
> in a company with
> different locations, where the management server is at a single
> location and serves the local
> devices directly on a management VLAN specific to that purpose, while
> devices at other locations
> are on a similar VLAN locally, but this is routed towards the central
> location.
> I have considered setting up an L2 or L3 tunnel between the management
> networks, but it seems
> overly complex to work around such an issue (there are L3 firewall
> rules that prohibit traffic into-
> and out of the management network towards other networks).
>
>>
>>> So I have included a dummy section for ens192 like this:
>>>
>>> subnet 172.22.16.0 netmask 255.255.248.0 {
>>>     deny unknown-clients;
>>>     deny client-updates;
>>>     not authoritative;
>>> }
>> [...]
>>> Even with this config, the server is logging requests that it simply
>>> should not see, like:
>> Could you add "ignore booting" to that subnet declaration? It's valid
>> syntax though I'm not entirely sure does what you want.
> Ok added that and see what happens (tomorrow when the clients on that
> network start again).
> (It is accepted without warning or error)
>
>>
>>> I even tried an nftables filter:
>> [...]
>>> This catches the "wrong" packets, counter increases, but DHCPD still
>>> sees them.
>> This is again because of the raw sockets. Just like "tcpdump" will
>> actually see packets dropped by a filter, DHCPd will also.
>>
>
> Indeed, it appears that the "ingress" filter is not as useful as I
> thought it would be.
> (I hoped that it would also filter the traffic that tcpdump sees, but
> it doesn't)
>
> Rob
>
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Server only for relayed requests, not broadcasts

Rob Janssen
[hidden email] wrote:
> "ignore booting" or "deny booting" are exactly what you want for that subnet, causing the dhcp server to not respond to the requests. The difference between the two is that deny will log the requests, while ignore will not log. Given that it's a
> /21 network I would guess there will be lots of requests and ignore might be a better chioce.
>
> regards,
> -glenn

Thanks!
I think I read somewhere that "ignore" was deprecated and "deny" should be used, but what you write makes sense.

I have added the "ignore booting" and also changed the other two "deny" to "ignore" and it looks like it has stopped logging
DHCPDISCOVER from 00:8c:fa:d6:08:0e via ens192: network 172.22.16.0/21: no free leases
but it still logs
DHCPINFORM from 172.22.18.174 via ens192: not authoritative for subnet 172.22.16.0

Is there any way those can be ignored as well?

Rob
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Server only for relayed requests, not broadcasts

Peter Rathlev
On Thu, 2019-04-25 at 09:56 +0200, Rob Janssen wrote:
> I have added the "ignore booting" and also changed the other two
> "deny" to "ignore" and it looks like it has stopped logging
> DHCPDISCOVER from 00:8c:fa:d6:08:0e via ens192: network
> 172.22.16.0/21: no free leases
> but it still logs
> DHCPINFORM from 172.22.18.174 via ens192: not authoritative for
> subnet 172.22.16.0
>
> Is there any way those can be ignored as well?

Can you add "authoritative" to the scope definition, and/or remove "not
authoritative" from it? Keep "ignore booting" and make sure there's no
dynamic pool of course. But maybe that will shut it up.

--
Peter


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Server only for relayed requests, not broadcasts

Rob Janssen
Peter Rathlev wrote:

> On Thu, 2019-04-25 at 09:56 +0200, Rob Janssen wrote:
>> I have added the "ignore booting" and also changed the other two
>> "deny" to "ignore" and it looks like it has stopped logging
>> DHCPDISCOVER from 00:8c:fa:d6:08:0e via ens192: network
>> 172.22.16.0/21: no free leases
>> but it still logs
>> DHCPINFORM from 172.22.18.174 via ens192: not authoritative for
>> subnet 172.22.16.0
>>
>> Is there any way those can be ignored as well?
> Can you add "authoritative" to the scope definition, and/or remove "not
> authoritative" from it? Keep "ignore booting" and make sure there's no
> dynamic pool of course. But maybe that will shut it up.
>

Frankly I am not going to risk that it again will send answers, as it did briefly before I had
the "not authoritative", messing up the operation of all computers on the local network...

Rob
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users