Mastering FreeBSD network configuration: interfaces in rc.conf with ifconfig, routing with route, and resolv.conf for DNS. You will also learn advanced features like interface aliases, VLANs, lagg bonding, bridges, jumbo frames, and an introduction to the pf and ipfw firewalls.

In the previous episode 9, you went deep into advanced ZFS and replication. Now we turn to networking — the heart of FreeBSD performance and the source of its "The power to serve" reputation. FreeBSD configures networking through /etc/rc.conf and the ifconfig tool, not a Linux-style NetworkManager. This episode covers basic configuration, routing, DNS, then advanced features like VLANs, lagg, and bridges, plus an introduction to firewalls.
FreeBSD network interfaces are named after drivers, not physical positions: em0 (Intel), igb0, re0 (Realtek), vtnet0 (virtio), and vnet0. See what's available, because these names become the key to configuration in rc.conf:
ifconfig
ifconfig -aConfiguration is written using the pattern ifconfig_<interface>. For DHCP:
sysrc ifconfig_em0="DHCP"
service netif restartFor a static IP, write the address and netmask:
sysrc ifconfig_em0="inet 192.168.1.100 netmask 255.255.255.0"
service netif restartInfo
The variable name is always ifconfig_<interface> — for example ifconfig_em0. This is the signature FreeBSD pattern that gives every interface its own configuration in a single shared file.
The default gateway is set with the defaultrouter variable:
sysrc defaultrouter="192.168.1.1"
service routing restartView the routing table and add static routes. For routes that survive a reboot, write them in rc.conf:
route show
route add -net 10.0.0.0/24 192.168.1.254
sysrc static_routes="net1"
sysrc route_net1="-net 10.0.0.0/24 192.168.1.254"If the machine acts as a router, enable forwarding (covered fully in episode 11) with sysrc gateway_enable="YES" and sysctl net.inet.ip.forwarding=1.
Name resolution is managed in /etc/resolv.conf. If DHCP manages this file, entries are generated automatically; for static setups, write nameserver manually. Test with host or dig:
cat /etc/resolv.conf
host example.com
dig example.comWarning
If you edit /etc/resolv.conf manually on a DHCP interface, your changes can be overwritten at DHCP renew. Use resolvconf if available, or set the nameserver explicitly in rc.conf via the nameserver variable if you manage DNS yourself.
A single interface can hold multiple IP addresses (aliases):
sysrc ifconfig_em0_alias0="inet 192.168.1.200/24"
service netif restartVLANs divide one physical switch into several logical networks:
ifconfig vlan10 create
ifconfig vlan10 vlan 10 vlandev em0
ifconfig vlan10 inet 10.0.10.1/24To persist at boot, write it in rc.conf:
sysrc cloned_interfaces="vlan10"
sysrc ifconfig_vlan10="vlan 10 vlandev em0 inet 10.0.10.1/24"lagg combines multiple interfaces for redundancy or bandwidth:
sysrc cloned_interfaces="lagg0"
sysrc ifconfig_lagg0="laggproto failover laggport em0 laggport em1"
service netif restartA bridge connects multiple interfaces into a single layer-2 network — the foundation for VNET jails and bhyve (episodes 15-16):
sysrc cloned_interfaces="bridge0"
sysrc ifconfig_bridge0="addm em0 addm em1"Jumbo frames use MTU 9000 to reduce overhead:
sysrc ifconfig_em0="inet 192.168.1.100/24 mtu 9000"Info
Jumbo frames only provide benefits if the entire path — including switches and the cards at both ends — supports MTU 9000. A single inconsistent link causes fragmentation and performance problems instead.
FreeBSD offers two main packet filters: pf and ipfw. Both can handle firewall, NAT, and filtering:
pfctl -s infoA few commands you should memorize:
ifconfig em0
route show
ping -c 3 8.8.8.8
traceroute 8.8.8.8If ping to an IP succeeds but to a domain fails, the problem is DNS. If ping to the gateway fails, check the cable, switch, and IP.
In this episode 10, you mastered FreeBSD network configuration: interfaces in rc.conf with DHCP or static IPs, routing with defaultrouter and static routes, resolv.conf for DNS, and advanced features like aliases, VLANs, lagg, bridges, and jumbo frames. You also got acquainted with pf and ipfw.
Key takeaways:
ifconfig_<interface> in /etc/rc.conf.defaultrouter sets the default gateway; route show for inspection.cloned_interfaces.In the next episode, episode 11, we'll cover DHCP, DNS & network services — running a DHCP server, a local resolver with Unbound or BIND, time synchronization with ntpd, and assembling FreeBSD into a router or gateway with IP forwarding, pf NAT, and DHCP.