Network Profiles (română)
From ArchWiki
Profilele de reţea (Network Profiles) constituie principala caracteristică a utilitarului netcfg. Conform ştirii netcfg v2 has replaced netcfg from initscripts s-a făcut migrarea la versiunea a doua a acestui utilitar. Această versiune păstrează compatibilitatea în caracteristici cu prima versiune, dar nu păstrează compatibilitatea în ceea ce priveşte configurarea. Acest articol tratează acest subiect: configurarea profilelor de reţea pentru utilitarul netcfg.
Contents |
Instalare netcfg v2
Pentru a instala pachetul netcfg se execută din linie de comandă următoarea linie:
# pacman -Sy core/netcfg
Pachetul cuprinde printre altele, pe lângă binare (netcfg-auto-wireless
, netcfg-menu
şi netcfg2
), şi o serie de exemple aflate în directorul etc/network.d/examples/
(vezi lista completă a fişierelor care alcătuiesc pachetul netcfg). Directorul /etc/network-profiles
a fost înlocuit cu directorul /etc/network.d
.
Connecting to a wireless network (short)
Copy one of the example profiles in /etc/network.d/examples to /etc/network.d/ and then adapt to your network.
Once adapted, you may connect with netcfg2 <profile name>
or add it to the NETWORKS=()
line in /etc/rc.conf for start on boot.
Connecting to a wireless network (detailed)
Gather information
- Wireless network interface
- Can be found with
ifconfig
or in/proc/net/wireless
- Can be found with
- Network Name/ESSID
- Check if the network is 'hidden' -- Does it appear when you run
iwlist scan
?
- Check if the network is 'hidden' -- Does it appear when you run
- What security system is in use
- Supported security mechanisms: None, WPA, and WEP.
- What security key
- Only needed if there's security on the network
- IP settings, dhcp/static
- Most wireless networks use dhcp. If in doubt, use dhcp.
Create profile
In /etc/network.d/ and create a new network profile. A profile, is a single file in /etc/network.d. The file name will become the name of the profile, and can be anything you wish, it is not a setting involved in the connection.
The easiest way to create a new profile, is to copy an existing one such as by copying one of the example profiles from /etc/network.d/examples that use a similar security setup.
Edit the profile, to contain the information you gathered earlier. For now, leave the scan option set to 'on'
Example configurations
Below are some example connection files. These are also available in /etc/network.d/examples.
CONNECTION="wireless" DESCRIPTION="A simple WEP encrypted wireless connection" INTERFACE=wlan0 SCAN="yes" SECURITY="wep" ESSID="MyNetwork" KEY="1234567890" IP="dhcp"
CONNECTION="wireless" INTERFACE=wlan0 SCAN="yes" SECURITY="wpa" ESSID="mynetwork" KEY="SomePasskey" IP="dhcp" TIMEOUT=20
For detailed static configuration, and further options, see the wireless(8) and ethernet(8) manual pages.
Connect
Now that the configuration is set you can just run, netcfg2 profile-name
to connect your network if it is available.
To have the network be connected on boot, add the profile-name to the NETWORKS=()
line in rc.conf, eg:
NETWORKS=(home)
. Ensure that net-profiles
is in your rc.conf DAEMONS=()
line.
If you cannot connect to the network, see if your problem is listed below. If you have further difficulties, follow the instructions below and seek help on the arch forums, IRC or mailing lists.
Automatic Detection
As of netcfg v2.0.3, netcfg has wireless network detection support. To detect on boot, add "auto-wireless <interface>" to your NETWORKS=() line. This can even be added among other profiles, for example:
NETWORKS=("auto-wireless <interface>" ipw0 ethernet)
To run after boot, run: /usr/bin/netcfg-auto-wireless $interface
Alternatively, for detection on boot, you may set SCAN="yes" in each profile, and add them to NETWORKS=() in /etc/rc.conf. This will check each network if it is available, and connect if it is, then ignore others.
Troubleshooting
What do I do if this doesnt work?
Check through all the FAQs below. If they do not contain a solution, the next best place to go is the forums, or the mailing list.
When you post, make sure that you provide the following output:
- ifconfig -a
- Any output from netcfg
- iwconfig before attempting to connect
- the /etc/network.d/ profile file with the wireless key replaced by <censored>
- lsmod
Rather than scripting a long post/email, the best place to put all this is a pastebin. Pastie and rafb|Nopaste are two popular ones within the Arch community. There is also a cli frontend for rafb:
pacman -S nopaste
ESSID not available, but my network is definitely accessible!
This happens when you enable SCAN= for a hidden network. Hidden networks cannot be scanned for. Set scan to off, and set timeout to something like 10 seconds. The timeout is how long it will try to connect to the network before giving up, and may need to be set higher if you have low reception.
Wireless Association failed
This is typically one of:
- Out of range
- Incorrect configuration
- Invalid key
- Driver problem
Try and eliminate these first. Sometimes increasing the TIMEOUT= can help deal with range or driver problems
Ralink legacy drivers rt2500, rt2400 that use iwpriv
I have no intention of supporting these. rt2x00 is supported however, and will replace these.
If you must use them, create a shell script that runs the needed iwpriv commands, and put it's path in PRE_UP=""
GUI
A netcfg2 frontend called ArchAssistant exists. It proposes to manage & connect/disconnect profiles from a systray icon. Automatic wireless detection is also available. This tool is particulary useful for laptop users.
Links: archassistant on AUR | archassistant on kde-apps.org | archassistant package on archlinuxfr
FAQ
Do I still need x when I'm using netcfg?
- /etc/hosts: Yes, you still need this, this is important. Don't remove your hostname from this otherwise you'll have some odd problems.
- HOSTNAME= in /etc/rc.conf: It's strongly reccomended you keep this, otherwise no hostname will be set if a profile fails
- DAEMONS=(network)/INTERFACES=() in /etc/rc.conf: If you've setup all your networks with netcfg2 instead, yes, you can remove this. You can also safely remove lo, it's been moved into rc.sysinit.
- lo: This is now in rc.sysinit, you don't need to confgure it anywhere.