networking(7)

networking7

Quickstart guide to connecting to a network

Overview

In the following examples, it is assumed that we are connecting to Ethernet with the first interface found by the ix(4) driver, and Wi-Fi with the first interface found by the iwlwifi(4) driver, though your hardware will vary.

Examples

Example 1: Connecting to an Ethernet network with DHCP

Ask for a DHCP lease on the first Intel 10Gb Ethernet interface:

# dhclient ix0
Example 2: Connecting to a cellular network with USB tethering

Ask for a DHCP lease on the first USB tethering interface:

# dhclient ue0
Example 3: Connecting to a Wi-Fi network

Identify your Wi-Fi hardware:

% sysctl net.wlan.devices

Create the wlan0 interface with the first Intel Wi-Fi adapter:

# sysrc wlans_iwlwifi0="wlan0"

Set that interface to ask for a DHCP lease with wpa_supplicant(8):

# sysrc ifconfig_wlan0="WPA SYNCDHCP"

Enter the details of the Wi-Fi network:

# cd /etc/
# wpa_passphrase "myssid" "mypassphrase" >> wpa_supplicant.conf

Restart the Wi-Fi interface:

# service netif restart wlan0
Example 4: Scanning for Wi-Fi networks
% ifconfig wlan0 scan
Example 5: Airplane mode
# service netif stop wlan0

Caveats

Shell Special Characters in the SSID or passphrase will need to be escaped for wpa_passphrase(8), commonly using ‘\’. See the manual page for your shell for more details.

Stopping the network interface service also stops internal networking.

Releases

8 releases since FreeBSD 14.1-RELEASE; the text changed 3 times.

  1. 14.1
  2. 14.2
  3. 14.3–15.1
  4. 16.0

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.