Click to See Complete Forum and Search --> : Slackware and ndiswrapper <-> How-to


SA_99
05-11-2004, 01:17 AM
I had a bit of trouble setting up my (freshly installed) Slackware laptop to use my BCM94306 wireless chip with ndiswrapper, so I'm posting this how-to to help out anyone stuck in the same situation. This may not be the best way, and there may be some extra stuff that isn't needed, but it works. It's somewhat based on this how-to (http://www.linuxquestions.org/questions/answers/45). Maybe someone with more experience than me could look it over. Anyway, here it is:

<-- Slackware and ndiswrapper how-to -->

I. Get and install ndiswrapper

I won't go into details here, since it's fairly easy if you look in the INSTALL doc after you unpack ndiswrapper. Ndiswrapper can be found here: http://ndiswrapper.sourceforge.net
NOTE: If you install ndiswrapper with a 2.4 kernel (official Slackware packaged kernels and the stock kernel) and then later upgrade to 2.6 manually, you will have to reinstall ndiswrapper, or at least recompile the modules.
ALSO NOTE: If you don't have it, make sure you get the wireless-tools package, I believe it can be found in the Slackware repository. It's necessary.

II. Creating /etc/rc.d/rc.wlan0

By default ndiswrapper uses wlan0 as the network interface. Since Slackware's init scripts don't bring up wlan0 or do any configuring, you have to create your own. Just copy and paste this into an editor:
#!/bin/sh
#
# rc.wlan0
#

#CHANNEL=_
ESSID="YOUR_SSID"
INTERFACE="wlan0"
KEY="YOUR_WEP_KEY"
MODE="Managed"
NETMASK="255.255.255.0"

# Set up the WiFi card

echo "Configuring ${INTERFACE}:"
/usr/sbin/iwconfig ${INTERFACE} essid ${ESSID}
#/usr/sbin/iwconfig ${INTERFACE} channel ${CHANNEL}
/usr/sbin/iwconfig ${INTERFACE} mode ${MODE}
/usr/sbin/iwconfig ${INTERFACE} key ${KEY}

# Get IP address from dhcp

/sbin/dhcpcd -t 10 -d wlan0

# Bring up interface - I'm not sure if this is necessary,
# but it doesn't hurt

ifconfig wlan0 up

Fill in the appropriate values for ESSID and KEY. You can also uncomment the channel stuff if you need it, but mine works fine without it.

If you use a static ip address, you can try the following instead (if you don't know then you probably use dhcp, and can skip to "Now save as...") :
#!/bin/sh
#
# rc.wlan0
#

#CHANNEL=1
ESSID="YOUR_SSID"
INTERFACE="wlan0"
IPADDR="YOUR_IP_ADDRESS"
KEY="YOUR_WEP_KEY"
MODE="Managed"
NETMASK="255.255.255.0"

# Determine broadcast and network addresses from the IP address and netmask:

BROADCAST=`/bin/ipmask $NETMASK $IPADDR | cut -f 1 -d ' '`
NETWORK=`/bin/ipmask $NETMASK $IPADDR | cut -f 2 -d ' '`

# Set up the WiFi card

echo "Configuring ${INTERFACE}:"
/sbin/ifconfig ${INTERFACE} ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}
/usr/sbin/iwconfig ${INTERFACE} essid ${ESSID}
#/usr/sbin/iwconfig ${INTERFACE} channel ${CHANNEL}
/usr/sbin/iwconfig ${INTERFACE} mode ${MODE}
sleep 2
/usr/sbin/iwconfig ${INTERFACE} key ${KEY}
Please note that I don't use a static ip, nor do I know anyone that does (I've never even heard of anyone using a static ip with wireless, but I figured I'd put this in here just to be safe) so I can't verify that this works properly. It should though.

Now save as "/etc/rc.d/rc.wlan0". Make it executable by opening a terminal and typing (as root):
chmod +x /etc/rc.d/rc.wlan0
Now you can run this script as root (type /etc/rc.d/wlan0 in a terminal and press enter) and it should bring up your wireless connection.

III. Starting wlan0 at boot

You may want to start your wireless connection at boot. You can do this by adding the following to /etc/rc.d/rc.inet1 :
#####################
# BRINGING UP wlan0 #
#####################
#To bring up wlan0 on boot:

if [ -x /etc/rc.d/rc.wlan0 ]; then
/etc/rc.d/rc.wlan0
fi
Add this right before the end (just above "# End of /etc/rc.d/rc.inet1").

Now whenever you start your networking (/etc/rc.d/rc.inet1 start) or restart it (/etc/rc.d/rc.inet1 restart) wlan0 should be pulled up. This is done at boot time too. If you aren't in the same location, you can configure wlan0 with iwconfig (see man iwconfig).

That's basically it. If you see something that could be done easier, is unnecessary, etc. please comment.

Good luck :)[CODE]

mdwatts
05-11-2004, 12:03 PM
Very nice and well done SA_99.

Thanks as your howto should be a help to many of our members attempting to setup ndiswrapper and wireless.

SA_99
05-11-2004, 07:53 PM
Very nice and well done SA_99.

Thanks :) .

I added a bit on static ip addresses (does anyone actually use one for wireless?), and fixed the (broken) link to the ndiswrapper page.

I think this should also work for just plain wireless connections (no ndiswrapper), if you skip the ndiswrapper part, but I'm not sure.

mdwatts
05-12-2004, 11:17 AM
Originally posted by SA_99

I added a bit on static ip addresses (does anyone actually use one for wireless?), and fixed the (broken) link to the ndiswrapper page.


I use static for everything at home including the WPC54G I've setup on my laptop (XP Home) and the WMP54G on the gf's pc (XP Pro). :)

Still have to get around to installing ndiswrapper on the Linux side one of these days.