{"id":541,"date":"2020-02-01T11:18:11","date_gmt":"2020-02-01T03:18:11","guid":{"rendered":"https:\/\/www.hncldz.com\/?p=541"},"modified":"2020-02-01T16:49:36","modified_gmt":"2020-02-01T08:49:36","slug":"%e6%a0%91%e8%8e%93%e6%b4%be4b%e5%88%9b%e5%bb%ba5ghz-wifi%e7%83%ad%e7%82%b9","status":"publish","type":"post","link":"https:\/\/www.hncldz.com\/?p=541","title":{"rendered":"\u6811\u8393\u6d3e4B\u521b\u5efa5Ghz WiFi\u70ed\u70b9"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\"><strong>\u76ee\u6807<\/strong><\/h4>\n\n\n\n<p>\u5728\u6811\u8393\u6d3e4B\u4e0a\u521b\u5efa\u4e00\u4e2a\u9891\u7387\u4e3a5Ghz\u7684WiFi\u70ed\u70b9\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u5185\u5bb9\u5e94\u8be5\u540c\u6837\u9002\u7528\u4e8e\u6811\u8393\u6d3e3B+\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h4_2\"><strong>\u51c6\u5907\u5de5\u4f5c<\/strong><\/h4>\n\n\n\n<p>\u7ed9\u6811\u6885\u6d3e4B\u5237\u5199\u7cfb\u7edf\uff0c\u5177\u4f53\u8fc7\u7a0b\u4e0d\u8d58\u8ff0\uff0c\u6211\u7528\u7684\u662f\u76ee\u524d\u6700\u65b0\u7684\u5b98\u65b9\u7cfb\u7edf\uff0c\u955c\u50cf\u540d\u79f0\u4e3a2019-09-26-raspbian-buster.img\u3002\u7b2c\u4e00\u6b21\u8fdb\u7cfb\u7edf\u65f6\u8bf7\u6b63\u786e\u9009\u62e9\u8bed\u8a00\u3001\u56fd\u5bb6\u3001\u65f6\u533a\u7b49\u7b49<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u7528eth0\u8fde\u7f51<\/strong><\/h4>\n\n\n\n<p>\u7ed9\u6811\u8393\u6d3e\u8fde\u4e0a\u7f51\u7ebf\uff0c\u6839\u636e\u5b9e\u9645\u7f51\u7edc\u73af\u5883\u4f7f\u7528dhcp\u81ea\u52a8\u83b7\u53d6IP\u6216\u8005\u8bbe\u7f6eeth0\u7684\u9759\u6001IP<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h4_10\"><strong>\u56fa\u5b9awlan0\u7684IP<\/strong><\/h4>\n\n\n\n<p>\u7f16\u8f91\u6587\u4ef6\/etc\/dhcpcd.conf\uff0c \u6dfb\u52a0\u5982\u4e0b\u914d\u7f6e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>interface wlan0\nstatic ip_address=192.168.4.1\/24\nnohook wpa_supplicant<\/code><\/pre>\n\n\n\n<p>\u73b0\u5728\u91cd\u542f<code>dhcpcd<\/code>\u5b88\u62a4\u8fdb\u7a0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart dhcpcd<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h4_11\"><strong>\u5b89\u88c5dnsmasq\uff0c\u8bbe\u7f6eDHCP\u670d\u52a1<\/strong><\/h4>\n\n\n\n<p>\u5148\u6765\u8bf4\u660e\u4e00\u4e0b\u6211\u7684\u7f51\u6bb5\u8bbe\u7f6e\uff0c\u6709\u7ebf\u7f51\u7edc\u4f7f\u7528192.168.3.*\u8fd9\u4e2a\u7f51\u6bb5\uff0c\u800c\u65e0\u7ebfAP\u7aef\uff0c\u4f7f\u7528192.168.4.*\u7f51\u6bb5<\/p>\n\n\n\n<p>\u4f7f\u7528\u547d\u4ee4sudo apt-get install dnsmasq\u5b89\u88c5dnsmasq\uff0c\u7f16\u8f91\/etc\/dnsmasq.conf\uff0c\u6dfb\u52a0\u5982\u4e0b\u914d\u7f6e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> listen-address=127.0.0.1,192.168.4.1\n interface=wlan0\n dhcp-range=192.168.4.50,192.168.4.150,12h<\/code><\/pre>\n\n\n\n<p>\u8fd0\u884c\u547d\u4ee4sudo systemctl reload dnsmasq\u6765\u542f\u7528<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h4_12\"><strong>\u5f00\u542f\u5305\u8f6c\u53d1\u3001NAT<\/strong><\/h4>\n\n\n\n<p>Linux\u7cfb\u7edf\u9ed8\u8ba4\u5173\u95ed\u4e86IP\u5305\u8f6c\u53d1\uff0c\u56e0\u6b64\u4e0d\u80fd\u505a\u8def\u7531\u5668\u3002\u6240\u4ee5\u9700\u8981\u5148\u6253\u5f00\u5305\u8f6c\u53d1<\/p>\n\n\n\n<p>\u7f16\u8f91\/etc\/sysctl.conf\uff0c\u53bb\u6389\u4ee5\u4e0b\u5c5e\u6027\u524d\u7684\u6ce8\u91ca:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>net.ipv4.ip_forward=1<\/code><\/pre>\n\n\n\n<p>\u8fd0\u884csudo sysctl -p\u6765\u542f\u7528<\/p>\n\n\n\n<p>\u4e4b\u540e\u8fd0\u884c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE<\/code><\/pre>\n\n\n\n<p>\u6765\u542f\u7528eth0\u7aef\u53e3\u7684NAT<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h4_13\"><strong>\u914d\u7f6e\u9632\u706b\u5899<\/strong><\/h4>\n\n\n\n<p>\u4e0a\u4e00\u6b65\u4e2d\uff0c\u6211\u4eec\u542f\u7528\u4e86\u4e00\u6761\u9632\u706b\u5899\u89c4\u5219\uff0c\u4f46\u662f\u9632\u706b\u5899\u89c4\u5219\u91cd\u542f\u540e\u5c31\u4e22\u5931\u4e86\uff0c\u4e3a\u4e86\u80fd\u591f\u89c4\u5219\u5f00\u673a\u81ea\u52a8\u52a0\u8f7d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528iptables-persistent\u3002\u7528\u547d\u4ee4sudo apt-get install iptables-persistent\u6765\u5b89\u88c5\u8be5\u7ec4\u4ef6\uff0c\u6839\u636e\u5176\u63d0\u793a\u8fdb\u884c\u521d\u6b21\u8bbe\u7f6e\uff08\u4e00\u8def\u786e\u8ba4\uff09\u3002\u8be5\u7ec4\u4ef6\u9ed8\u8ba4\u4f1a\u5c06\u9632\u706b\u5899\u89c4\u5219\u4fdd\u5b58\u5230\/etc\/iptables\/rules.v4\u4e2d\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u4fdd\u5b58\u548c\u8bfb\u5165\u89c4\u5219:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u4fdd\u5b58\u73b0\u6709\u89c4\u5219\n sudo service netfilter-persistent save\n #\u8bfb\u53d6\u5e76\u5e94\u7528\u5148\u6709\u89c4\u5219\n sudo service netfilter-persistent reload<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h4_17\"><strong>\u914d\u7f6ehostapd<\/strong><\/h4>\n\n\n\n<p>\u542f\u7528WIFI\u70ed\u70b9\uff0c\u672c\u6587\u4f7f\u7528\u7684\u662fhostapd\u3002\u9996\u5148\uff0c\u7528\u547d\u4ee4sudo apt-get install hostapd\u5b89\u88c5\u5b83\uff08\u5b89\u88c5\u65f6\u5982\u679c\u51fa\u73b0\u65e0\u6cd5\u4e0b\u8f7d\u8f6f\u4ef6\u5305\u7684\u60c5\u51b5\uff0c\u8bf7\u5c1d\u8bd5\u66f4\u6362\u4e3a\u56fd\u5185\u8f6f\u4ef6\u6e90\uff0c\u5982\u963f\u91cc\u3001\u4e2d\u79d1\u5927\u7684\u6e90\uff09\uff0c\u7136\u540e\u589e\u52a0\u914d\u7f6e\u6587\u4ef6\/etc\/hostapd\/hostapd.conf\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>interface=wlan0\ndriver=nl80211\n\nhw_mode=a\nieee80211n=1\nieee80211ac=1\nieee80211d=1\nieee80211h=1\nrequire_ht=1\nrequire_vht=1\nwmm_enabled=1\ncountry_code=US\n\nvht_oper_chwidth=1\nchannel=149\nvht_oper_centr_freq_seg0_idx=155\nht_capab=[HT40-][HT40+][SHORT-GI-40][DSSS_CCK-40]\n\nwpa=2\nwpa_key_mgmt=WPA-PSK\nrsn_pairwise=CCMP\n\nssid=wifiname\nwpa_passphrase=1234567890<\/code><\/pre>\n\n\n\n<p>\u8bf7\u66f4\u6539\u5176\u4e2d\u7684ssid\u548cwpa_passphrase\u5c5e\u6027\uff0c\u5206\u522b\u4e3a\u65e0\u7ebfAP\u7684\u540d\u79f0\u548c\u5bc6\u7801\u3002\u6ce8\u610fcountry_code=US\u8fd9\u884c\u5fc5\u987b\u6709\uff0c\u66f4\u6362\u4e3a\u5176\u4ed6\u56fd\u5bb6\u4ee3\u7801\u4f3c\u4e4e\u90fd\u4e0d\u884c\u3002<\/p>\n\n\n\n<p>\u4e4b\u540e\u8fd0\u884c\u547d\u4ee4sudo hostapd -d \/etc\/hostapd\/hostapd.conf\u6765\u89c2\u5bdf\u6d4b\u8bd5\uff0c\u6ca1\u6709\u9519\u8bef\u53ef\u4ee5\u8fde\u63a5\uff0c\u5c31OK\u4e86\u3002 CTRL\uff0bC\u540e\uff0c\u7f16\u8f91\/etc\/default\/hostapd\uff0c\u6539\u53d8DAEMON_CONF\u7684\u914d\u7f6e\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DAEMON_CONF=\"\/etc\/hostapd\/hostapd.conf\"<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u6b63\u5f0f\u542f\u52a8AP<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl unmask hostapd\n\nsudo systemctl enable hostapd\n\nsudo systemctl start hostapd<\/code><\/pre>\n\n\n\n<p>\u5173\u673a\u91cd\u542f\u4e00\u4e0b\uff0c\u770b\u770bAP\u662f\u5426\u80fd\u591f\u542f\u52a8\u8d77\u6765\u3002\u5982\u679c\u6b63\u5e38\u5c31OK\u4e86\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u9644\u6ce8\uff1a\u66f4\u6362\u9ed8\u8ba4\u6e90\u4e3a\u963f\u91cc\u4e91\u66f4\u65b0\u6e90<\/strong><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u7f16\u8f91 \/etc\/apt\/sources.list \u6587\u4ef6\uff0c\u5220\u9664\u539f\u6709\u5185\u5bb9\uff0c\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff1a<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>deb http:\/\/mirrors.aliyun.com\/raspbian\/raspbian\/ buster main contrib non-free rpi\ndeb-src http:\/\/mirrors.aliyun.com\/raspbian\/raspbian\/ buster main contrib non-free rpi<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\u6267\u884c\u4e00\u4e0b\u547d\u4ee4sudo apt-get update<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u6807 \u5728\u6811\u8393\u6d3e4B\u4e0a\u521b\u5efa\u4e00\u4e2a\u9891\u7387\u4e3a5Ghz\u7684WiFi\u70ed\u70b9\u3002 \u4ee5\u4e0b\u5185\u5bb9\u5e94\u8be5\u540c\u6837\u9002\u7528\u4e8e\u6811\u8393\u6d3e3B+\u3002 \u51c6\u5907\u5de5\u4f5c \u7ed9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[],"class_list":["post-541","post","type-post","status-publish","format-standard","hentry","category-55"],"_links":{"self":[{"href":"https:\/\/www.hncldz.com\/index.php?rest_route=\/wp\/v2\/posts\/541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hncldz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hncldz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hncldz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hncldz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=541"}],"version-history":[{"count":4,"href":"https:\/\/www.hncldz.com\/index.php?rest_route=\/wp\/v2\/posts\/541\/revisions"}],"predecessor-version":[{"id":560,"href":"https:\/\/www.hncldz.com\/index.php?rest_route=\/wp\/v2\/posts\/541\/revisions\/560"}],"wp:attachment":[{"href":"https:\/\/www.hncldz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hncldz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hncldz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}