This page is a work-in-progress!

This page explains how to set up a wired and wireless connection to a network.

Wired

Static IP

A static IP address can be configured with most standard network managers. Independently of the tool you choose, you will probably need to be prepared with the following information:

  • Your desired static IP address
  • Subnet mask
  • Broadcast address
  • Gateway (router) IP address
  • Name server (DNS) IP address

Static IP configuration can either be done through dhcpcd and its configuration file /etc/dhcpcd.conf, or iproute commands in /etc/runit/rc.local (see below).

You can configure a static IP in /etc/dhcpcd.conf, for example:

interface enp3s0
static ip_address=192.168.0.42
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8

More complicated configurations are possible, for example combining with the arping option. See dhcpcd.conf(5) for details.

After that, enable the runit services for dhcpcd.

Alternatively, without dhcpcd, you can setup the network interface in /etc/rc.local by using the commands from the iproute2 package:

# Static IP configuration via iproute
ip link set enp3s0 eth0 up
ip addr add 192.168.1.2/24 brd + dev enp3s0
ip route add default via 192.168.1.1

Dynamic IP

Normally, dynamic IP configuration is handled by dhcpcd. To acquire a lease for any known interface, simply enable the dhcpcd runit service.

DHCP per interface

The default dhcpcd runit service works in all available network interfaces, but sometimes only a single interface needs to be setup. In that case, you can make modifications to existing dhcpcd runit service or make a new service, containing the same run file as the regular dhcpcd service.

To make a new service, simply copy the dhcpcd service to a new one.

# cp -r /etc/runit/sv/dhcpcd /etc/runit/sv/dhcpcd-enp3s0

Make a new conf file in the dhcpcd runit service directory (/etc/runit/sv/dhcpcd or the new service directory you made), the contents should be OPTS=interface, for example if your interface is enp3s0:

OPTS=enp3s0

You can restart the runit service for dhcpcd after setting up DHCP per interface.

Network managers

There are many solutions to choose from, but remember that all of them are mutually exclusive; you should not run two services simultaneously. The following table compares the different connection managers. Automatically handles wired connection means that there is at least one option for the user to simply start the daemon without creating a configuration file.

Connection managerAutomatically handles wired connectionOfficial GUIConsole toolsService directory
connmanYesNoconnmanctl/etc/runit/sv/connman
dhcpcdYesNodhcpcd/etc/runit/sv/dhcpcd
NetworkManagerYesYesnmcli,nmtui/etc/runit/sv/NetworkManager
wicdYesYeswicd-curses/etc/runit/sv/wicd

Wireless

wpa_supplicant (Manual)

You can use wpa_supplicant to handle wireless connection; it can handle multiple kinds of security against the APs: none, WEP, WPA-PSK (WPA Personal), WPA-EAP (WPA Enterprise) and more.

Copy the default wpa_supplicant configuration file in /usr/share/doc/wpa_supplicant/wpa_supplicant.conf and then edit it to suit your needs.

# cp /usr/share/doc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf

or if you want to make it per interface

# cp /usr/share/doc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant-<interface_name>.conf
Enabling interfaces

You will need to enable a wireless interface through which to connect to your wireless network. To view the available networks interfaces on your computer, run

$ ip link show

The command will give you the list of all available interfaces. Wireless interface should be named wlp3s0 by default, but check the command's output to corroborate this either way, just in case.

To enable your desired interface, run

# ip link set up <interface_name>
Setting up wireless connections

Use wpa_cli for interactive setup, or you can set it up manually by editing your configuration file.

Configuring runit services

The default wpa_supplicant runit service works with wlan0 interface with configruation file placed in /etc/wpa_supplicant/wpa_supplicant.conf, you will want to make modification to suit your needs. In that case, you can make modifications to existing wpa_supplicant runit service or make a new service, containing the same run file as the regular dhcpcd service.

To make a new service, simply copy the wpa_supplicant service to a new one.

# cp -r /etc/runit/sv/wpa_supplicant /etc/runit/sv/wpa_supplicant-wlp3s0

Make a new conf file in the wpa_supplicant runit service directory (/etc/runit/sv/wpa_supplicant or the new service directory you made), the contents should be like below, for example if your interface is wlp3s0 and you placed your configuration in /etc/wpa_supplicant/wpa_supplicant-wlp3s0.conf:

CONF_FILE=/etc/wpa_supplicant/wpa_supplicant-wlp3s0.conf
WPA_INTERFACE=wlp3s0
OPTS=-s

You can restart the runit service for wpa_supplicant after setting up the wireless interface.

Once association is complete, you must obtain an IP address, for example, using dhcpcd.

Using dhcpcd hooks

Instead of starting the wpa_supplicant service manually, you can enable the dhcpcd service, which has a hook to start wpa_supplicant, and use the wpa_cli command to see details of this AP connection.

# ln -s /usr/share/dhcpcd/hooks/10-wpa_supplicant /usr/lib/dhcpcd/dhcpcd-hooks

After enabling the hook, don't forget to restart dhcpcd.

Network manager (Automatic)

If you don't want to go through the hassle of setting up manually, you can use network manager instead.

There are many solutions to choose from, but remember that all of them are mutually exclusive; you should not run two services simultaneously. The following table compares the different connection managers.

Connection managerNetwork profiles supportRoaming (auto connect dropped or changed location)PPP support (e.g. 3G modem)Official GUIConsole toolsService directories
connmanYesYesYesNoconnmanctl/etc/runit/sv/connman
NetworkManagerYesYesNoYesnmcli,nmtui/etc/runit/sv/NetworkManager
wicdYesYesNoYeswicd-curses/etc/runit/sv/wicd
Wifi RadarYesYesNoYeswifi-radarN/A