LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Linux Answers > Networking
User Name
Password

Notices

By linuxmankev at 2004-08-02 11:44
I have a number of wireless devices all of which use either the Netgear MA111 USB device, or the Netgear MA301 PCI Card.
I don't use a wireless AP or router - I simply connect these in an ad-hoc manner, but the instructions below are specific to this.

1 Get the source
First of all you need to get the source code from www.linux-wlan.com.
The version I use is 0.2.1-pre20 which was the latest release out at the time I set my network up

2 Unpack the source
Once you have the tarball unpack this in /usr/src.
Note you must have the kernel source for the running kernel available as you will be building a kernel module to use the device

3 Configuration: make config
To make the module run
make config
This will ask you one by one which module to compile:
-------------- Linux WLAN Configuration Script -------------

The default responses are correct for most users.

Build Prism2.x PCMCIA Card Services (_cs) driver? (y/n) [n]:
Build Prism2 PLX9052 based PCI (_plx) adapter driver? (y/n) [n]:
Build Prism2.5 native PCI (_pci) driver? (y/n) [y]:
Build Prism2.5 USB (_usb) driver? (y/n) [y]:

You will then be asked for the location of the kernel source code
Linux source directory [/usr/src/linux-2.6.5-1.358]: /usr/src/linux-2.6.6-1.435.2.3/

The kernel source tree is version 2.6.6-1.435.2.3custom.
Kernel 2.5/2.6 support is highly experimental.
The current kernel build date is Sun Jul 25 19:21:41 2004.

As you can see here if you are using the Linux 2.6 code it is marked as experimental but it works well
From here you can accept all the defaults for the rest of the questions
Alternate target install root directory on host []:
Module install directory [/lib/modules/2.6.6-1.435.2.3custom]:

It looks like you have a System V init file setup.


Prefix for build host compiler? (rarely needed) []:

Build for debugging (see doc/config.debug) (y/n) [n]:


Configuration successful.

4 Compilation: make all
Once you have configured what drivers to compile run:
make all
This will compile against your kernel source and at the end you will have a module.

5 Installation: make install
Once compilation has complete you have to install the module which will put the module in the right place on the system so it can be loaded by the kernel. To do this run:
make install

6 System Configuration
The linux-wlan module gives you devices named wlanX on your system which are synonymous with the standard ethX devices you find.
So with this in mind you need to edit your network settings for wlan0. I use Red Hat, TaoLinux and Fedora and these are all "Red Hat" and therefore I edit/add a file called
/etc/sysconfig/network-scripts/ifcfg-wlan0
with the following in:
#Netgear MA111 USB Wireless
DEVICE=wlan0
BOOTPROTO=dhcp
TYPE=Ethernet
ONBOOT=yes
DHCP_HOSTNAME=vaio
GATEWAY=192.168.99.1

Of course, this if you use DHCP - alter to suit if you use static networking
Once this is done you need to tell the kernel about the module and the device it uses. For Linux 2.4 put the following in /etc/modules.conf. For 2.6 put it in modprobe.conf:
alias wlan0 prism2_usb
Once that has done you need to configure the wlan configuration. This is done in /etc/wlan directory.
Edit the file:
/etc/wlan/wlan.conf
Here you set various options to do with your environment. The config I use is below:
WLAN_DEVICES="wlan0"
ChannelList="01:02:03:04:05:06:07:08:09:0a:0b:00:00:00"
ChannelMinTime=200
ChannelMaxTime=250
WLAN_SCAN=n
SSID_wlan0="yourSSID"
ENABLE_wlan0=y

I've removed the comments leaving only the needed options.
For this to work you also need to copy the file wlancfg-DEFAULT to wlancfg-yourSSID which matches up to this SSID in wlan.conf above.
Now edit this file.
The important parts in this file are the WEP enabled sections, the KEYs section and what type of network you run (ad-hoc [host to host] or infrastructure [wireless AP]). This file is quite lengthy, but well documented so I'm not going to reproduce this here. Note for security this file is only rwx for Root only as it holds your encryption keys for WEP.

