<font size="4">Hi, all:<br> <br><br> 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.<br>
<br> Currently, I have some problems in making it work.<br><br> (1) sometimes, the following command line doesn't work</font><br><pre><font size="4"><span style="font-weight:bold"> ifconfig wlan1 192.168.1.254<br>
</span></font>
</pre>
<font size="4">wlan1 is temporarily set to </font><font size="4"><span style="font-weight:bold">192.168.1.254</span></font><font size="4"> 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.<br>
<br> (2) </font><font size="4">the command line: hostapd -B /etc/hostapd/hostapd.conf</font><font size="4"><br>may fail. The error message is: "failed to create interface mon.wlan1"<br>Whether I kill the process or delete </font><font size="4"><span style="color:rgb(255,0,0)">/var/run/hostapd</span></font><font size="4"> is of no use.<br>
<br> 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.<br>
Can anybody give me some advices on these issues? <br><br><br>My configuration procedures are as follows:<br><br>1 config <span style="font-family:monospace"></span>/etc/hostapd/hostapd.conf and <code class="filename">/etc/dhcp/dhcpd.conf (after the first setting, it is usually done)<br>
</code></font><pre><font size="4">(1) Modify <tt>/etc/hostapd/hostapd.conf</tt> and put the following<br>interface=wlan0<br>driver=nl80211<br>ssid=MyAP<br>hw_mode=g<br>channel=11<br>wpa=1<br>wpa_passphrase=MyPasswordHere<br>
wpa_key_mgmt=WPA-PSK<br>wpa_pairwise=TKIP CCMP<br>wpa_ptk_rekey=600<br><br>(2)in /etc/dhcp/dhcpd.conf, put<br>subnet 192.168.1.0 netmask 255.255.255.0 {<br> range 192.168.1.10 192.168.1.100;<br> option routers 192.168.1.254;<br>
option subnet-mask 255.255.255.0;<br> option domain-name-servers <a href="http://inria.fr">inria.fr</a>,138.96.0.10,138.96.0.11; <br>}<br></font></pre><font size="4"><code class="filename">2 </code>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 <code class="filename">/etc/sysconfig/dhcpd</code>, add the name of the interface to the list of <code class="command">DHCPDARGS</code>:
                        # Command line options here
DHCPDARGS=wlan1 <code class="filename">(after the first setting, it is usually done)</code><code class="filename"></code></font><pre><font size="4">3 <span style="font-weight:bold">ifconfig wlan1 192.168.1.254 (the same as the "routers" in </span>/etc/dhcp/dhcpd.conf <span style="font-weight:bold">)</span><br>
<br>4 <span style="font-weight:bold">Allow ip masquerading</span><br> echo "1" > /proc/sys/net/ipv4/ip_forward (or </font><code>sysctl -w net.ipv4.ip_forward=1</code><font size="4">) (sysctl net.ipv4.ip_forward shows the state)<br>
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE <br></font></pre><font size="4"><code class="command"><span style="font-weight:bold">5 start hostapd</span><br></code></font><div class="admonition"><div class="para">
                                        <pre class="screen"><font size="4"> hostapd -B /etc/hostapd/hostapd.conf<br> <span style="color:rgb(255,0,0)">if there is problem</span>: <span style="color:rgb(255,0,0)">cd /var/run/hostapd and remove "wlan1"<br>
if it shows:failed to create interface mon.wlan1, ps -ef|grep "hostapd" and then kill them<br></span></font></pre></div></div><font size="4">6 <span style="font-weight:bold">start DHCP server </span><code class="command"><span style="font-family:times new roman,new york,times,serif"><br>
<br> </span>systemctl start dhcpd.service (systemctl status dhcpd.service to check the status)</code></font>