{"id":6610,"date":"2019-12-23T11:14:33","date_gmt":"2019-12-23T03:14:33","guid":{"rendered":"https:\/\/blog.hoyo.idv.tw\/?p=6610"},"modified":"2023-10-02T11:20:53","modified_gmt":"2023-10-02T03:20:53","slug":"nanopi-rtl8188cus-hostapd-%e5%ae%89%e8%a3%9d","status":"publish","type":"post","link":"https:\/\/blog.hoyo.idv.tw\/?p=6610","title":{"rendered":"NanoPi - RTL8188CUS hostapd \u5b89\u88dd"},"content":{"rendered":"<p>\u524d\u9762\u6709\u4e00\u7bc7\u00a0<a href=\"https:\/\/blog.hoyo.idv.tw\/?p=6293\" target=\"_blank\" rel=\"noopener\">NanoPi \u2013 USB \u7db2\u8def\u5361 ( WiFi AP \u61c9\u7528 )<\/a>\u00a0\u771f\u7684\u8981\u6e2c\u8a66\u7684\u540c\u5b78\u61c9\u8a72\u90fd\u5931\u6557\u4e86\uff0c\u56e0\u70ba\u6587\u7ae0\u5167\u7684\u7db2\u5361\u662f\u591a\u5e74\u524d\u7684\u7522\u54c1\u4f7f\u7528 Ralink RT2573 \u6676\u7247\uff0c\u96d6\u7136\u539f\u751f\u652f\u63f4\u9810\u8a2d hostapd nl80211 driver \uff0c\u53ef\u662f\u6839\u672c\u5c31\u8cb7\u4e0d\u5230\u4e86\u3002<\/p>\n<p>\u53cb\u5584\u4e4b\u81c2\u5b98\u7db2\u6709\u8ce3\u00a0<a href=\"https:\/\/www.friendlyarm.com\/index.php?route=product\/product&amp;path=71&amp;product_id=143\" target=\"_blank\" rel=\"noopener\">EDUP EP-N8508 USB WiFi<\/a> \uff0c\u4f7f\u7528\u7684\u662f\u00a0Realtek8188CUS \u6676\u7247\uff0c\u7d93\u904e\u4e5d\u4e5d\u516b\u5341\u4e00\u96e3\u5b89\u88dd\u904e\u7a0b\u5982\u4e0b<\/p>\n<p>--<\/p>\n<h2>\u74b0\u5883\u6e96\u5099<\/h2>\n<pre class=\"lang:default decode:true\"># apt update\r\n# apt install git pkg-config libnl-3-dev libnl-genl-3-dev libssl-dev<\/pre>\n<p>--<\/p>\n<h2>\u8a2d\u5b9a wlan \u56fa\u5b9a IP<\/h2>\n<pre class=\"lang:default decode:true \"># vi \/etc\/network\/interfaces\r\n\r\nallow-hotplug wlan0\r\nauto wlan0\r\n    iface wlan0 inet static\r\n    address 172.17.1.1\r\n    netmask 255.255.255.0<\/pre>\n<p>\u91cd\u65b0\u555f\u52d5\u7db2\u8def\u8b93\u8a2d\u5b9a\u751f\u6548<\/p>\n<ul>\n<li><a href=\"https:\/\/linuxconfig.org\/how-to-restart-network-on-ubuntu-18-04-bionic-beaver-linux\" target=\"_blank\" rel=\"noopener\">How to restart network on Ubuntu 18.04 Bionic Beaver Linux<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\"># systemctl restart NetworkManager<\/pre>\n<p>--<\/p>\n<h2>\u5b89\u88dd\u652f\u63f4 RTL8188\u00a0 \u7684 hostapd \u7248\u672c<\/h2>\n<pre class=\"lang:default decode:true\"># cd \/home\/pi\r\n# git clone https:\/\/github.com\/lostincynicism\/hostapd-rtl8188.git\r\n# cd hostapd-rtl8188\/hostapd\r\n# make\r\n# make install<\/pre>\n<p>\u9a57\u8b49\u662f\u5426\u5b89\u88dd\u5b8c\u6210<\/p>\n<pre class=\"lang:default decode:true \">root@NanoPi-NEO:\/home\/pi\/hostapd-rtl8188\/hostapd# hostapd -v\r\nhostapd v2.4 for Realtek rtl871xdrv\r\nUser space daemon for IEEE 802.11 AP management,\r\nIEEE 802.1X\/WPA\/WPA2\/EAP\/RADIUS Authenticator\r\nCopyright (c) 2002-2015, Jouni Malinen &lt;j@w1.fi&gt; and contributors<\/pre>\n<p>--<\/p>\n<h2>\u5c07 wlan \u812b\u96e2\u00a0NetworkManager \u7ba1\u7406<\/h2>\n<pre class=\"lang:default decode:true\">root@NanoPi-NEO:\/home\/pi\/hostapd-rtl8188\/hostapd# nmcli dev\r\nDEVICE  TYPE      STATE         CONNECTION\r\neth0    ethernet  connected     Wired connection 1\r\nwlan0   wifi      disconnected  --\r\nlo      loopback  unmanaged     --<\/pre>\n<p>\u91cd\u65b0\u555f\u52d5\u00a0NetworkManager<\/p>\n<pre class=\"lang:default decode:true\"># systemctl restart NetworkManager<\/pre>\n<p>wlan0 \u5df2\u7d93\u812b\u96e2\u00a0NetworkManager \u7ba1\u7406<\/p>\n<pre class=\"lang:default decode:true\">root@NanoPi-NEO:\/home\/pi\/hostapd-rtl8188\/hostapd# nmcli dev\r\nDEVICE  TYPE      STATE                                  CONNECTION\r\neth0    ethernet  connecting (getting IP configuration)  Wired connection 1\r\nlo      loopback  unmanaged                              --\r\nwlan0   wifi      unmanaged                              --<\/pre>\n<p>--<\/p>\n<h2>hostapd.conf<\/h2>\n<pre class=\"lang:default decode:true\">vi \/etc\/hostapd.conf\r\n\r\ninterface=wlan0\r\ndriver=nl80211\r\nssid=DAEGateway\r\nchannel=8\r\nmacaddr_acl=0\r\nauth_algs=1\r\nignore_broadcast_ssid=0<\/pre>\n<p>\u555f\u52d5\u7a0b\u5f0f\u6e2c\u8a66<\/p>\n<pre class=\"lang:default decode:true \"># hostapd -d \/etc\/hostapd.conf<\/pre>\n<p>\u5982\u679c\u57f7\u884c\u8a0a\u606f\u6c92\u6709\u932f\u8aa4\u505c\u6b62\uff0c\u90a3\u5c31\u662f\u5df2\u7d93\u6210\u529f\u5b8c\u6210\u4e86<\/p>\n<p>--<\/p>\n<h2>\u81ea\u8a02 hostapd service<\/h2>\n<pre class=\"lang:default decode:true\"># vi \/lib\/systemd\/system\/hostapd.service\r\n\r\n[Unit]\r\nDescription=hostapd\r\n\r\n[Service]\r\nType=idle\r\nRestart=on-failure\r\nRestartSec=3s\r\nExecStart=\/usr\/sbin\/hostapd -d \/etc\/hostapd.conf\r\nExecStop=\/bin\/kill $MAINPID\r\n\r\n[Install]\r\nWantedBy=multi-user.target<\/pre>\n<p>\u958b\u6a5f\u57f7\u884c\u53ca\u555f\u52d5<\/p>\n<pre class=\"lang:default decode:true\"># systemctl enable hostapd\r\n# systemctl start hostapd<\/pre>\n<p>--<\/p>\n<h2>RT8188CUS \u6676\u7247\u8cc7\u8a0a<\/h2>\n<pre class=\"lang:default decode:true\">root@NanoPi-NEO:~# lsusb\r\nBus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub\r\nBus 005 Device 002: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter\r\nBus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub\r\nBus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub\r\nBus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub\r\nBus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub\r\nBus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub\r\nBus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub\r\nBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub\r\nBus 009 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub\r\nroot@NanoPi-NEO:~# lsmod\r\nModule                  Size  Used by\r\nrtl8192cu              81920  0\r\nrtl_usb                20480  1 rtl8192cu\r\nrtl8192c_common        49152  1 rtl8192cu\r\nrtlwifi                73728  3 rtl_usb,rtl8192c_common,rtl8192cu\r\nnls_ascii              16384  1\r\n8189es               1024000  0\r\nbrcmfmac              180224  0\r\nbrcmutil               16384  1 brcmfmac\r\nxradio_wlan           110592  0\r\n88XXau               1753088  0\r\n8821cu               1683456  0\r\ng_mass_storage         16384  0<\/pre>\n<p>--<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"6610\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;5,515&nbsp;total views, &nbsp;1&nbsp;views today<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u9762\u6709\u4e00\u7bc7\u00a0NanoPi \u2013 ...<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"6610\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;5,515&nbsp;total views, &nbsp;1&nbsp;views today<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[308],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/6610"}],"collection":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6610"}],"version-history":[{"count":15,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/6610\/revisions"}],"predecessor-version":[{"id":6634,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/6610\/revisions\/6634"}],"wp:attachment":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}