Configure networking

TODO: make this easier

Install one or more of the following packages:

Use ifconfig to view the list of available network interfaces.

Wired networking

It is recommended to install ifupdown and configure /etc/network/interfaces accordingly. See man interfaces for details.

To configure interfaces on boot, you need to instance the ifupdown templates for each network interface you wish to configure like so:

s6-instance ifupdown@lo0
s6-instance ifupdown@vioif0

Then add them to the dynamic network bundles:

touch /etc/s6/sources/bundle-if_ready/contents.d/ifupdown@lo0
touch /etc/s6/sources/bundle-if_ready/contents.d/ifupdown@vioif0

Finally sync the s6 repository and enable them:

s6 repo sync
s6 set enable ifupdown@lo0
s6 set enable ifupdown@vioif0
s6 set commit
s6 live install

To start the network immediately:

s6 live start bundle-if_ready

Example: static IPv4 w/ifupdown

auto lo0
iface lo0 inet loopback

auto vioif0
iface vioif0 inet static
    address 1.2.3.4/24
    gateway 1.2.3.1

Example: dynamic IPv4 w/ifupdown

Install dhcpcd.

auto lo0
iface lo0 inet loopback

auto vioif0
iface vioif0 inet dhcp

Wireless networking

Note: It is recommended to follow the “wired networking” section to configure the loopback interface (lo0) in addition to configuring your wireless interface.

For the common use (WiFi + DHCP), install wpa_supplicant and dhcpcd. Configure the init system to start up your wireless interfaces like so, first adding instances for the interface:

s6-instance if@urtwn0
s6-instance wpa@urtwn0
s6-instance dhcpcd@urtwn0

Add these instances to the appropriate network bundles:

touch /etc/s6/sources/bundle-if_up/contents.d/if@urtwn0
touch /etc/s6/sources/bundle-if_wlan/contents.d/wpa@urtwn0
touch /etc/s6/sources/bundle-if_ready/contents.d/dhcpcd@urtwn0

Finally sync the s6 repository and enable them:

s6 repo sync
s6 set enable if@urtwn0
s6 set enable wpa@urtwn0
s6 set enable dhcpcd@urtwn0
s6 live install

To start the network immediately:

s6 live start bundle-if_ready

Adding wireless networks

To scan for available networks:

wpa_cli scan
wpa_cli scan_results

To configure a network with WPA2:

wpa_passphrase 'SSID' | tee -a /etc/wpa_supplicant/wpa_supplicant.conf

Then restart wpa_supplicant:

s6 live restart wpa@urtwn0