7 Start-up
The source installs an init script in /etc/init.d/ called wlan. So run this and you should see an interface called wlan0 when you do ifconfig and iwconfig.

by incognite on Sun, 2004-08-29 01:44
thanks for the guide, im having a few problems with the make all command though, when i try it i get the following.

[root@localhost linux-wlan-ng-0.2.1-pre20]# make all
set -e; for d in src doc man etc; do make -C $d ; done
make[1]: Entering directory `/usr/src/linux-wlan-ng-0.2.1-pre20/src'
set -e; for d in mkmeta p80211 prism2 shared wlanctl wland nwepgen wlancfg; do make -C $d ; done
make[2]: Entering directory `/usr/src/linux-wlan-ng-0.2.1-pre20/src/mkmeta'
gcc -E -M -I../include -I/usr/src/linux-2.6.8-1.521/include -D__LINUX_WLAN__ ../shared/p80211types.c ../shared/p80211metamsg.c ../shared/p80211metamib.c ../shared/p80211meta.c mkmetadef.c ../shared/p80211types.c ../shared/p80211metamsg.c ../shared/p80211metamib.c ../shared/p80211meta.c mkmetastruct.c > .depend
mkdir -p obj
make[2]: Leaving directory `/usr/src/linux-wlan-ng-0.2.1-pre20/src/mkmeta'
make[2]: Entering directory `/usr/src/linux-wlan-ng-0.2.1-pre20/src/p80211'
if test ! -d /usr/src/linux-wlan-ng-0.2.1-pre20/src/p80211/../.tmp_versions; then \
cp -rf /usr/src/linux-2.6.8-1.521/.tmp_versions /usr/src/linux-wlan-ng-0.2.1-pre20/src/p80211/../ ; \
fi
cp: cannot stat `/usr/src/linux-2.6.8-1.521/.tmp_versions': No such file or directory
make[2]: *** [default] Error 1
make[2]: Leaving directory `/usr/src/linux-wlan-ng-0.2.1-pre20/src/p80211'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/linux-wlan-ng-0.2.1-pre20/src'
make: *** [all] Error 2
[root@localhost linux-wlan-ng-0.2.1-pre20]#

Any Idea's? Im running Fedora 2 with everything updated possible....
Any assistance would be greatly appreciated!

Thanks in advance
Cogs

by incognite on Sun, 2004-08-29 03:42
Ok fixed that part by just making a folder called .tmp_versions where it was looking but now i get another error when i try and run make install.

[root@localhost linux-wlan-ng-0.2.1-pre20]# make install
find . -name .depend -exec rm {} \;
set -e; for d in src doc man etc; do make -C $d install ; done
make[1]: Entering directory `/usr/src/linux-wlan-ng-0.2.1-pre20/src'
set -e; for d in p80211 prism2 shared wlanctl wland nwepgen mkmeta wlancfg; do make -C $d install ; done
make[2]: Entering directory `/usr/src/linux-wlan-ng-0.2.1-pre20/src/p80211'
mkdir -p ?/lib/modules/2.6.8-1.521custom/kernel/drivers/net
cp p80211.ko ?/lib/modules/2.6.8-1.521custom/kernel/drivers/net
make[2]: Leaving directory `/usr/src/linux-wlan-ng-0.2.1-pre20/src/p80211'
make[2]: Entering directory `/usr/src/linux-wlan-ng-0.2.1-pre20/src/prism2'
mkdir -p ?/etc/wlan
cp shared.prism2 ?/etc/wlan
mkdir -p ?/etc/wlan/
cp *pda ?/etc/wlan/
for x in *.hex ; do \
if [ -f "$x" ] ; then \
cp $x ?/etc/wlan//prism2_`echo $x | cut -c1-2`.hex ; \
fi; \
done
set -e; for d in driver ridlist download; do make -C $d install ; done
make[3]: Entering directory `/usr/src/linux-wlan-ng-0.2.1-pre20/src/prism2/driver'
cp prism2_pci.ko prism2_usb.ko ?/lib/modules/2.6.8-1.521custom/kernel/drivers/net
cp: `?/lib/modules/2.6.8-1.521custom/kernel/drivers/net': specified destination directory does not exist
Try `cp --help' for more information.
make[3]: *** [install] Error 1
make[3]: Leaving directory `/usr/src/linux-wlan-ng-0.2.1-pre20/src/prism2/driver'
make[2]: *** [install] Error 2
make[2]: Leaving directory `/usr/src/linux-wlan-ng-0.2.1-pre20/src/prism2'
make[1]: *** [install] Error 2
make[1]: Leaving directory `/usr/src/linux-wlan-ng-0.2.1-pre20/src'
make: *** [install] Error 2
[root@localhost linux-wlan-ng-0.2.1-pre20]#

