News
Happy System Administrator Appreciation Day - to the true heroes of IT!
Serverspace Black Friday
WB
William Bell
May 1 2020
Updated August 4 2025

How to configure network adapter in FreeBSD | Step-by-step

FreeBSD Networks VPS

Using another OS?

Select the desired version or distribution.

This guide explains how to configure network interfaces and connect a virtual server running the FreeBSD operating system.

Configuring Interface

To display the configuration for the network interfaces on your system, enter the following command:

ifconfig
vmx0:
flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=60039b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,TSO6,RXCSUM_IPV6,TXCSUM_IPV6>
ether 00:50:56:02:0a:65
inet 45.XXX.XXX.XXX netmask 0xffffff00 broadcast 45.XXX.XXX.255
media: Ethernet autoselect
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
vmx1:
flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=60039b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,TSO6,RXCSUM_IPV6,TXCSUM_IPV6>
ether 00:50:56:02:0c:98
media: Ethernet autoselect
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
lo0:
flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet 127.0.0.1 netmask 0xff000000
groups: lo
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

The output of the command shows, that the vmx0 interface is configured and ready (<up,broadcast,running,simplex,multicast>), which means that you need to configure the em0 interface to work on a private network.

Note: The lo0 interface: The loopback device.

All following actions are performed in superuser mode.

Configuring a network connection without DHCP

Use a text editor such as vi to open the file /etc/rc.conf:

vi /etc/rc.conf

Add the command line with correct parameters:

ifconfig_<interface name>="inet <local IP> netmask <mask>"

For example:

ifconfig_em0="inet 10.0.1.2 netmask 255.255.255.0"

The local IP value can be found in the control panel, Networks section:

Screenshot 1: ServerSpace control panel

 

Sample of the file contents: /etc/rc.conf.

clear_tmp_enable="YES"
sshd_enable="YES"
ntpd_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
zfs_enable="YES"
hostname="freebsd12"
ifconfig_vmx0="inet 45.XXX.XXX.XXX netmask 255.255.255.0"
ifconfig_em0="inet 10.0.1.2 netmask 255.255.255.0"
defaultrouter="45.XXX.XXX.1"

After making changes to the file, be sure to reboot the server using the OS to apply the new settings.

Configuring a network connection with DHCP

If the DHCP function has been enabled when creating a network, make sure Obtain an IP address automatically is selected. This can be done using the following command, specifying the interface name:

dhclient <interface>

For example:

dhclient vmx1
DHCPDISCOVER on vmx1 to 255.255.255.255 port 67 interval 7
DHCPOFFER from 10.0.1.1
DHCPREQUEST on vmx1 to 255.255.255.255 port 67
DHCPACK from 10.0.1.1
bound to 10.0.1.2 -- renewal in 3600 seconds.

Conclusion

Configuring a network interface in FreeBSD is a critical step when setting up a virtual server. This guide demonstrated how to inspect network adapters using ifconfig, and how to configure them either statically via /etc/rc.conf or dynamically using DHCP with dhclient. By correctly assigning IP addresses and netmasks, you ensure that your FreeBSD server is accessible within both public and private networks.

Whether you're deploying a VPS, setting up internal infrastructure, or configuring routing, understanding how FreeBSD handles network interfaces gives you greater control over system behavior, connectivity, and overall performance. After completing these steps, your server should be fully network-ready and properly integrated into your environment.

FAQ

  • How do I check available network interfaces in FreeBSD?
    Use the ifconfig command. It lists all available interfaces along with their current status and configuration.
  • What is the purpose of the lo0 interface?
    lo0 is the loopback interface. It's used for internal communication within the system (localhost/127.0.0.1).
  • When should I use static IP vs DHCP in FreeBSD?
    Use a static IP when you need a persistent address for server accessibility. DHCP is useful in dynamic or cloud environments where IP addresses are managed automatically.
  • Where do I configure a static IP in FreeBSD?
    Edit the /etc/rc.conf file and add a line like:
    ifconfig_em0="inet 10.0.1.2 netmask 255.255.255.0"
  • How can I apply network changes after editing rc.conf?
    Reboot the server or restart networking services to apply the changes.
  • What if dhclient doesn't obtain an IP address?
    Ensure that DHCP is enabled on the corresponding network and that the correct interface name is specified.
Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
33145 North Miami, FL 2520 Coral Way apt 2-135
+1 302 425-97-76
700 300
ITGLOBAL.COM CORP
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.