huanix

chown -R huanix /

huanix header image 2

Feisty cannot connect wireless card wlan0 using ndiswrapper without dhclient

June 19th, 2007 · No Comments · Linux, networking, wireless

It was a simple process to use ndiswrapper in linux, specifically Ubuntu Feisty Fawn 7.04, to get my wireless network cards activated.. in fact, it only takes a few lines of code: (to save formatting hassles, just enter these commands in a command line)

  • sudo apt-get install ndiswrapper-common ndiswrapper-utils-1.9
  • sudo ndiswrapper -i /[path to the drivers for your card].inf
  • sudo ndiswrapper -m
  • sudo modprobe ndiswrapper

Those commands should get your wireless card up and working, so now you have an active card without a network configuration. issuing “sudo dhclient wlan0″ at the command prompt should give you an IP (if you don’t already have one). I believe some folks are using “ifup wlan0″ as well.

The problem I’ve run into several times, is rebooting the computer and discovering the card has been activated, but it hasn’t received an IP from the WAP. I decided not to add dhclient to the startup, and instead thought it would make more sense to request a static IP.

Begin by starting up the computer and requesting dhclient as usual. We can use many of these settings to set up the static IP. At a command line, type “ifconfig -a”, you will get output like this:
wlan0 Link encap:Ethernet HWaddr 00:12:34:AB:5C:AC
inet addr:192.168.1.55 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fc80::223:49ff:fcaf:5eac/54 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:107621 errors:0 dropped:0 overruns:0 frame:0
TX packets:184 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:160430881 (152.9 MiB) TX bytes:17812 (17.3 KiB)
Interrupt:19 Memory:feac0000-feae0000

from this output, you need to write down:

  • the name of your card (probably wlan0)
  • the inet addr:
  • Bcast:
  • Mask:

Next, run “sudo iwlist wlan0 scan | less”, and if your card is configured correctly, you will see the wireless access points (listed as Cell 01, Cell 02) that are available. You’ll want to identify your WAP, probably by looking at the ESSID line (ESSID:”MY_ROUTER”). From this list, you need

  • the exact name for your ESSID,
  • the channel your Access Point is using, at the end of the “Frequency:” line.

Now we have all the information we need, except the address to your router (gateway), which is probably 192.168.1.1, or 192.168.0.1; you can predict the address by changing the “255″ in your broadcast address to a “1″ (usually!), then check it by navigating to it in your browser- it should take you to your router’s configuration page (password protected).

(Optional) Now would be a good time to back up your network settings. Type “sudo cp /etc/network/interfaces /etc/network/interfaces.old” — when you break something, you’ll just do the opposite: “sudo cp /etc/network/interfaces.old /etc/network/interfaces” to replace the file.

Now it’s time to set the static IP address for the wireless card. In a command window, type “sudo gedit /etc/network/interfaces”. Scroll down to the line that says “auto wlan0″. Your entry will look like this: (Everything AFTER // are just notes – don’t copy them!)

auto wlan0 //this could be different if your card has a different name.
iface wlan0 inet static // change "dhcp" to "static"
wireless_essid MY_ROUTER //this is the ESSID field from the iwlist command.
wireless channel 5 // this is the Channel number from the iwlist command.
address 192.168.1.55 // this can be the same as inet addr: from ifconfig
netmask 255.255.255.0 // this is the mask from ifconfig
broadcast 192.168.1.255 // this is the bcast from ifconfig
gateway 192.168.1.1 // this is the address to your router

Save and close.

This setup is for non-encrypted networks, if you use an ecrypted network, you need to add a few extra lines, look for them here.

Now when you restart your computer you should have a static wireless IP that you don’t have to set each time you log on!

Tags:

No Comments so far ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment