WiFiHowto

Differences between revisions 1 and 2
Revision 1 as of 2005-05-28 20:23:17
Size: 12935
Editor: adsl-213-190-44-43
Comment: imported from the old wiki
Revision 2 as of 2005-07-17 07:21:51
Size: 12918
Editor: S0106000000cc07fc
Comment: remove double title
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= WiFiHowto =

Wi-Fi WLAN wireless networking information

Getting Started

Obviously before you set up the wireless card on your computer you will need to become familiar with the basics of wireless and set up your wireless Router/Access Point. A good place to start is with the router documentation which often has a introduction to Wi-Fi. You will also probably have to look at the documentation to set up the Router. You may want to have a look at [http://en.wikipedia.org/wiki/WiFi the Wi-Fi entry on Wikipedia] or [http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Linux.Wireless.Overview.html the technology overview of the Linux Wlan HOWTO] however these are both a bit technical, it would be good if someone could find a simple newbie document and add it here.

First thing you'll need to do is get the [http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html wireless-tools] package (see SynapticHowto).

Some Wi-Fi Cards work out of the box, specifically the ones with the Orinoko, Prism2 or Atheros chipsets. If your card does not work out of the box, [SetupNdiswrapperHowto]. Some prism cards may not work out of the box however.

Set up your Wireless Router as an 'open' network. I.e. Turn off all security such as WAP in Mac Address restriction. However you should set your Network Name (ESSID) in your Router.

Using Graphical User Interface Tools

To see if your card is working goto Computer->System Configuration->Networking and see if your wireless network card is listed. Usually your wireless card is named wlan0 or ath0, depending on your chipset and the driver you are using. To determine what your wireless network card interface is called, you have to type iwconfig in a terminal (open up a Terminal Window by clicking Applications->System Tools->Terminal). If your card does not appear it has not been recognised either as the chipset needs additonal support from something like the [SetupNdiswrapperHowto] mentioned previously.

The next step is configuring your Card. Select the wireless network card entry (wlan0 or ath0) in the Networking window to check that wireless is working and click on Properties. This is where you set your Network Name. Normaly Configuration can be left as Automatic (DHCP). Chances are you have set up your wireless router as a DHCP Server, if not do so (refer to Router documentation). Click on OK.

Select the eth0 network and click on Deactivate button (if you have one - basicaly deactivate all Networks). Then select wlan0 and click on the Activate button. You should end up with the checkbox under Active for wlan0 checked and the others not checked. You can now fire up a web browser and see if you can browse the web. Alternativly the best way of checking if you have a working internet connection is to use ping. ping simply checks if a domain exists. Type

ping google.com

and you should get a line periodicaly saying 'Unknown host' if your internet conection is down or a line every second of so telling you how long it took to reach the host. To test only the network in case the DNS is down, you can use ping with the -n option, but then you have to give it a numeric IP address. A simple to remember one is

ping -n 4.2.2.2

Using the command Line

If you can browse the web your card is set up and working. If not we can try doing it another way. Start a Terminal Window and type

ifconfig

This will list your networks. The standard network is normaly called eth0. Stop this network by typing

sudo ifdown eth0

do this for all networks except for 'lo'. then start your wireless network by typing

sudo ifup wlan0

Check this has worked by typing ifconfig and if all is well try browsing the Web/ping. If it is not try the following

iwconfig wlan0 mode managed
iwconfig wlan0 channel 11
iwconfig wlan0 essid networkname

mode managed is what you want if you are connecting to a wireless router. The channel and esidd will have to be set the same as your router.

You have your network working but it is an open/unsecure network. Refer to your Router documentation to find out how to set up a secure network. Eatch Network card (Either wired or wireless) has a unique number called a Mac Address. Most wireless routers allow you to restrict the Mac Addresses that can connect to them. To find out your Mac Address type

ifconfig wlan0

This is listed as the first line after !HWaddr.

Encryption

It is also good to set up encryption (we will use WEP encryption as it is well supported in Ubuntu) as Mac Address restricting can be circumnavigated. Firstly you will have to set up your router to use WEP encryption. This the rest of this paragraph is a bit vage as a different routers work slightly differently but should give you an idea. Refur to your router manual but WEP setup should be under something like wireless->security on the web interface of your router. Generaly you then enable WEP security and choose a key size. The bigger the better but the example here is using 64 bit (sometimes refured to as 40 bit) keys. Generely you can then type a Passphrase (a password but you should use a few words next to eatch other). Generaly you then click on something like Generate and several keys (normally 4) are created. One of them will be marked as the default key, this is the one we will use.

There is a field under Network Name (ESSID) in Computer->System Configuration->Networking->(wlan0) Properties. The idea is that you put your key here but I cant get it working. What I have manages to get working is typing

iwconfig wlan0 key FEFEFEFEFE

Where FEFEFEFEFE is the WEP key in Hexadecimal. Hexadecimel uses 0-F rather than 0-9 (This is base 16 with A representing 10 all the way up to F = 15 and then 10 representing 16.). This is the way all keys are specified. You should then be able to browse the web/ping. Not entirly sure but it seems sometimes you have to wait a minute or so for it to start working.

Adding it to /etc/network/interfaces

/etc/network/interfaces is the file where your network interfaces are defined, eth0 being the standard wired interface. To make the wireless network come up when you start your computer put # in front of 'auto eth0' (to stop it automaticaly starting) and add something like the following lines.

auto wlan0
iface wlan0 inet dhcp
name Wireless LAN card
wireless_essid   MYNETWOTK
wireless_key     FEFEFEFEFE
wireless_channel 11
wireless_mode    managed

I have written a small script to have my laptop automatically pick a WLAN network of several configured. It uses the wireless utils to scan for known/open networks on "ifup interface". The script wlan-scan.sh looks like this:

IFACE=$1

ip link set $IFACE up

SCAN=$( \
iwlist $IFACE scan 2>&1 | grep -v "^$IFACE" | grep -v "^$" | \
    sed -e "s/^\ *//" \
        -e "s/^Cell [0-9]\+ - /#/" \
        -e "s/^#Address: /#AP=/" \
        -e "s/^Quality:\([0-9]\+\)\/.*$/QUALITY=\1/" \
        -e "s/^.*Channel \([0-9]\+\).*$/CHANNEL=\1/" \
        -e "s/^ESSID:/ESSID=/" \
        -e "s/^Mode:/MODE=/" \
        -e "s/^Encryption key:/ENC=/" \
        -e "s/^[^#].*:.*//" | \
    tr "\n#" "|\n" \
)

ip link set $IFACE down

which=""
while read glob scheme; do
    AP=""; QUALITY=""; CHANNEL=""; ESSID=""; MODE=""; ENC=""
    for i in $SCAN ; do
        for j in $(echo $i | sed -e "s/|/ /g" ) ; do
            case $j in
                AP=*)
                    AP=${j#AP=}
                    ;;
                QUALITY=*)
                    QUALITY=${j#QUALITY=}
                    ;;
                CHANNEL=*)
                    CHANNEL=${j#CHANNEL=}
                    ;;
                ESSID=*)
                    ESSID=${j#ESSID=}
                    ;;
                MODE=*)
                    MODE=${j#MODE=}
                    ;;
                ENC=*)
                    ENC=${j#ENC=}
                    ;;
            esac
        done

        case "$AP,$ESSID,$ENC,$MODE,$CHANNEL" in
            $glob)
                echo $scheme
                exit 0
                ;;
        esac
    done