Tried making a folder like before but didnt work.

Any suggestions?

by exodist on Fri, 2004-09-10 20:32
I got it installed just fine, did the modprobe and am now trying to configure it (gentoo, do-it-yourselfer) I tried ifconfig and nothing showed up for wlan0, so I tried ifconfig wlan0 and got some data saying it was ethernet, but no hardware address, I tried giving it an ip ifconfig wlan0 192.168.0.22 and got: SIOCSIFFLAGS: No such device
I have configured the wlancfg and wlan-mySSID (I replaced it wit my SSID) and gave it the wep configurations, but it just does not seem to work (and yes I did load the module)

by jarrywhu on Sat, 2004-09-18 05:47
anyone who has made the ma111 working with the "how to"?why I can't?I used red hat linux whit kernel 2.6.3

by exodist on Sat, 2004-09-18 12:49
the tutorial told me where to get the driver, the linux-wlan-ng project, from there I figured it out on my own (with some frustration) but then again I am unorthadox and a gentoo user with 5 years of experiance telling me to do it myself and not use packages or utilities :-D

first I downloaded the driver and ran the script liek mentioned and it installed the prism2_usb module. I then would do modprobe on the driver (modprobe prism2_usb) and would get my wlan0 device, but it didn't have a mac address, and I was unable to use it weather or not it was on a network with wep encryption. you are probably stuck here as well, type ifconfig wlan0, is there a mac address? if not that is the problem.

to fix it in gentoo:
use emerge to install linux-wlan-ng: emerge linux-wlan-ng

do not uninstall the manually installed driver however, emerge fails to place some needed files in /etc/wlan (grrrr) not uninstalling the manual one will fix this.

then to get the card initilized run /etc/init.d/wlan start
to make initilize at boot type: rc-update add wlan default
that will initilize the card w/ no wep encryption and it will connect to the first open network it finds. you can use ifconfig wlan0 IP to set the cards ip, or you can use dhcpcd -t 10 -d wlan0

if you need wep encryption you need to configure /etc/conf.d/wlan.cfg, it also has further instructions regarding this inside the file.

here is a copy of the /etc/init.d/wlan for those not using gentoo, I doubt it will work as-is in another distro, but it might give you an idea.

#!/sbin/runscript

source_config() {
if [ -f /etc/wlan/shared ]
then
source /etc/wlan/shared
else
return 1
fi
return 0
}

