Configuring Network Interfaces in FreeBSD

Jul 19, 2023 • FreeBSDSoftware

Do you remember our introductory guide on networking in FreeBSD? Today, we delve deeper into configuring network interfaces on FreeBSD. As an integral part of making a FreeBSD system connect to a network, we consider this skill crucial for a system administrator.

Fundamental Concepts

Let’s start by refreshing your understanding of basic networking concepts. A ‘network interface’ refers to software that allows communication between your FreeBSD system and other devices within the network. This might be an Ethernet, wireless, or loopback device. Configuration then, entails setting the parameters that guide the interface’s operation.

Configuring Interfaces at Boot Time

By default, FreeBSD uses the rc.conf file located within the /etc directory for system configuration at boot time. Network interfaces are no exception to this rule. To specify an IP address for an interface named em0, you would use the following syntax in the rc.conf file:

ifconfig_em0="inet netmask"

Here, em0 is the interface name, ‘inet’ indicates the use of the Internet protocol (IPv4). The IP address assigned to the interface is The netmask keyword specifies the subnet mask (, in this case).

It’s worth mentioning that while saving changes to the rc.conf file, ensure to have a backup for emergency cases and for disaster recovery.

Dynamic Host Configuration Protocol (DHCP)

DHCP is a popular choice for those who wish to automate the configuration of network interfaces. If your network has a DHCP server, it can assign IP addresses dynamically. For enabling a DHCP client on an interface named em0, add this line to your rc.conf file:


For detailed information on common system administration issues revolving around DHCP, check out the related article on our blog.

Wireless Interfaces

Wireless interfaces might require a bit more work to configure correctly. Below is an example of how to set up a wireless interface (wlan0) using WPA2 security.

ifconfig_wlan0="WPA SYNCDHCP"

Remember, you need to replace ath0 with the name of your actual wireless device. Configuring wireless interfaces can be challenging, and if you have any difficulties, our article about FreeBSD network configuration troubleshooting might help.

Static Routes

Static routes are an essential part of network configuration, particularly in larger networks. To set up a static route, use the static_routes and route_<name> syntax in the rc.conf file. We have a comprehensive guide on optimizing your system in FreeBSD, which covers static routes more deeply.


We have barely scratched the surface of what you can do when configuring network interfaces on FreeBSD. For more complex configurations, consider looking into options like bridges, VLANs, and IP aliasing. Remember to check our articles on common FreeBSD errors and solutions and managing services and daemons in FreeBSD for additional assistance with system administration. You might also consider implementing security measures with FreeBSD firewalls, which help safeguard your network from threats.

Meanwhile, your feedback is invaluable to us. Whether you’re grappling with user group management or venturing into FreeBSD virtualization techniques, feel free to share your experience or ask for help. Your journey in mastering FreeBSD system administration is a shared adventure. Happy networking!

Checkout these related ports: