LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Wireless Networking (https://www.linuxquestions.org/questions/linux-wireless-networking-41/)
-   -   HostAP & Slackware (current) Setup - need feedback (https://www.linuxquestions.org/questions/linux-wireless-networking-41/hostap-and-slackware-current-setup-need-feedback-278021/)

BrianW 01-15-2005 04:55 AM

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. :)

BrianW 01-15-2005 05:00 AM

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.

perry 06-08-2007 08:57 PM

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


perry 06-08-2007 09:00 PM

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

- perry

perry 06-08-2007 09:14 PM

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


All times are GMT -5. The time now is 03:46 AM.