Hello,
I have a problem with hostapd. When I first boot up my laptop, I can get my wlan0 logged on, and run a script for hostadp for wlan1 that works flawlessly.
After I stop hostapd and remove the wireless usb (wlan1), when I reinsert it and run my script, I get this:
Code:
# hostapd /home/username/Access\ Point/hostapd-test.conf
Configuration file: /home/username/Access Point/hostapd-test.conf
nl80211: Could not configure driver mode
nl80211 driver initialization failed.
hostapd_free_hapd_data: Interface wlan1 wasn't started
This is my hostapd.conf file (under a different name).
Code:
# cat /home/username/Access\ Point/hostapd-test.conf
#change wlan0 to your wireless device
interface=wlan1
driver=nl80211
ssid=animals
channel=1
wpa=3
wpa_passphrase=hidden
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
My script is :
Code:
# cat bin/initSoftAP
#!/bin/bash
#Initial wifi interface configuration
if [ -z "$1" ]; then
AP_DEVICE=wlan1
GATEWAY_DEVICE=wlan0
else
AP_DEVICE=$1
GATEWAY_DEVICE=$2
fi
ifconfig $AP_DEVICE up 10.0.0.1 netmask 255.255.255.0
sleep 2
###########Start DHCP, comment out / add relevant section##########
#Thanks to Panji
#Doesn't try to run dhcpd when already running
if [ "$(ps -e | grep dhcpd)" == "" ]; then
dhcpd $AP_DEVICE &
fi
###########
#Enable NAT
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --table nat --append POSTROUTING --out-interface $GATEWAY_DEVICE -j MASQUERADE
iptables --append FORWARD --in-interface $AP_DEVICE -j ACCEPT
#/root/firewall/firewall-browsing
#iptables -P FORWARD ACCEPT
#Thanks to lorenzo
#Uncomment the line below if facing problems while sharing PPPoE, see lorenzo's comment for more details
#iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
sysctl -w net.ipv4.ip_forward=1
#start hostapd
hostapd /home/woodnt/Access\ Point/hostapd-test.conf #1>/dev/null
/root/firewall/firewall-clear
killall dhcpd
I have configured have configured networking to initialize the card so that Network Manager leaves it unmanaged, so that is not the issue (esp since it works the first time).
Also, I have completely stopped the network-manager service to make sure it isn't the culpret and it still gives this error.
A reboot of the computer solves this problem, but I would like another solution other than this.
I have stopped the network-manager service and the networking service and restarted to see if that would help, which it didn't.
My wireless module is rt2800usb.
Note, dmesg and /var/log/syslog or messages show no new entries after runing hostapd fails.
Other advice would be greatly appreciated.
Kindly,
Narnie