PF Trying to Start Before DHCP

General questions about the FreeBSD operating system. Ask here if your question does not fit elsewhere.

PF Trying to Start Before DHCP

Postby APseudoUtopia » 12 Feb 2013, 14:27

Hey,

I have a FreeBSD box running as a router/gateway on my LAN. It gets its external IP from my ISP using DHCP. I use PF for my firewalling and routing setup.

When the system reboots, PF tries to start before DHCP gets a IP address. So PF fails to start with various errors. So my routing isn't setup for the LAN, and I have to manually [FILE]pfctl -f /etc/pf.conf[/FILE] in order to get my networking up again. Is there any way to fix this? See log below. Thanks!

Code: Select all
Feb 12 09:09:41 hostname kernel: Starting Network: lo0 em0 em1.
Feb 12 09:09:41 hostname kernel: lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
Feb 12 09:09:41 hostname kernel: options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
Feb 12 09:09:41 hostname kernel: inet 127.0.0.1 netmask 0xff000000
Feb 12 09:09:41 hostname kernel: em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
Feb 12 09:09:41 hostname kernel: options=4219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,VLAN_HWTSO>
Feb 12 09:09:41 hostname kernel: ether 2c:76:8a:ad:cb:34
Feb 12 09:09:41 hostname kernel: media: Ethernet autoselect
Feb 12 09:09:41 hostname kernel: status: no carrier
Feb 12 09:09:41 hostname kernel: em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
Feb 12 09:09:41 hostname kernel: options=4219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,VLAN_HWTSO>
Feb 12 09:09:41 hostname kernel: ether 2c:76:8a:ad:cb:35
Feb 12 09:09:41 hostname kernel: inet 10.0.0.1 netmask 0xff000000 broadcast 10.255.255.255
Feb 12 09:09:41 hostname kernel: media: Ethernet autoselect
Feb 12 09:09:41 hostname kernel: status: no carrier
Feb 12 09:09:41 hostname kernel: Starting devd.
Feb 12 09:09:41 hostname kernel: Configuring keyboard: keymap keyrate keybell.
Feb 12 09:09:41 hostname kernel: kldload: can't load ums: No such file or directory
Feb 12 09:09:41 hostname kernel: Starting pflog.
Feb 12 09:09:41 hostname kernel: Feb 12 09:09:31 pflogd[834]: [priv]: msg PRIV_OPEN_LOG received
Feb 12 09:09:41 hostname kernel: Enabling pfno IP address found for em0
Feb 12 09:09:41 hostname kernel: /etc/pf.conf:77: could not parse host specification
Feb 12 09:09:41 hostname kernel: no IP address found for em0
Feb 12 09:09:41 hostname kernel: /etc/pf.conf:103: could not parse host specification
Feb 12 09:09:41 hostname kernel: no IP address found for em0
Feb 12 09:09:41 hostname kernel: /etc/pf.conf:106: could not parse host specification
Feb 12 09:09:41 hostname kernel: no IP address found for em0

[Clipped a ton of these messages, all on different lines of [FILE]pf.conf[/FILE] where I reference [FILE]em0[/FILE]]

Feb 12 09:09:41 hostname kernel: Additional inet routing options: ignore ICMP redirect=YES log ICMP redirect=YES gateway=YES.
Feb 12 09:09:41 hostname kernel: Waiting 30s for the default route interface: ........(em0)
Feb 12 09:09:41 hostname kernel: Creating and/or trimming log files.
Feb 12 09:09:41 hostname kernel: Starting syslogd.
APseudoUtopia
Junior Member
 
Posts: 20
Joined: 16 Nov 2008, 16:35

Postby SirDice » 12 Feb 2013, 14:36

Try setting your interface to [FILE]SYNCDHCP[/FILE] instead of just [FILE]DHCP[/FILE].
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
User avatar
SirDice
Old Fart
 
Posts: 16195
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby DutchDaemon » 12 Feb 2013, 15:17

You can also experiment with raising these defaults to (artificially, if necessary) give DHCP time to "settle":
Code: Select all
defaultroute_delay="30"      # Time to wait for a default route on a DHCP interface.
defaultroute_carrier_delay="5"   # Time to wait for carrier while waiting for a default route.
User avatar
DutchDaemon
Old Fart
 
Posts: 10466
Joined: 16 Nov 2008, 20:17
Location: The Netherlands

Postby APseudoUtopia » 12 Feb 2013, 15:46

DHCPSYNC gave me an error:
[file]/etc/rc.conf[/file]:
Code: Select all
ifconfig_em0="DHCPSYNC"

[file]/var/log/messages[/file]:
Code: Select all
kernel: ifconfig: DHCPSYNC: bad value


I looked through [file]/etc/defaults/rc.conf[/file] and found [file]synchronous_dhclient[/file]. So I put that in my [file]/etc/rc.conf[/file] and set it to "YES" and everything worked!

Thanks!

EDIT
For any future people, this is on FreeBSD 9.1-RELEASE
APseudoUtopia
Junior Member
 
Posts: 20
Joined: 16 Nov 2008, 16:35

Postby wblock@ » 12 Feb 2013, 15:52

The value is [file]SYNCDHCP[/file]. It does the same thing as [file]synchronous_dhclient[/file], but does not need an extra entry in [file]rc.conf[/file].
User avatar
wblock@
Old Fart
 
Posts: 10212
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Postby SirDice » 12 Feb 2013, 15:55

APseudoUtopia wrote:DHCPSYNC gave me an error:

Sorry about that. I initially posted [FILE]DHCPSYNC[/FILE], checked it and figured it was wrong, it should have been [FILE]SYNCDHCP[/FILE]. I had changed my post but you probably read it before I corrected it.
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
User avatar
SirDice
Old Fart
 
Posts: 16195
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby APseudoUtopia » 12 Feb 2013, 15:59

wblock@ wrote:The value is [file]SYNCDHCP[/file]. It does the same thing as [file]synchronous_dhclient[/file], but does not need an extra entry in [file]rc.conf[/file].


Oops. I checked it twice to make sure. I guess my eyes were playing tricks on me.

Sorry for the formatting :-P

EDIT:
Ah ha! They weren't playing tricks on me :-P
APseudoUtopia
Junior Member
 
Posts: 20
Joined: 16 Nov 2008, 16:35


Return to General

Who is online

Users browsing this forum: No registered users and 2 guests