Understanding FreeBSD Network Initialization
Interface Configuration Model
FreeBSD does not use tools like NetworkManager or netplan. Instead, interfaces are defined declaratively in /etc/rc.conf. For example:
ifconfig_em0="inet 192.168.1.100 netmask 255.255.255.0" defaultrouter="192.168.1.1"
At boot, the /etc/rc.d/netif and /etc/rc.d/routing scripts initialize interfaces and routes based on this configuration.
Common Boot-Time Failure Symptoms
- Ping to the host fails after reboot
ifconfigshows interface present but no IPnetif restartfails silently or logs driver error- DHCP not requesting lease;
/var/db/dhclient.leasesis empty
Root Causes of Post-Reboot Network Failures
1. Interface Name Mismatch
FreeBSD versions after 12 use consistent device naming (e.g., em0, igb0, re0). If the network card changes or kernel modules differ, previously defined interface names may become invalid.
2. Missing or Corrupt rc.conf Entries
A typo, misquoted string, or missing ifconfig_IF key in /etc/rc.conf can prevent interface initialization without throwing a clear error.
3. Unloaded Kernel Module for Network Driver
PCI-based interfaces depend on driver modules. If loader.conf or rc.conf fails to load the correct module at boot, the interface won't appear.
4. DHCP Misconfiguration
When DHCP is used, the setting must be defined as:
ifconfig_em0="DHCP"
Missing quotes or incorrect case can prevent dhclient from initiating.
5. pf or ipfw Blocking Boot-Time Traffic
If packet filtering rules are loaded too early (before interface comes up), they may block DHCP or ARP requests, preventing IP assignment.
Diagnostics and Recovery Steps
Step 1: Boot into Single-User Mode
At boot loader prompt, type:
boot -s
Mount root read/write:
mount -u / mount -a
Step 2: Inspect rc.conf and Interface Names
cat /etc/rc.conf
ifconfig -a
Ensure the interface listed in rc.conf (e.g., em0) actually exists. If not, update to match output of ifconfig.
Step 3: Bring Interface Up Manually
ifconfig em0 up dhclient em0
Check for IP assignment. If successful, the configuration is likely incorrect or the boot sequence is misordered.
Step 4: Check for Driver Modules
kldstat pciconf -lv | grep -A4 network
Load missing module if required:
kldload if_re
Make it persistent by adding to /boot/loader.conf:
if_re_load="YES"
Step 5: Check Boot Logs and DHCP
less /var/log/messages
Look for dhclient output or interface initialization failures.
Best Practices for Preventing Interface Boot Failures
- Use
rc.confvalidation: quote values, avoid trailing spaces - Leverage
rcorder /etc/rc.d/*to understand init sequence - Always pin NIC driver modules in loader.conf
- Configure fallback IP via cron @reboot as safety net
- Use
hostname_ifsyntax for dynamic systems:
ifconfig_DEFAULT="DHCP"
Architectural Considerations for Remote or Production Servers
Use Serial Console or IPMI
Ensure servers have out-of-band access for recovery. FreeBSD supports serial consoles via boot.config and /etc/ttys.
Monitor Interface States via SNMP
Deploy SNMP or external monitoring to alert on link down, IP loss, or packet loss after reboot.
Immutable Configuration Snapshots
Use zfs snapshot or Git to version and rollback configuration files like rc.conf and loader.conf after patching or system upgrades.
Conclusion
Network interface failures on FreeBSD after a reboot are high-risk problems in production but almost always stem from configuration drift or driver mismatches. With no GUI or automated fallback, it's essential for system architects and administrators to build resilient recovery paths—including proper configuration management, boot validation, and out-of-band access. Treat /etc/rc.conf and interface naming as critical infrastructure components, and validate changes against real hardware interface names to maintain connectivity in all environments.
FAQs
1. How can I persist a working network config after manual fix?
Update /etc/rc.conf with the correct interface and IP settings and test with /etc/rc.d/netif restart.
2. What if my interface changes name across reboots?
Use devd or ifconfig_DEFAULT to assign configuration dynamically. Avoid relying on physical names only.
3. Can DHCP fail due to pf/ipfw rules?
Yes. If packet filter rules block port 67/68 or ARP, DHCP will silently fail. Always test firewall policies with boot-time interface up.
4. How do I check if a NIC driver is loaded?
Use pciconf -lv to identify the NIC, then check kldstat or dmesg for the driver module.
5. Can FreeBSD auto-detect and configure NICs like Linux?
Not by default. FreeBSD favors explicit configuration. However, bsdinstall or devd can help automate some interface behaviors.