Difference between revisions of "Netcfg"

From ArchWiki
Jump to: navigation, search
(GUI: Specified that ArchAssistant is Qt-based)
m (typos)
Line 73: Line 73:
  
 
==Troubleshooting==
 
==Troubleshooting==
===It doesnt work!! What's wrong?===
+
===It doesn't work!! What's wrong?===
Geez. That sucks doesnt it.
+
Geez. That sucks doesn't it.
  
===No really, it doesnt work, can you help?===
+
===No really, it doesn't work, can you help?===
 
See the below question. To be able to determine what's wrong, we need information! But first, try reading the rest of the troubleshooting section or search the forum.
 
See the below question. To be able to determine what's wrong, we need information! But first, try reading the rest of the troubleshooting section or search the forum.
  
===What do I do if this doesnt work?===
+
===What do I do if this doesn't 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.
 
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.
  
Line 110: Line 110:
 
==GUI==
 
==GUI==
  
A Qt-based 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.
+
A Qt-based 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 particularly useful for laptop users.
  
 
Links:
 
Links:
Line 126: Line 126:
 
But netcfg is super modular and re-usable. Have a look at /usr/lib/networks/ -- heaps of reusable functions for your own scripts.  
 
But netcfg is super modular and re-usable. Have a look at /usr/lib/networks/ -- heaps of reusable functions for your own scripts.  
  
===Why doesnt netcfg behave in this way? It makes more sense===
+
===Why doesn't netcfg behave in this way? It makes more sense===
 
netcfg doesn't enforce any rules. It's task is to connect to networks. It doesn't impose any heuristics, like 'disconnect from wireless if ethernet is connected'.
 
netcfg doesn't enforce any rules. It's task is to connect to networks. It doesn't impose any heuristics, like 'disconnect from wireless if ethernet is connected'.
  
Line 134: Line 134:
  
 
* /etc/hosts: Yes, you still need this, this is important. Don't remove your hostname from this otherwise you'll have some odd problems.  
 
* /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
+
* HOSTNAME= in /etc/rc.conf: It's strongly recommended 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.
 
* 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.
+
* lo: This is now in rc.sysinit, you don't need to configure it anywhere.

Revision as of 06:05, 6 April 2008

Install netcfg v2

pacman -Sy core/netcfg

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
  • Network Name/ESSID
    • Check if the network is 'hidden' -- Does it appear when you run iwlist scan?
  • 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

It doesn't work!! What's wrong?

Geez. That sucks doesn't it.

No really, it doesn't work, can you help?

See the below question. To be able to determine what's wrong, we need information! But first, try reading the rest of the troubleshooting section or search the forum.

What do I do if this doesn't 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:

  • ALL OUTPUT FROM netcfg - this one is important, even if netcfg appears to succeed
  • ifconfig -a
  • 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 the Arch pastebin, http://pastebin.archlinux.org

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 Qt-based 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 particularly useful for laptop users.

Links: archassistant on AUR | archassistant on kde-apps.org | archassistant package on archlinux.fr i686 and x86_64

FAQ

How do I get a menu at boot, like the old netcfg?

In rc.conf set NETWORKS=() to menu.

You can also access that menu any time by running netcfg-menu in a terminal

Why doesnt netcfg do x?

netcfg doesn't need to. It connects to networks.

But netcfg is super modular and re-usable. Have a look at /usr/lib/networks/ -- heaps of reusable functions for your own scripts.

Why doesn't netcfg behave in this way? It makes more sense

netcfg doesn't enforce any rules. It's task is to connect to networks. It doesn't impose any heuristics, like 'disconnect from wireless if ethernet is connected'.

If you want behaviour like that, it'd be really easy to write a separate tool over netcfg. See the question above.

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 recommended 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 configure it anywhere.