done

exit 1

and is used with the mapping primitive of the interfaces file.

Mine looks like this:

mapping wlan0

        script /path/to/wlan-scan.sh
        # Accesspoint,"ESSID",Encryption,Mode,Channel
        map 00:FE:FE:FE:00:00,"MY_NET",*,*,* wlan0-home
        map *,"COMPANY",on,Master,*          wlan0-office
        map *,*,off,Master,*                 wlan0-open

iface wlan0-home inet dhcp
        wireless-essid HOMENET
        wireless-mode managed
        wireless-enc FEFEFEFEFEFE

iface wlan0-office inet dhcp
        wireless-essid COMPANY
        wireless-mode managed
        wireless-enc s:Secret_password

# This is a fallback, selected for all unencrypted WLANs
iface wlan0-open inet dhcp
        wireless-essid ANY
        wireless-mode managed

Please report if this does not work for you (or if it does;-).

Wi-Fi roaming

Wi-Fi is most useful on a laptop. Taking your laptop everywhere also involves changing networks quite often. It is quite bothersome having to change this everytime you want to hook up to a different network.

To solve this a number of programs have been developped that automagically bring up your wireless network interface when a network has been detected. The older encryption method WEP has been superceded by WPA. For setting up WPA, see the the description of setting up wpa_supplicant in the WPAHowto. However wpa_supplicant still has issues with some drivers. Especially roaming between old WEP networks isn't well supported with wpa_supplicant, therefor has a look at the older [http://0pointer.de/lennart/projects/waproamd waproamd].

Some people might prefer a script to do network switching, have a look at:

Other people might prefer a GUI tool to do network switching though, have a look at:

Troubleshooting

See WiFiTroubleshooting.

Useful info


CategoryDocumentation: CategorySetup, CategoryNetworking

From JBBell Sat Apr 16 18:26:15 +0100 2005 From: J B Bell Date: Sat, 16 Apr 2005 18:26:15 +0100 Subject: WEP key Message-ID: <20050416182615+0100@https://www.ubuntulinux.org>

You can also use a text-based key if you prepend it with "s:", both in the graphical interface and in the /etc/networking files.

From SoniaHamilton Sat Apr 23 04:56:37 +0100 2005 From: Sonia Hamilton Date: Sat, 23 Apr 2005 04:56:37 +0100 Subject: May need to install linux-restricted-modules Message-ID: <20050423045637+0100@https://www.ubuntulinux.org>

You may need to install linux-restricted-modules-* to get wireless going (Atheros chipset, under Hoary)

From samtygier Tue May 17 16:05:01 +0100 2005 From: sam tygier Date: Tue, 17 May 2005 16:05:01 +0100 Subject: ip address 4.2.2.2 ? Message-ID: <20050517160501+0100@www.ubuntulinux.org>

whos ip address is this? do they mind being pinged, by people who want to check whether their dns is work? should we put the ip addess of the ubuntu homepage, or google or something else?

From WoutervanWijk Thu May 19 17:55:54 +0100 2005 From: Wouter van Wijk Date: Thu, 19 May 2005 17:55:54 +0100 Subject: gui key entry Message-ID: <20050519175554+0100@https://www.ubuntulinux.org>

I saw this about the gui wep-key entry (here http://www.ubuntulinux.org/support/documentation/faq/helpcenterfaq.2004-10-07.0031507315): One detail that was essential for me to get my laptop running on a Linksys WRT54G router: when you generate a WEP key that is 10 digits long (XXXXXXXXXX), you cannot just copy and paste this key into the WEP key field within the Network Settings dialogue. You must insert a dash after every fourth character, ie, XXXX-XXXX-XX. Once you do this, WEP encryption works fine.

WiFiHowto (last edited 2008-08-06 17:00:07 by localhost)