{"id":159,"date":"2017-12-04T17:01:43","date_gmt":"2017-12-04T09:01:43","guid":{"rendered":"https:\/\/wp.yaanren.win\/?p=159"},"modified":"2017-12-04T17:01:43","modified_gmt":"2017-12-04T09:01:43","slug":"ubuntu%e4%b8%8b%e4%bd%bf%e7%94%a8hostapd%e6%90%ad%e5%bb%ba%e7%83%ad%e7%82%b9","status":"publish","type":"post","link":"https:\/\/wp.625300.xyz\/?p=159","title":{"rendered":"Ubuntu\u4e0b\u4f7f\u7528Hostapd\u642d\u5efa\u70ed\u70b9"},"content":{"rendered":"<div class=\"author\"><\/div>\n<div class=\"show-content\" data-note-content=\"\">\n<p>\u73af\u5883\uff1aUbuntu<br \/>\n\u901a\u8fc7eth0\u8fde\u63a5\u5916\u7f51\uff0c\u901a\u8fc7wlan0\u5efa\u7acb\u70ed\u70b9<\/p>\n<p>1.\u5b89\u88c5isc-dhcp-server<\/p>\n<pre class=\"hljs undefined\"><code>su\napt-get install isc-dhcp-server\n<\/code><\/pre>\n<p>2.\u914d\u7f6eDHCP<\/p>\n<pre class=\"hljs undefined\"><code>vim \/etc\/default\/isc-dhcp-server\n<\/code><\/pre>\n<blockquote><p>INTERFACES=&#8221;wlan0&#8243;<\/p><\/blockquote>\n<pre class=\"hljs undefined\"><code> vim \/etc\/dhcp\/dhcpd.conf\n<\/code><\/pre>\n<blockquote><p>option domain-name-servers 8.8.8.8, 114.114.114.114;<br \/>\ndefault-lease-time 600;<br \/>\nmax-lease-time 7200;<\/p>\n<p>subnet 10.5.5.0 netmask 255.255.255.0 {<br \/>\nrange 10.5.5.2 10.5.5.250;<br \/>\noption routers 10.5.5.1;<br \/>\noption broadcast-address 10.5.5.255;<br \/>\n}<\/p><\/blockquote>\n<pre class=\"hljs undefined\"><code>ifconfig wlan0 10.5.5.1\/24\nservice isc-dhcp-server restart\n<\/code><\/pre>\n<p>\u6253\u5f00\u6570\u636e\u5305\u8f6c\u53d1\uff0c\u901a\u8fc7iptables\u5c06\u65e0\u7ebf\u7f51\u5361\u7684\u6d41\u91cf\u8f6c\u53d1\u5230\u672c\u673a\u8054\u7f51\u7684\u7aef\u53e3eth0\uff08\u5982\u679c\u4f60\u7528\u65e0\u7ebf\u4e0a\u7f51\u6539\u4e3awlan0\uff09:<\/p>\n<pre class=\"hljs undefined\"><code>echo \"1\" &gt; \/proc\/sys\/net\/ipv4\/ip_forward\niptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE\n<\/code><\/pre>\n<p>4.\u901a\u8fc7hostapd\u5efa\u70ed\u70b9<\/p>\n<pre class=\"hljs undefined\"><code>git clone https:\/\/github.com\/OpenSecurityResearch\/hostapd-wpe\nwget http:\/\/hostap.epitest.fi\/releases\/hostapd-2.2.tar.gz\ntar -zxf hostapd-2.2.tar.gz\ncd hostapd-2.2\npatch -p1 &lt; ..\/hostapd-wpe\/hostapd-wpe.patch\ncd hostapd\nmake\n<\/code><\/pre>\n<p>\u65b0\u5efa\u914d\u7f6e\u6587\u4ef6<\/p>\n<pre class=\"hljs undefined\"><code>vim 1.conf\n<\/code><\/pre>\n<blockquote><p>interface=wlan0<br \/>\ndriver=nl80211<br \/>\nssid=test<br \/>\nchannel=6<br \/>\nhw_mode=g<br \/>\nauth_algs=1<br \/>\nwpa=3<br \/>\nwpa_passphrase=12345678<br \/>\nwpa_key_mgmt=WPA-PSK<br \/>\nwpa_pairwise=TKIP<br \/>\nrsn_pairwise=CCMP<\/p><\/blockquote>\n<pre class=\"hljs undefined\"><code>.\/hostapd-wpe 1.conf\n<\/code><\/pre>\n<p>\u638f\u51fa\u8bbe\u5907\u5c1d\u8bd5\u8fde\u63a5test\u7684\u65e0\u7ebf\uff0c\u5bc6\u780112345678\uff0c\u6d4b\u8bd5\u662f\u5426\u80fd\u6210\u529f\u4e0a\u7f51\u3002<br \/>\n\u5982\u679c\u9047\u5230\u4ee5\u4e0b\u9519\u8bef\uff1a<\/p>\n<blockquote><p>Configuration file: hostapd.conf<br \/>\nnl80211: Could not configure driver mode<br \/>\nnl80211 driver initialization failed.<br \/>\nhostapd_free_hapd_data: Interface wlan0 wasn&#8217;t started<\/p><\/blockquote>\n<p>\u8bf7\u6267\u884c\uff0c\u5e76\u91cd\u65b0\u8fd0\u884chostapd<\/p>\n<blockquote><p>nmcli nm wifi off<br \/>\nrfkill unblock wlan<\/p><\/blockquote>\n<p>\u53c2\u8003\uff1a<br \/>\n<a href=\"https:\/\/link.jianshu.com\/?t=http:\/\/roylez.herokuapp.com\/2011\/08\/11\/hostapd.html?utm_source=tuicool&amp;utm_medium=referral\" target=\"_blank\" rel=\"nofollow noopener\">http:\/\/roylez.herokuapp.com\/2011\/08\/11\/hostapd.html?utm_source=tuicool&amp;utm_medium=referral<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u73af\u5883\uff1aUbuntu \u901a\u8fc7eth0\u8fde\u63a5\u5916\u7f51\uff0c\u901a\u8fc7wlan0\u5efa\u7acb\u70ed\u70b9 1.\u5b89\u88c5isc-dhcp-server su&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32,37],"tags":[],"class_list":["post-159","post","type-post","status-publish","format-standard","hentry","category-32","category-37"],"_links":{"self":[{"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=\/wp\/v2\/posts\/159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=159"}],"version-history":[{"count":0,"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=\/wp\/v2\/posts\/159\/revisions"}],"wp:attachment":[{"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}