problems in configuration of hostapd

esolve esolve esolvepolito at gmail.com
Thu Aug 30 10:34:50 EDT 2012


Hi, all:


    I want to use my laptop as an AP. The laptop is installed with fedora
16. and I have installed hostapd.  I connect my laptop to wired Ethernet
and I have two wireless cards on the laptop. One card (wlan0) is built-in
but doesn't support AP mode, so I use a plug-in wireless card wlan1 (D-Link
aripus DWL-G650) for AP interface.

     Currently, I have some problems in making it work.

      (1) sometimes, the following command line doesn't work

             ifconfig wlan1 192.168.1.254

wlan1 is temporarily set to 192.168.1.254  and after several or tens of
seconds, wlan1 is not binded with any IPV4 address (I use ifconfig wlan1 to
check and notice there is no IPV4 address), I reset it again and again, it
may be still like this.

      (2) the command line: hostapd -B /etc/hostapd/hostapd.conf
may fail. The error message is: "failed to create interface mon.wlan1"
Whether I kill the process or delete  /var/run/hostapd  is of no use.

       But sometimes, occasionally, by resetting the IP address of wlan1 or
deleting /var/run/hostapd and restart it or restart dhcpd, the AP works,
which means I can use the laptop as AP successfully. And I really don't
know why.
Can anybody give me some advices on these issues?


My configuration procedures are as follows:

1 config  /etc/hostapd/hostapd.conf  and  /etc/dhcp/dhcpd.conf (after the
first setting, it is usually done)

(1) Modify /etc/hostapd/hostapd.conf and put the following
interface=wlan0
driver=nl80211
ssid=MyAP
hw_mode=g
channel=11
wpa=1
wpa_passphrase=MyPasswordHere
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_ptk_rekey=600

(2)in /etc/dhcp/dhcpd.conf, put
subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.10 192.168.1.100;
        option routers 192.168.1.254;
        option subnet-mask 255.255.255.0;
        option domain-name-servers  inria.fr,138.96.0.10,138.96.0.11;
}

2 If more than one network interface is attached to the system, but the
DHCP server should only be started on one of the interfaces, configure the
DHCP server to start only on that device. In /etc/sysconfig/dhcpd, add the
name of the interface to the list of DHCPDARGS: # Command line options here
DHCPDARGS=wlan1 (after the first setting, it is usually done)

3 ifconfig wlan1 192.168.1.254  (the same as the "routers" in
/etc/dhcp/dhcpd.conf )

4 Allow ip masquerading
      echo "1" > /proc/sys/net/ipv4/ip_forward (or sysctl -w
net.ipv4.ip_forward=1) (sysctl net.ipv4.ip_forward shows the state)
      iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

5 start hostapd

      hostapd -B /etc/hostapd/hostapd.conf
      if there is problem: cd /var/run/hostapd and remove "wlan1"
      if it shows:failed to create interface mon.wlan1, ps -ef|grep
"hostapd" and then kill them

6  start DHCP server

               systemctl start dhcpd.service (systemctl status
dhcpd.service to check the status)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20120830/d325f796/attachment.htm 


More information about the HostAP mailing list