Networking NetBSD's network configuration is small and explicit: an interface is configured with ifconfig, an address can come from DHCP, and the routes and the resolver are plain files. Makronix's installer writes the files for the network you chose; this chapter is for changing them later. Interfaces and addresses $ ifconfig -a $ netstat -rn $ cat /etc/resolv.conf The name of an interface is the driver's: wm0 for an Intel Ethernet, re0 for a Realtek, ath0 or urtwn0 for Wi-Fi, lo0 for the loopback. An address from DHCP is requested by dhcpcd8: # dhcpcd wm0 # /etc/rc.d/dhcpcd restart The service reads /etc/rc.conf; with dhcpcd=YES it configures every interface that is not configured by a fixed file at boot. A fixed address A machine that should have the same address every time does not need DHCP. The address belongs in /etc/ifconfig.interface: inet 192.168.1.20/24 The default route is /etc/mygate: 192.168.1.1 and the resolver is /etc/resolv.conf: nameserver 192.168.1.1 nameserver 9.9.9.9 Set dhcpcd=NO for that interface, or leave the service off entirely. The name of the machine is in /etc/myname; the local names are in /etc/hosts: 127.0.0.1 localhost 192.168.1.20 studio.example studio Wi-Fi A Wi-Fi interface needs its network and passphrase before DHCP can run. wpa_passphrase8 writes the configuration: # wpa_passphrase "network-name" "the passphrase" > /etc/wpa_supplicant.conf # chmod 600 /etc/wpa_supplicant.conf # ifconfig ath0 up # wpa_supplicant -B -i ath0 -c /etc/wpa_supplicant.conf # dhcpcd ath0 The service configuration is: wpa_supplicant=YES wpa_supplicant_flags="-B -i ath0 -c /etc/wpa_supplicant.conf" dhcpcd=YES The MCDE System Settings network pane lists the networks in reach and asks for the passphrase; it writes the same files. A USB Wi-Fi adapter is a second interface with its own name; use that name in the commands above. Testing $ ping -c 3 192.168.1.1 $ ping -c 3 www.NetBSD.org $ route -n get default $ netstat -an | grep LISTEN If the first ping works and the second does not, the address and the route are fine and the resolver or the uplink is not. If neither works, the interface is down or the cable is not in the right port. dmesg names the interface the driver found, and ifconfig shows whether it has an address.