Contents

Preparation

In the simplest cases, users must at least know the name of their network interface(s) (e.g. eth0, wlan0). If configuring a static IP address, the IP addresses of the default gateway and name server(s) must also be known.

If connecting to a wireless network, have some basic information ready. For a wireless network this includes what type of security is used, the network name (ESSID), and any passphrase or encryption keys. Additionally, ensure the proper drivers and firmware are installed for the wireless device, as described in Wireless Setup.

Users wanting Bash completion support for netcfg, install the bash-completion package from the official repositories.

Configuration

Network profiles are stored in /etc/network.d/. To minimize the potential for errors, copy an example configuration from /etc/network.d/examples/ to /etc/network.d/mynetwork. The file name is the name of the network profile, and mynetwork is used as an example throughout this article.

Depending on the connection type and security, use one of the following examples from /etc/network.d/examples/ as a base.

Warning: Be wary of examples found on the internet as they often contain deprecated options that may cause problems!

Set INTERFACE to the correct wireless or Ethernet interface. This can be checked with ip link and iwconfig.

Ensure the ESSID and KEY (passphrase) are set correctly for wireless connections. Typos in these fields are common errors.

Note that WEP string keys (not hex keys) must be specified with a leading s: (e.g. KEY="s:somepasskey").

Note: Netcfg configurations are valid Bash scripts. Any configuration involving special characters such as $ or \ needs to be quoted correctly otherwise it will be interpreted by Bash. To avoid interpretation, use single quotes or backslash escape characters where appropriate.

Note: Network information (e.g. wireless passkey) will be stored in plain text format, so users may want to change the permissions on the newly created profile (e.g. chmod 0600 /etc/network.d/mynetwork) to make it readable by root only.

Note: For WPA-Personal, it is also possible to encode the WPA passkey into a hexadecimal string. Save the new hexadecimal string into the wireless WPA profile in /etc/network.d/mynetwork as the value of the KEY variable (make sure this will be the only KEY variable enabled), to look similar to this: KEY='7b271c9a7c8a6ac07d12403a1f0792d7d92b5957ff8dfd56481ced43ec6a6515'. That should disable the need to reveal the passkey.

Manual Operation

To connect a profile:

# netcfg mynetwork

To disconnect a profile:

# netcfg down mynetwork

If successful, users can configure netcfg to connect automatically or during boot. If the connection fails, see Netcfg Troubleshooting for solutions and for how to ask for help.

Tip: Access the menu at any time by running netcfg-menu in a terminal.

Net-Auto-Wireless

This allows users to automatically connect to wireless networks with proper roaming support. To use this feature, the wpa_actiond package is required. Note that wireless-wpa-config profiles do not work with net-auto-wireless. Convert them to wireless-wpa-configsection instead.

Specify the desired wireless interface with the WIRELESS_INTERFACE variable in /etc/conf.d/netcfg or define a list of wireless networks that should be automatically connected with the AUTO_PROFILES variable in /etc/conf.d/netcfg.

Note: If AUTO_PROFILES is not set, all wireless networks will be tried.

Enable the net-auto-wireless.service so systemd manages it.

# systemctl enable net-auto-wireless.service

Net-Auto-Wired

This allows users to automatically connect to wired networks. To use this feature, the ifplugd package is required.

Specify the desired wired interface with the WIRED_INTERFACE variable in /etc/conf.d/netcfg.

Enable the net-auto-wired.service so systemd manages it.

# systemctl enable net-auto-wired.service

The daemon starts an ifplugd process which runs /etc/ifplugd/netcfg.action when the status of the wired interface changes (e.g. a cable is plugged in or unplugged). On plugging in a cable, attempts are made to start any profiles with CONNECTION = "ethernet" or "ethernet-iproute" and INTERFACE = WIRED_INTERFACE until one of them succeeds.

Note: DHCP profiles are tried before static ones, which could lead to undesired results in some cases. However, one can tell netcfg to prefer a particular interface by adding AUTO_WIRED=1 to the desired profile.