个人工具

UbuntuHelp:WifiDocs/Device/WG121

来自Ubuntu中文

Oneleaf讨论 | 贡献2007年5月24日 (四) 14:21的版本 (新页面: {{From|https://help.ubuntu.com/community/WifiDocs/Device/WG121}} {{Languages|UbuntuHelp:WifiDocs/Device/WG121}} == WG121 HowTo == This page details the procedure to enable the Netgear WG...)

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航, 搜索

WG121 HowTo

This page details the procedure to enable the Netgear WG121 USB Wireless Adapter to work on Ubuntu 6.10 (Edgy Eft).

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)

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)

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.

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

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 etj1, eth3 or even wlan0. (wlan0 is probably the most common, but ethX works fine too).

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