Netcfg Features --------------- Network Profile management ~~~~~~~~~~~~~~~~~~~~~~~~~~ netcfg is profile based. Each network has an individual profile. These profiles can be individually connected/disconnected at any time. The profile configuration varies depending on whether it's a wireless, ethernet (wired) or other type of connection. The available options are documented on the netcfg website and in the included examples. The installed and available connection types can be seen at '/usr/lib/network/connections/' To connect to a profile called `mynetwork' which would be located at '/etc/network.d/mynetwork', you may run: ---------------- netcfg mynetwork ---------------- To disconnect from the same profile you could run one of: --------------------- netcfg -d mynetwork netcfg down mynetwork --------------------- To reconnect: ------------------- netcfg -r mynetwork ------------------- For more options, see ''netcfg help'' Start a specific list of profiles on boot ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net-profiles allows you to start some profiles at boot time. Specify the profiles you want netcfg to start (in the order you want them to be started) in the +NETWORKS+ line in '/etc/conf.d/netcfg'. Prefix a profile with a `@' to start it in the background. For example: -------------------------------- NETWORKS=(@adsl @mywireless lan) -------------------------------- Alternatively, you can have netcfg restart the profiles you had running at the previous shutdown by specifying +NETWORKS=(last)+. Next, enable the `netcfg' systemd service or, on legacy systems, add `net-profiles' to +DAEMONS+ in '/etc/rc.conf'. Wireless automatic connection and roaming support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Through the use of wpa_actiond which calls commands on a wpa_supplicant event, netcfg now has automatic connection and roaming support. To use this: . Install core/wpa_actiond . In '/etc/conf.d/netcfg' set +WIRELESS_INTERFACE+ to your wireless interface, eg: + --------------------------- WIRELESS_INTERFACE="wlan0" --------------------------- . Run `systemctl start net-auto-wireless` To run on boot, enable the `net-auto-wireless' systemd service. Per interface configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Configuration that applies to all profiles using an interface can be set at '/etc/network.d/interfaces/$INTERFACE'. For example: ------------------------------ /etc/network.d/interfaces/eth0 ------------------------------ This is useful for wpa_supplicant options, radio kill switch support, pre/post up/down scripts and net-auto-wireless. It is loaded before a profile is loaded so that any profile based options will take priority. Execute commands before/after interface up/down ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If your interface requires special actions prior/after the establishment/closure of a connection, you may use the +PRE_UP+, POST_UP, +PRE_DOWN+, +POST_DOWN+ properties. For example, if you want to run a script before connecting: ------------------------ PRE_UP="/path/to/script" ------------------------ Or if you want to manage resolv.conf through resolvconf, you could remove any DNS related options and use the following, which will be run after a successful connection: ---------------------------------------------------------------- POST_UP='echo "nameserver 8.8.8.8" | resolvconf -a "$INTERFACE"' ---------------------------------------------------------------- If the commands specified in these properties return anything other than 0 (success), netcfg aborts the current operation. If you command might fail, create a separate bash script with an "exit 0;" at the end. Alternatively you may add "|| true" to the end of the command that may fail. Output Hooks ~~~~~~~~~~~~ netcfg has limited support to load hooks that handle output. By default it loads the "arch" hook which provides the familiar output that you see. A syslog logging hook is also included. These can be found at '/usr/lib/network/hooks/' Menu based profile selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You may select a profile to connect to from a menu. This requires the 'dialog' package installed. To display a menu, simply run `netcfg-menu`. If you wish to have a menu on boot, set +NETWORKS=(menu)+ in your '/etc/conf.d/netcfg' and ensure that `net-profiles' is in the +DAEMONS+ array. A boot-time menu is not supported on systemd installations. Menu based wireless network selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can also connect to a wireless network using a menu. To display the menu, run `wifi-menu [-o] [interface]`. The _interface_ defaults to the +WIRELESS_INTERFACE+ from '/etc/conf.d/netcfg'. When `-o' is specified, passwords are obscured (ie masked and saved in hexadecimal form). The tool generates a profile file if no suitable profile was found. Debugging ~~~~~~~~~ To run netcfg with debugging output, set the NETCFG_DEBUG environment variable to "yes", for example: ------------------------------------- NETCFG_DEBUG="yes" netcfg -------------------------------------