LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking
User Name
Password
Linux - Wireless Networking This forum is for the discussion of wireless networking in Linux.

Notices


Reply
  Search this Thread
Old 01-15-2005, 04:55 AM   #1
BrianW
Member
 
Registered: Jul 2003
Location: Montana
Posts: 297

Rep: Reputation: Disabled
HostAP & Slackware (current) Setup - need feedback


Ok, since I'm still a novice with Linux (is it ever possible to get pass this stage? ><) and I wanted to use the HostAP drivers for the benefit of iwlist <> scan and the other features it offers over the orinoco drivers that come with Slack. So after doing a fresh install of Slackware Current after a botched attempt to install HostAP with kernel 2.4.28, I figured it would be easier to start from a clean install. This is what I came up with:

1.) Full install of Slackware Current, minus KDE/Gnome like always.
2.) Upgraded to kernel 2.6.9 (seem to have issues with 2.6.10 giving me a blank screen between bootup and starting X)
3.) Removed from the kernel configuration all the drivers for pcmcia cards, basically leaving it only to see the cardbus so I could use my NetGear MA401RA card.
4.) Installed the latest stable version of HostAP driver 0.2.6 and rebooted to make sure my laptop was loading the modules hostap, hostap_cs, hostap_crypt_wep, and ds (I assume this is also a hostap module but I am not completely sure).

Everything before this point was simply installing these are my configuration scripts to get my card working.

Firstly, thanks to eric.r.turner's guide to make a Slackware AP, I used his script to bring up wlan0 and suited it to my needs. This file I named rc.wlan0 and placed in /etc/rc.d/ directory with an exec property.
Code:
#!/bin/sh
#
# rc.wlan0
#

CHANNEL=6
ESSID="mynetwork"
INTERFACE="wlan0"
IPADDR="192.168.1.3"
KEY="01AB-23CD-45" # My 64 bit 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} for home network:"
/sbin/ifconfig ${INTERFACE} ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}
/sbin/route add default gw 192.168.1.1
                    # I know this is probably a crude method and should be probably
                    # done in rc.inet1, but I figured I'd keep everything togethor.
                    # However, without defining the gateway, this doesn't work.
/sbin/iwconfig ${INTERFACE} essid ${ESSID}
/sbin/iwconfig ${INTERFACE} channel ${CHANNEL}
/sbin/iwconfig ${INTERFACE} mode ${MODE}
sleep 1 # seems like I need a pause also, just not a long one.
/sbin/iwconfig ${INTERFACE} key ${KEY}
Now that I have my script to configure wlan0 to work with my AP, I made a small change to rc.inet1 to exec. my script upon the initial startup and rc.inet1 start.

This checks to see if rc.wlan0 has permission to be executed, it is placed directly before the MAIN area of the script:
Code:
############
# wlan0 up #
############

# Function to bring up wlan0:
wlan0_up () {
  if [ -x /etc/rc.d/rc.wlan0 ]; then
    /etc/rc.d/rc.wlan0
  fi
}
Yes, I know I should call the gateway there, but it seems easier to leave it in rc.wlan0.

Now to make sure that wlan0 is called upon during the boot cycle and whenever /etc/rc.d/rc.inet1 start is called, I added a few lines into these spots:
Code:
############
### MAIN ###
############

case "$1" in
'start') # "start" brings up all available interfaces:
   lo_up
   eth_up 0
   eth_up 1
   eth_up 2
   eth_up 3
   gateway_up
   wlan0_up # Calls for my configuration
   ;;

{SKIPPING THE OTHER CALLS}

*) # The default is to bring up all interfaces:
   lo_up
   eth_up 0
   eth_up 1
   eth_up 2
   eth_up 3
   gateway_up
   wlan0_up # Calls for my configuration
esac

# End of /etc/rc.d/rc.inet1
Now for the question though. While that works now for what I want done, is there a easier way to really configure wlan0? I don't believe I can just edit rc.wireless or any other scripts since I do need to set wlan0's address and gateway or else I have no connection to my router.

Thanks for the help.
 
