特殊:Badtitle/NS100:WifiDocs/Device/WG121

来自Ubuntu中文
Wikibot留言 | 贡献2008年10月19日 (日) 18:08的版本
跳到导航跳到搜索

{{#ifexist: :WifiDocs/Device/WG121/zh | | {{#ifexist: WifiDocs/Device/WG121/zh | | {{#ifeq: {{#titleparts:WifiDocs/Device/WG121|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:WifiDocs/Device/WG121|1|-1|}} | zh | | }}

WG121 HowTo

This page details the procedure to enable the Netgear WG121 USB Wireless Adapter to work on Ubuntu, the first section is a quickstart on Hardy Heron(8.04), this should also work on Gutsy Gibbon(7.10) also.. For earlier versions please use the second part of the guide..

Hardy Heron (8.04) & Gutsy Gibbon (7.10)

Okay with Hardy the whole process has been streamlined alot.. First step is to install Ubuntu, next is to reboot, (UNPLUG the adapter at this point) and put the install cd back in.. Go to System -> Administration -> Synaptic Package Manager (or Adept in Kubuntu). Install the build-essential & ndisgtk packages.. (And related dependencies) Find the driver cd, or ndis5 drivers from netgear.com and put it into the drive.. Go to System -> Administration -> Windows Wireless Drivers.. Hit install new driver, go to the driver cd and then into the /ndis5 folder and select the netwg121.inf file.. Now I plugged in the adapter at this point and nothing happened.. So I rebooted and it worked.. Hope this works for you, Alex Latchford

All Other Previous Versions

Note: To install on Feisty you will need to grab a newer copy of ndiswrapper, I am presuming this is a libc6 issue. I grabbed 1.37 but anything close to that should work. Go up to and including step 4, after modprobing ndiswrapper the new network manager took over for me, worked like a charm - Alex Latchford (20070226) Note: Ubuntu Feisty Fawn 7.04 requires additional drivers blacklisting (prism54usb and prism54common), plus i used version 1.38 of ndiswrapper instead of 1.16. Tested with Xubuntu and Kubuntu- Oimon Note: Gutsy Gibbon: This card will also work with this HowTo, however it does require the latest ndiswrapper source.. I used 1.51 which works a charm.. Also Step 5 should now be redundant as it should be picked up through the network-manager past step 4. - Alex Latchford (20071221)

Step 1 - Prerequisites

First thing, if you have the Adapter plugged in, please remove it until you are told to insert it. As this will cause problems later if left inserted. Second thing, this guide was originally written for Ubuntu and therefore contain Gnome Specific commands, however I am fairly confident that this will work on Kubuntu, Edubuntu and Xubuntu. A user with Xubuntu, has already been successful in following this guide. I'm presuming you will fall into the same sorts of errors. Just remember to change all gedit commands to: Kubuntu - kdesu and on Xubuntu - mousepad. Doing this should avoid those sorts of errors. In order to install the utilities needed for this card you will need a few other packages. Just run these commands, and all others displayed inside the dashed boxes in this HowTo, through the terminal

sudo apt-get update
sudo apt-get install build-essential

Alternatively if you do not have wired Internet access, (as you are using wireless), install these by downloading the packages manually and installing them by hand. You will also need to make a symbolic link from kernel sources directory to the modules directory, I do not really know why this is needed, but in the ndiswrapper documentation, (ndiswrapper being the package that we will using later), it says it is needed to suppress an error when compiling. Run the commands

sudo apt-get install linux-headers-`uname -r`
sudo ln -s /usr/src/linux-`uname -r` /lib/modules/`uname -r`/build

Step 2 - Removing existing drivers.

Ubuntu 6.10 (Edgy Eft) comes complete with a suite of drivers that are used to control Wireless Networking, however they dont really work for this card, so we are going to have to disable them. Run the command.

gksudo gedit /etc/modprobe.d/blacklist

This will open up your text editor. Scroll down to the bottom and add these lines to the end of the file.

blacklist islsm
blacklist islusb
blacklist islsm_usb
blacklist islsm_device
blacklist prism2_usb
blacklist islsm_pci
blacklist net2280

(Note: Not all of these drivers are 100% necessary in order to get the system to function, if you experience problems at a later date try removing the drivers; prism2_usb, islsm_pci & net2280) If you have Feisty Fawn 7.04 or greater then add

blacklist prism54usb
blacklist prism54common

This would probably be a good time to restart your system as these wont changes take effect until this has taken place.

Step 3 - Downloading and Compiling

In order to get the card working we will need to use the Windows Wireless Driver Emulator, ndiswrapper. I like to install all my programs through the /usr/src directory as it enables me to keep my Home folder clear of any unneeded code. So this is where we will install through. I am currently going to install version 1.16 of ndiswrapper, as this is the version I know is functioning correctly, you can try to use newer versions, but to me it seems like harder work, as 1.16 installs fine. Run the commands. Note: Feisty replace 1.16 with 1.38. Gutsy replace 1.16 with 1.51

cd /usr/src
sudo wget http://kent.dl.sourceforge.net/sourceforge/ndiswrapper/ndiswrapper-1.16.tar.gz
sudo tar -zxvf ndiswrapper-1.16.tar.gz
cd ndiswrapper-1.16

Ok, you should now have the package on your system, we are now going to compile it. Run the commands.

sudo make uninstall
sudo make
sudo make install

Now you should have a copy of ndiswrapper installed and working on your system. You can test this by running the command.

ndiswrapper -v

The expected output should be something like..

alex@alex-ubuntu:~$ ndiswrapper -v
utils version: 1.8
driver version:        1.16
vermagic:       2.6.17-10-generic SMP mod_unload 586 REGPARM gcc-4.1

Step 4 - Installing the Adapter

Ok, the next step is to install the drivers for the card so it is actually functioning and can be detected. First, insert the cd that came with the adapter in a CD Drive, open up the cd and copy across the folder called ndis5/ to your home folder. According to the installation guide for ndiswrapper this is needed as it will not install through the cd. Once that is done, Run the commands.

cd ~/ndis5
sudo ndiswrapper -i netwg121.inf
ndiswrapper -l

You should now see that your card is installed. Now you can insert the adapter into a USB Port and then run the command again. ndiswrapper -l), you should now see.

alex@alex-ubuntu:~$ ndiswrapper -l
Installed drivers:
netwg121                driver installed, hardware present 

You will also need to load the ndiswrapper module. You can do this by running the commands.

sudo depmod -a
sudo modprobe ndiswrapper

You can check the system log, (System->Administration->System Log), to make sure that the driver was loaded successfully. It should say something like this.

ndiswrapper version 1.16 loaded (preempt=no,smp=yes)
ndiswrapper: driver netwg121 (NETGEAR, Inc.,11/13/2003, 1.0.5.1000) loaded
wlan0: vendor: 'NETGEAR WG121 802.11g Wireless USB2.0 Adapter'
wlan0: ndiswrapper ethernet device 00:09:5b:d2:6d:72 using driver netwg121, 0846:4210.F.conf
wlan0: encryption modes supported: WEP; TKIP with WPA; AES/CCMP with WPA
usbcore: registered new driver ndiswrapper

Step 5 - Configuring the Adapter

Note: If you are running Feisty Fawn 7.04 or greater then you should be able to use the network-manager to manage the wireless connection now, left-click the icon in the system tray (top-right), it should now present you with a list of available networks, Please then proceed to step 6. If this is not the case then follow this step. Ok, getting close to the end now. First run the command,

iwconfig

This will list all the available network connections, testing them to see if they are suitable for wireless activity. You should see something like this.

alex@alex-ubuntu:~$ iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

eth1      no wireless extensions.

sit0      no wireless extensions.

eth2      IEEE 802.11g  ESSID: off/any  
          Mode:Auto  Frequency:2.462 GHz  Access Point: None
          Bit Rate:54 Mb/s   
          RTS thr:2432 B   Fragment thr:2432 B   
          Power Management:off
          Link Quality:100/100  Signal level:0 dBm  Noise level:0 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

The wireless connection on my setup is through eth2, but it could be through eth1, eth3 or even wlan0. (wlan0 is probably the most common, but ethX works fine too). Note: If no connections have come up, take a look in the /var/syslog file, (after unplugging and re-plugging in the adapter), it should attempt to start up the card, it might state that it is has deactivated the adapter after the "ESSID could not be set to ' '". I solved this issue by manually putting in the ESSID (network name), myself. To do this run the command.

sudo iwconfig eth2 ESSID LATCHFORD

Next step to to scan and try to find some networks. Run the command.

iwlist eth2 scan

(Obviously changing eth2 to whatever your connection is.) You should get a reply back with your Wireless Network, it should look a little like this.

alex@alex-ubuntu:~$ iwlist eth2 scan
eth2      Scan completed :
          Cell 01 - Address: 00:09:5B:C4:B2:E6
                    ESSID:"LATCHFORD"
                    Protocol:IEEE 802.11b
                    Mode:Managed
                    Frequency:2.462 GHz (Channel 11)
                    Quality:0/100  Signal level:-36 dBm  Noise level:-256 dBm
                    Encryption key:off
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
                              48 Mb/s; 54 Mb/s
                    Extra:bcn_int=100
                    Extra:atim=1

Now you need to configure your card to connect to that particular network, as there may be more than one. You can do this by running the command.

sudo iwconfig eth2 essid LATCHFORD mode Managed channel 11

(Notice I have taken the ESSID, Mode and Channel Number from the scan to ensure the best results.) If you wish to use an encrypted network then this is indeed cool too.. Run the command.

sudo iwconfig eth2 key xxxxxxxxxxxxxxxxxxxxxxxxxx

Obviously replacing the xxx with the key of your choice.. Once you have run the commands above re-run iwconfig and you should get something that looks like this.

alex@alex-ubuntu:~$ iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

eth1      no wireless extensions.

sit0      no wireless extensions.

eth2      IEEE 802.11g  ESSID:"LATCHFORD"  
          Mode:Managed  Frequency:2.462 GHz  Access Point: 00:09:5B:C4:B2:E6   
          Bit Rate:54 Mb/s   
          RTS thr:2432 B   Fragment thr:2432 B   
          Power Management:off
          Link Quality:100/100  Signal level:-25 dBm  Noise level:-256 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Next you actually have to connect to the network, this is done with a simple command.

sudo dhclient eth2

It will go through and check the connection and should hopefully connect. The output should look like..

alex@alex-ubuntu:~$ sudo dhclient eth2
There is already a pid file /var/run/dhclient.pid with pid 4807
killed old client process, removed PID file
Internet Systems Consortium DHCP Client V3.0.4
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/eth2/00:09:5b:d2:6d:72
Sending on   LPF/eth2/00:09:5b:d2:6d:72
Sending on   Socket/fallback
DHCPREQUEST on eth2 to 255.255.255.255 port 67
ip length 321 disagrees with bytes received 534.
accepting packet with data after udp payload.
DHCPACK from 192.168.0.1
bound to 192.168.0.5 -- renewal in 36910 seconds.

This should now mean that you are connected to the Internet, go into the Network Manager (System->Administration->Networking) and disable all other connections, (Wired etc..). Please don't touch the wireless connection as this could cause problems.

Step 6 - Establishing a lasting connection

Well, we have got the connection working now, but one you restart you are not going to be able to connect again, because its not going to fire up ndiswrapper on boot unless you tell it too. Run the command.

sudo ndiswrapper -m

This command will load the module at boot time. The next step is to use the Network Manager, (System->Administration->Networking), Plug-in the ESSID and then connect to the network. It seems to work for me, as a consistent connection through the boot-ups. There may be no need for the previous steps, but I am not really too bothered about that at this point in time, someone can edit this if they find a quicker way. I think that concludes this HowTo. Hope it has been very informative.

Credit, where credits due.

I would also like to state that oimon should take credit for the discovery of this method, I merely tested it after he worked it out and am writing it up on his behalf. Thanks a lot to oimon. Thanks.. Alex Latchford