Vous êtes sur la page 1sur 7

First thing you'll need to do is get the wireless-tools package (see SynapticHow

to). Since this document is about how to get (wireless) networking working, we n
eed an explaination here on how to install packages without a network connection
!
sudo apt-get install wireless-tools
You will then have to find what chipset your card is (this is the chips the manu
facturer uses, the make/model is of limited use as some manufactures use the sam
e chipset and they also change the chipset without changing the model number). T
o do this in a shell type:
lspci | grep Network
One of the lines will tell you what chipset you have. It will be listed as a Net
work Controller. If it says something like unknown device, then Google for it.
Some Wi-Fi Cards work out of the box, specifically the ones with the Orinoko, Pr
ism2 or Atheros chipsets (some Prism cards may not work out of the box).
*
For cards based on Ralink's RT2500 chipset, see WifiDocs/Driver/RalinkRT25
00.
*
For cards based on Rakink's RT61 chipset see [Rt61WirelessCardsHowTo], the
se show up as 'Network controller: Ralink Unknown device 0301' if you do lspci.
*
If you have a Centrino based laptop, it likely has an Intel ipw2200 based
card. It works out of the box but uses an ancient driver. See Luca_Linux's post
for a really good guide on getting the ipw2200 card setup (you may want to stop
before he takes you into the WPA portion of the setup). Some users have experien
ced problems with their wireless connections after upgrading to Hoary from Warty
with the Intel ipw2200 (prior to upgrade in Warty everything worked fine). The
following message on the mailing list is relevant: http://lists.ubuntu.com/archi
ves/ubuntu-users/2005-April/029837.html One user reported having to remove the m
odule and re-insert the driver once or twice before it can associate with the ac
cess point (on kernel linux-image-2.6.10-5-686).
*
For cards that do not work out of the box you can try WifiDocs/Driver/Ndis
wrapper.
To begin with you'll need to set your Wireless Router up as an 'open' network. T
his means you'll need to turn off all security such as WAP, WEP and Mac Address
restrictions. You'll be able to turn these back on later, we just want to make s
ure that they aren't causing any problems in the beginning.
You'll also need to give your network an ESSID. Most wireless routers have one s
et by default. Often it is "default", "linksys" "netgear" or some other generic
name.
iwconfig Before You Start
(optional, but not a bad idea) Ubuntu ships with a fantastic GUI network tool ca
lled network-admin. It can be run from a terminal but it is also readily availab
le under the system menu. (System)->(Administration)->(Networking). You can jump
right in and start poking around with network-admin, but its best to run iwconf
ig from a terminal first. Since linux names your wifi card based on the driver i
t uses (can somebody back that up?) we first need to figure out what your card i
s called. Bring up a terminal (Applications)->(System Tools)->(Terminal) and iss
ue the following command:
iwconfig
Your output should look like:
lo no wireless extensions.
eth0 no wireless extensions.
sit0 no wireless extensions.
wlan0 unassociated ESSID:off/any
Mode:Managed Channel=0 Access Point: 00:00:00:00:00:00
Bit Rate=0 kb/s Tx-Power:off
Retry:on RTS thr:off Fragment thr:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
If all devices listed say "no wireless extensions." then your wireless card is n
ot configured. You need to go back and get it setup. Please see the top of this
document and also WifiDocs/Driver/Ndiswrapper for more information. Alternativly
, the device may be disabled - you could try
sudo ifconfig wlan0 up
you may also try to wake-up the interface using the keyboard command (Dell)
Then try iwconfig again to see if the device is now recognised.
Based on the iwconfig output from above, we know that "wlan0" is our WiFi card's
linux device name. Knowing this you'll be able to use the Networking GUI tool t
o connect to your wireless router. (You may also see ath0 or even eth1 come up a
s your device name. Don't worry, that's totally fine, it just depends on the typ
e of card you have and the drivers that are accessing it.)
Sometimes there are two devices that appear: wlan0 and wifi0, even if there is o
ne card. This causes errors sometimes, like a tendency to not detect wireless ac
cess points. In certain configurations, this is caused by hostap_cs and hostap k
ernel modules. Check your dmesg output for errors around "wlan0". Place the appr
opriate excludes into /etc/modprobe.d/blacklist and reboot. An example workaroun
d the wlan0 for the "orinoco" wifi driver:
ubuntu-7.10# gksu echo "blacklist hostap" >> /etc/modprobe.d/blacklist-orinoco
ubuntu-7.10# gksu echo "blacklist hostap_ap" >> /etc/modprobe.d/blacklist-orinoc
o
Click on (System)->(Administration)->(Networking) and see if your wireless netwo
rk card is listed. If it isn't you've got a problem. (Somebody needs to describe
what to do next) <!-- Is it possible for wireless interface to be in kernel and
not be recognized by the GUI tool? If the tool is reliable we can reference use
r to troubleshooting a driver. -->
Using network-admin, the GUI Network Tool
As mentioned before Ubuntu ships with a fantastic GUI network tool called networ
k-admin. It can be run from a terminal but it is also readily available under th
e system menu. (System)->(Administration)->(Networking).
Once it is launched you'll be presented with a list of network adapters that are
available on your system. You should see an entry that named "Wireless connecti
on" and just beneath it it may say "The interface wlan0 is not active". Your set
up may not say "wlan0" however it should match the device name that we looked up
in iwconfig above.
Since your card is listed in network-admin you can easily setup the network conf
iguring. In network-admin select the Wireless connection entry and then click th
e Properties button.
This is where you actually specify the network to connect to. You should type th
e ESSID that you have assigned to your router into the box that says "Network Na
me (ESSID):". If we have disabled WEP at remote wireless router we can leave the
WEP Key field blank. Normally Configuration can be left as Automatic (DHCP). Ch
ances are you have set up your wireless router as a DHCP Server, if not do so (r
efer to Router documentation). Click on OK.
To test your new WiFi connection we should temporarily disable other network int
erfaces. Select the eth0 network and click on Deactivate button (if you have one
- basically deactivate all Network cards other than the WiFi). Then select wlan
0 (or whatever your wireless card is called) and click on the Activate button. Y
ou 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 we
b. Alternatively the best way of checking if you have a working internet connect
ion is to use ping which checks that a domain exists and can be reached (think S
ONAR ping, but for networks). Open a terminal and type:
ping -n 4.2.2.2 -c 4
This will send out 4 pings to the internet address 4.2.2.2.
Your output should look something like:
PING 4.2.2.2 (4.2.2.2) 56(84) bytes of data
64 bytes from from 4.2.2.2: icmp_seq=1 ttl=205 time={some value}
64 bytes from from 4.2.2.2: icmp_seq=2 ttl=205 time={some value}
64 bytes from from 4.2.2.2: icmp_seq=3 ttl=205 time={some value}
64 bytes from from 4.2.2.2: icmp_seq=4 ttl=205 time={some value}
If it doesn't and you get statements saying "Destination host unreachable" or "r
equest timed out", then you've got a problem and you aren't connected. (somebody
should write some instructions on what to do next). (Possibly see WifiDocs/Wire
lessTroubleShootingGuide and WifiDocs/WiFiTroubleshooting.)
If you do get the results listed above then you are able to ping an internet add
ress and your wireless card is working. Next you'll want to try a domain name. L
ets go with google:
ping google.com -c 4
Your output should look something like:
PING google.com (216.239.37.99) 56(84) bytes of data
64 bytes from from 216.239.37.99: icmp_seq=1 ttl=205 time={some value}
64 bytes from from 216.239.37.99: icmp_seq=2 ttl=205 time={some value}
64 bytes from from 216.239.37.99: icmp_seq=3 ttl=205 time={some value}
64 bytes from from 216.239.37.99: icmp_seq=4 ttl=205 time={some value}
If your first ping to 4.2.2.2 worked and your ping to google.com doesn't (ie: yo
u get "unknown host") then something is wrong with your DNS. (somebody needs to
describe what to do next).
If both pings work then you can be pretty sure that your network is running. Fir
e up your favorite web browser and surf off to your favorite site. Everything sh
ould be good.
Using the command Line
If you can browse the web your card is set up and working. If not we can try doi
ng it another way. Start a Terminal Window and type
ifconfig
This will list your network interfaces. The wired network interface is normally
called eth0. Stop this network by typing
sudo ifdown eth0
do this for all networks except for 'lo'. Then start your wireless network by ty
ping
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 ch
annel 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. Each Network ca
rd (either wired or wireless) has a unique number called a Mac Address. Most wir
eless 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 s
upported in Ubuntu) as Mac Address restricting can be circumnavigated. Firstly y
ou 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 sho
uld give you an idea. Refer to your router manual but WEP setup should be under
something like wireless->security on the web interface of your router. Generally
you then enable WEP security and choose a key size. The bigger the better but t
he example here is using 64 bit (sometimes referred to as 40 bit) keys. Generall
y you can then type a Passphrase (a password but you should use a few words next
to each other). Generally you then click on something like Generate and several
keys (normally 4) are created. One of them will be marked as the default key, t
his is the one we will use.
There is a field under Network Name (ESSID) in Computer->System Configuration->N
etworking->(wlan0) Properties. The idea is that you put your key here but I can'
t get it working. What I have managed to get working is typing
sudo 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 1
0 representing 16.). This is the way all keys are specified. You should then be
able to browse the web/ping. Not entirely sure but it seems sometimes you have t
o 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, e
th0 being the standard wired interface. To make the wireless network come up whe
n you start your computer put # in front of 'auto eth0' (to stop it automaticall
y starting) and add something like the following lines.
sudo nano -w /etc/network/interfaces
auto wlan0
iface wlan0 inet dhcp
wireless-essid MYNETWOTK
wireless-key FEFEFEFEFE
wireless-channel 11
wireless-mode managed
Automatic WLAN Picker Script
I have written a small script to have my laptop automatically pick a WLAN networ
k of several configured. It uses the wireless utils to scan for known/open netwo
rks 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;-).
Note: The iwlist scan command only works with certain chipsets and hence this sc
ript may not work for all wireless adaptors

Vous aimerez peut-être aussi