start() {
ebegin "Starting WLAN devices"
if ! source_config
then
eerror "Error loading /etc/wlan/shared"
eend 1
return 1
fi

# NOTE: We don't explicitly insmod the card driver here. The
# best thing to do is to specify an alias in /etc/modules.conf.
# Then, the first time we call wlanctl with the named device,
# the kernel module autoload stuff will take over.

for DEVICE in $WLAN_DEVICES; do
#=======ENABLE========================================
# Do we want to init the card at all?
eval 'WLAN_ENABLE=$ENABLE_'$DEVICE
if ! is_true $WLAN_ENABLE ; then
continue
fi

if is_true $WLAN_DOWNLOAD; then
wlan_download $DEVICE
fi

wlan_enable $DEVICE

#=======MAC STARTUP=========================================
wlan_supports_scan $DEVICE

if [ $? = 0 ] ; then
wlan_scan $DEVICE
if [ $? = 0 ] ; then
wlan_source_config_for_ssid "$ssid:$bssid"

wlan_user_mibs $DEVICE
# make it quiet
error=`eval wlan_wep $DEVICE`

grep 'autojoin' /proc/net/p80211/$DEVICE/wlandev > /dev/null
if [ $? = 0 ]; then
wlan_infra $DEVICE
else
wlan_dot11_join $DEVICE
fi
else
echo "network not found. maybe start IBSS?"
fi
else
wlan_source_config $DEVICE

wlan_user_mibs $DEVICE
# make it quiet
error=`eval wlan_wep $DEVICE`

if is_true $IS_ADHOC ; then
wlan_adhoc $DEVICE
else
wlan_infra $DEVICE
fi
fi
done

eend 0
}

stop() {
ebegin "Shutting Down WLAN Devices"
if ! source_config
then
eerror "Error loading /etc/wlan/shared"
eend 1
return 1
fi

# Do a reset on each device to make sure none of them are still
# trying to generate interrupts.
for DEVICE in $WLAN_DEVICES; do
# This just makes it quiet...
error="$(eval wlan_disable $DEVICE)"
done

eend 0
}

by geekdesign on Tue, 2004-09-21 11:01
I am kind of new to the wireless part of linux I have a MA111 wireless usb card. I was wondering what kernel I need? I am using 2.4 with redhat 8.0. Do I need to upgrade to 2.6 or should it be ok with 2.4? If someone knows an easier version of linux to get it configured, please let me know?

Thanks in advance

by zerogood on Sun, 2004-10-24 15:48
on the first tutorial i tryed to unzip the tar.gz file to /usr/src but it said i need permission to do this so i tryed to do it in the terminal but what is the command for unzipping something to somewhere like /usr/src?

by exodist on Tue, 2004-10-26 02:14
you need to be root:
su root
password:

then go to the directory where you want it to extract to (/usr/src)
cd /usr/src
then type:
tar -zxvf path/to/file/thefile.tar.gz
that will extract it intot he current directory. (/usr/src) not into the directory where the file is located.

explination:
tar is the command used for archives (.tar)
gunzip extracts .gz files
bunzip2 extracts bz2 files
however when you have a .tar.gz or .tar.bz2 the tar program can take care of the gunzip or bunzip for you
tar -z file to handle gzip (.gz)
tar -j file to handle bzip2 (bz2)
the -zx means extract from gzip
the -zxv ads verbose so you can see what is happening.
the -zxvf adds something, I am not sure what the f flag does atm, look it up (tar --help) I know it was important and is screwy if you leave it out.. been using it 5 years now and never looked it up.

by exodist on Tue, 2004-10-26 02:15
looked it up, f needs to be at the end, f means use the file that follows it

tar -f filename
tar -zxv[f] filename the filename must be immediately after the f with a space between.

tar -zfxv filename will nto work it will try to find xv as the filename (I think)

by Qwertie on Thu, 2004-12-16 16:41
Wow, installing a device driver in linux only takes 7 steps? Gee, it's practically plug & play!

But I'm having a teensy problem doing step one. How to I get the source code for my kernel? I have Fedora Core 2. I do not know how to determine the kernel version, but even if I did, I wouldn't know how to get the source.

Honestly, what kind of OS requires the kernel source just to use a device driver? ...


  



All times are GMT -5. The time now is 08:30 PM.

Main Menu

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration