Wireless on RH 8.0 / 2.4.18

This is about getting 802.11b wireless working under linux, in my case specifically RH 8.0 with kernel 2.4.18 (it shouldn't be particular about exactly what kernel). Also, specifically, the D-LINK DWL-650 (and/or DRC-650) card. I've also had this working under 2.4.13.

This file is aimed at me, mostly, 'cos I kept forgetting what I'd done. If you're not me, its aimed at beginners in this area.

Summary

  1. Rebuild kernel *without* pcmcia, *with* nat etc
  2. Build pcmcia-cs
  3. Build linux-wlan-ng
  4. You may need: insmod prism2_cs prism2_ignorevcc=1
  5. Setup routing etc

Making the correct kernel/modules/etc

The O'Reilly Recipe article was the one I read first. That recommends removing pcmcia support from the kernel make and relying on the pcmcia-cs package. I forget what I did... here is the config file, though: 2.4.18-14.config. Build, install your kernel and modules (make dep bzImage install modules modules_install).

Don't forget to include nat and masquerade. You don't need the ipchains (2.0 and 2.2) stuff.

Then I did build the pcmcia-cs package... nowadays this should be OK with the most recent version, but if for any reason you have an old one, and/or if you get ide-cs / ide_cs confusion: then *read* the README-2.4 file. If you install this package and modules, and can't use your pcmcia cdrom/compact-flash card because it says "not valid device" or somesuch, you *have* forgotten to read the README-2.4!

Then I made the wlan-ng code (specifically, linux-wlan-ng-0.1.15) because by then I had realised I had a prism chipset. wlan-ng will install a couple of files in /etc/pcmcia for you: wlan-ng and wlan-ng.conf.

Note that wlan-ng seems to handle prism (which the d-link dwl-650 and drc-650 use) better than the standard pcmcia-cs version.

You *probably* need to say:

	insmod prism2_cs prism2_ignorevcc=1
which is better (I think) put into the modules.conf file. Just insert (anywhere, I think)
	options prism2_cs prism2_ignorevcc=1
If you search google, you'll get the advice to put in ignore_cis_vcc=1; if you do this in modules.conf it will (silently?) fail; done from insmod it will tell you no such opt exists. Grepping the prism2 driver code for ignore is how I found the "truth" above.

You need a wireless.opts file. Here is a really crappy one (no security) (and in fact something later ends up setting the ESSID to linux-wlan, anyway...):

case "$ADDRESS" in
*,*,*,*)
    INFO="My Network Settings"
    ESSID="MyNetworkStoat"
    MODE="Ad-Hoc"
    RATE="auto"
    ;;
esac

Tell you what, here's lsmod with the card in (but without ppp running):

Module                  Size  Used by
ipt_MASQUERADE          1264   1  (autoclean)
prism2_cs              94448   1
p80211                 19152   1  [prism2_cs]
ip_nat_ftp              3008   0  (unused)
iptable_nat            13520   1  (autoclean) [ipt_MASQUERADE ip_nat_ftp]
ip_conntrack           13424   1  (autoclean) [ipt_MASQUERADE ip_nat_ftp iptable_nat]
iptable_filter          1728   0  (autoclean) (unused)
ip_tables              10752   5  [ipt_MASQUERADE iptable_nat iptable_filter]
ds                      6736   1  [prism2_cs]
i82365                 12640   1
isa-pnp                28944   0  [i82365]
pcmcia_core            39968   0  [prism2_cs ds i82365]

Once your kernel is nicely built

You come to using it. There is surprisingly little needed at this stage. Or perhaps I'd just hacked around so much that when it finally worked it seemed so...

Note that all modern forward-thinking folk are apparently using iptables not ipchains.

# Enable forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward  

# Start nat/MASQ
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

# See what happened...
# iptables -t nat -L

# Look at the route table
# route -n

# You probbaly want your network to be able to use names
# as well as numbers... but note that you probably want
# to *stop* named if you only have 2 boxes running, ie
# no outside world.
service named start
I then find that the wireless (wlan0) interface needs to be up *before* the ppp one to get the forwarding/masquerading to work.

nb: if, when you type the iptables line above, it says

"No chain/target/match by that name"
then its because you haven't built masqerading into the kernel/module. Its not a very helpful error message.

At this point, if you have a standard config (ie, box with ppp on it connected to Outside World, and internal wlan connected to, say, a windows box) you may wonder if its working or not.

Your routing table should probably resemble this:

[root@wmc linux-wlan-ng-0.1.14-pre7]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
80.225.252.33   0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         80.225.252.33   0.0.0.0         UG    0      0        0 ppp0
and your wlan interface like this:
[root@wmc linux-wlan-ng-0.1.14-pre7]# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 00:05:5D:5C:03:C2
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          Interrupt:5 Base address:0x100

I find that the windows box, although it clearly knows it has a connection (the utility says so) refuses to report signal strength and gives a blinking light on the LED - which supposedly means "seeking, not connected" - presumably because it only gets TCP/IP, and not the filesharing its looking for. Who knows. Anyway, ping from windows to linux or back again:

# From windows
ping 192.168.0.1

# From linux
ping 192.168.0.2
This assumes the wlan0 address is 192.168.0.1, of course (is this a valid address? it works, certainly. Most examples use 192.168.1.1, though). You can set this directly
ifconfig 192.168.0.1 wlan0
or more likely put it in /etc/pcmcia/network.opts. Naturally, you've set the windows box to the fixed address (192.168.0.2), unless you really want to run DHCP.

When up and running, I was getting just-under 600k bytes/sec from a room away.