summaryrefslogtreecommitdiffstats
path: root/docs/features
blob: 3a7f3c3c46a8918e13123225fb622bbe2e28eeb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
% Netcfg feature documentation
% James Rayner
% 19/10/2009

## 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 on boot. Specify the profiles you want netcfg to start in the NETWORKS line in /etc/rc.conf. For example:

    NETWORKS=(home mywireless)
    
To run on boot, add 'net-profiles' to your DAEMONS line.

## 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:

1. Install core/wpa_actiond
2. In /etc/rc.conf set WIRELESS_INTERFACE to your wireless interface, eg: 

        WIRELESS_INTERFACE="wlan0" 
    
3. Run /etc/rc.d/net-auto-wireless start

To run on boot, add 'net-auto-wireles' to your DAEMONS line.

## 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 start daemon abc before connecting:

    PRE_UP="/etc/rc.d/abc start"
 
Or if you want to mount your network shares after a successful connection, you could use:

    POST_UP="sleep 5; mount /mnt/shares/desktop 2>/dev/null;"

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/rc.conf and ensure that net-profiles is in the DAEMONS array.

## Debugging

To run netcfg with debugging output, set the NETCFG_DEBUG environment variable to "yes", for example: 

    NETCFG_DEBUG="yes" netcfg <arguments>