Old 01-15-2005, 05:00 AM   #2
BrianW
Member
 
Registered: Jul 2003
Location: Montana
Posts: 297

Original Poster
Rep: Reputation: Disabled
Oh, by the way, as I should add I guess if anyone uses this to setup HostAP on their laptop and is confused with wlan0 and wifi0 both being present--as the README for HostAP says--wifi0 will be started along with wlan0, but since wlan0 is the virtual device (think that was what it was called) that performs everything, there is no need to mess with wifi0.
 
Old 06-08-2007, 08:57 PM   #3
perry
Member
 
Registered: Sep 2003
Location: USA & Canada
Distribution: Slackware 12.0
Posts: 978

Rep: Reputation: 30
Thumbs up here's my /etc/rc.d/rc.wlan0

here's my /etc/rc.d/rc.wlan0:
Code:
#!/bin/sh

if [ "$1" == "start" ]; then
   /sbin/modprobe ndiswrapper
   /sbin/dhcpcd wlan0 
   /sbin/ifconfig wlan0 up &
fi

if [ "$1" == "stop" ]; then
   /sbin/ifconfig wlan0 down
   /sbin/dhcpcd  -k
   /sbin/modprobe -r ndiswrapper
fi
still a little pause during startup and shutdown (it's called from rc.M and rc.6) but works like a charm!

- perry

ps.
using dhcpcd 3.0.5 (the latest & greatest) under the 2.6.21.3 kernel with ndiswrapper 1.45

hope this helps
/etc/rc.d/rc.M
Code:
# Starting iptables firewall
if [ -x /etc/rc.d/rc.iptables ]; then
   /etc/rc.d/rc.iptables start
fi
if [ -x /etc/rc.d/rc.inet1 ]; then
  . /etc/rc.d/rc.inet1
fi
if [ -x /etc/rc.d/rc.wlan0 ]; then
   /etc/rc.d/rc.wlan0 start
fi
/etc/rc.d/rc.6
Code:
# Stopping wlan0 firewall
if [ -x /etc/rc.d/rc.wlan0 ]; then
  /etc/rc.d/rc.wlan0 stop
fi 
# Stopping iptables firewall
if [ -x /etc/rc.d/rc.iptables ]; then
  /etc/rc.d/rc.iptables stop
fi

Last edited by perry; 06-08-2007 at 09:01 PM.
 
Old 06-08-2007, 09:00 PM   #4
perry
Member
 
Registered: Sep 2003
Location: USA & Canada
Distribution: Slackware 12.0
Posts: 978

Rep: Reputation: 30
the latest iptables

has anyone had much luck getting the latest iptables installed and working?

- perry
 
Old 06-08-2007, 09:14 PM   #5
perry
Member
 
Registered: Sep 2003
Location: USA & Canada
Distribution: Slackware 12.0
Posts: 978

Rep: Reputation: 30
slightly different version

Code:
#!/bin/sh

if [ "$1" == "start" ]; then
   /sbin/modprobe ndiswrapper 
   /sbin/dhcpcd wlan0 &
   /sbin/ifconfig wlan0 up &
fi

if [ "$1" == "stop" ]; then
   /sbin/ifconfig wlan0 down &
   /sbin/dhcpcd  -k &
   /sbin/modprobe -r ndiswrapper &
fi
produces a "SIG..." something or other during termination on account of the fact that dhcpcd is trying to release a driver thats been unloaded from the kernel... which i think can be ignored.

- perry
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware-Current & Custom Compile slaxnoob Slackware 2 01-12-2010 01:40 PM
Quagga & HostAP JJX Linux - Networking 0 05-03-2004 05:13 PM
A Long Day - Slackware-Current & 2.6.4 Installation Disaster SML Slackware 1 03-21-2004 05:23 AM
Questions about Wireless & HostAP Config joesbrain Slackware 1 01-28-2004 03:31 PM
SlackWare-Current & maintenance KenHan Slackware 2 02-08-2003 02:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking

All times are GMT -5. The time now is 06:05 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration