5. Network Configuration

Instead of a generic ethX identifier that Linux® uses to identify a network interface, FreeBSD uses the driver name followed by a number. The following output from ifconfig(8) shows two Intel® Pro 1000 network interfaces (em0 and em1):

% ifconfig
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        options=b<RXCSUM,TXCSUM,VLAN_MTU>
        inet 10.10.10.100 netmask 0xffffff00 broadcast 10.10.10.255
        ether 00:50:56:a7:70:b2
        media: Ethernet autoselect (1000baseTX <full-duplex>)
        status: active
em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        options=b<RXCSUM,TXCSUM,VLAN_MTU>
        inet 192.168.10.222 netmask 0xffffff00 broadcast 192.168.10.255
        ether 00:50:56:a7:03:2b
        media: Ethernet autoselect (1000baseTX <full-duplex>)
        status: active

An IP address can be assigned to an interface using ifconfig(8). To remain persistent across reboots, the IP configuration must be included in /etc/rc.conf. The following /etc/rc.conf entries specify the hostname, IP address, and default gateway:

hostname="server1.example.com"
ifconfig_em0="inet 10.10.10.100 netmask 255.255.255.0"
defaultrouter="10.10.10.1"

Use the following entries to instead configure an interface for DHCP:

hostname="server1.example.com"
ifconfig_em0="DHCP"

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.