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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
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 this order) 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)
--------------------------------
Next, add `net-profiles' to your +DAEMONS+ line 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 `/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/conf.d/netcfg' and ensure that `net-profiles' is in the +DAEMONS+
array.
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 <arguments>
-------------------------------------
|