Bohdan Tashchuk
2013-01-29 00:13:20 UTC
Hi guys,
For many years, I've read pf and dhcp related threads like, e.g.:
http://marc.info/?l=openbsd-misc&m=125907434809727&w=2
Some text from that post:
"dhcp packets are grabbed by dhclient or dhcpd before pf sees them."
My understanding, based on comments in a number of threads like that,
is that NO MATTER WHAT IS IN PF RULES, that dhcpd and dhclient should
both work fine. This is because dhcpd and dhclient both use bpf to
completely bypass pf.
However, I'm running OpenBSD 5.2 release, and I don't think dhclient
is able to renew its lease without pf cooperation. I recently tightened
up my pf rules, which is how I ran into this.
Here's what I see, based on tcpdump and daemon logs:
1) on startup, my dhclient negotiates with my ISP's dhcp server properly.
It makes a request, it gets a lease, as logged in /var/log/daemon:
Jan 27 02:55:00 (myname) dhclient[24372]: DHCPREQUEST on em1 to 255.255.255.255 port 67
Jan 27 02:55:00 (myname) dhclient[24372]: DHCPACK from 73.88.146.1 (00:1d:70:af:ec:e2)
Jan 27 02:55:00 (myname) dhclient[24372]: bound to 76.27.218.121 -- renewal in 116353 seconds.
2) this lease is properly recorded in my dhclient.leases.em1 file:
lease {
interface "em1";
fixed-address 76.27.218.121;
option subnet-mask 255.255.252.0;
option routers 76.27.216.1;
...
option broadcast-address 255.255.255.255;
option dhcp-lease-time 232706;
option dhcp-message-type 5;
option dhcp-server-identifier 76.96.95.6;
renew 1 2013/1/28 19:14:13;
...
}
3) but when it comes time to renew, my pf rules block outgoing UDP to port 67,
so the following is in pflog:
Jan 28 11:14:13.977566 rule 73/(match) block out on em1:
76.27.218.121.68 > 76.96.95.6.67: xid:0x2530b3a4 C:76.27.218.121
ether 00:07:e9:1a:37:6b [|bootp] [tos 0x10]
4) I see a corresponding message in /var/log/daemon:
Jan 28 11:14:13 (myname) dhclient[27723]: DHCPREQUEST on em1 to 76.96.95.6 port 67
Jan 28 11:14:13 (myname) dhclient[27723]: send_packet: No route to host
5) My dhclient.leases.em1 file is not updated. My dhclient is unable to renew
its lease. As time goes on, dhclient makes more and more DHCPREQUESTs at
shorter and shorter intervals.
6) So, is this a bug in the dhclient implementation, or am I misunderstanding
something? Either way, it's not a big deal, I can just allow DHCP packets in
the firewall like I was doing until just recently.
Thanks,
Bohdan
For many years, I've read pf and dhcp related threads like, e.g.:
http://marc.info/?l=openbsd-misc&m=125907434809727&w=2
Some text from that post:
"dhcp packets are grabbed by dhclient or dhcpd before pf sees them."
My understanding, based on comments in a number of threads like that,
is that NO MATTER WHAT IS IN PF RULES, that dhcpd and dhclient should
both work fine. This is because dhcpd and dhclient both use bpf to
completely bypass pf.
However, I'm running OpenBSD 5.2 release, and I don't think dhclient
is able to renew its lease without pf cooperation. I recently tightened
up my pf rules, which is how I ran into this.
Here's what I see, based on tcpdump and daemon logs:
1) on startup, my dhclient negotiates with my ISP's dhcp server properly.
It makes a request, it gets a lease, as logged in /var/log/daemon:
Jan 27 02:55:00 (myname) dhclient[24372]: DHCPREQUEST on em1 to 255.255.255.255 port 67
Jan 27 02:55:00 (myname) dhclient[24372]: DHCPACK from 73.88.146.1 (00:1d:70:af:ec:e2)
Jan 27 02:55:00 (myname) dhclient[24372]: bound to 76.27.218.121 -- renewal in 116353 seconds.
2) this lease is properly recorded in my dhclient.leases.em1 file:
lease {
interface "em1";
fixed-address 76.27.218.121;
option subnet-mask 255.255.252.0;
option routers 76.27.216.1;
...
option broadcast-address 255.255.255.255;
option dhcp-lease-time 232706;
option dhcp-message-type 5;
option dhcp-server-identifier 76.96.95.6;
renew 1 2013/1/28 19:14:13;
...
}
3) but when it comes time to renew, my pf rules block outgoing UDP to port 67,
so the following is in pflog:
Jan 28 11:14:13.977566 rule 73/(match) block out on em1:
76.27.218.121.68 > 76.96.95.6.67: xid:0x2530b3a4 C:76.27.218.121
ether 00:07:e9:1a:37:6b [|bootp] [tos 0x10]
4) I see a corresponding message in /var/log/daemon:
Jan 28 11:14:13 (myname) dhclient[27723]: DHCPREQUEST on em1 to 76.96.95.6 port 67
Jan 28 11:14:13 (myname) dhclient[27723]: send_packet: No route to host
5) My dhclient.leases.em1 file is not updated. My dhclient is unable to renew
its lease. As time goes on, dhclient makes more and more DHCPREQUESTs at
shorter and shorter intervals.
6) So, is this a bug in the dhclient implementation, or am I misunderstanding
something? Either way, it's not a big deal, I can just allow DHCP packets in
the firewall like I was doing until just recently.
Thanks,
Bohdan