{"id":40109,"date":"2023-02-13T18:00:40","date_gmt":"2023-02-13T10:00:40","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=40109"},"modified":"2023-02-13T18:00:40","modified_gmt":"2023-02-13T10:00:40","slug":"arch-linux-wifi","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/arch-linux-wifi.html","title":{"rendered":"WiFi \u7f51\u7edc\u4e5f\u53ef\u4ee5\u8fd9\u4e48\u73a9"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f\u5176\u4ed6 Linux \u53d1\u884c\u7248 \u800c\u4e0d\u662f Arch CLI\uff0c\u90a3\u4e48\u53ef\u80fd\u4f1a\u4e0d\u4e60\u60ef\u5728\u7ec8\u7aef\u91cc\u8bbe\u7f6e WiFi\u3002\u5c3d\u7ba1\u6574\u4e2a\u8fc7\u7a0b\u6709\u70b9\u7b80\u5355\uff0c\u4e0d\u8fc7\u6211\u8fd8\u662f\u8981\u8bb2\u4e00\u4e0b\u3002\u5728\u8fd9\u7bc7\u6587\u7ae0\u91cc\uff0c\u6211\u5c06\u5e26\u9886\u65b0\u624b\u4eec\u901a\u8fc7\u4e00\u6b65\u6b65\u7684\u8bbe\u7f6e\u5411\u5bfc\uff0c\u628a\u4f60\u4eec\u7684 Arch Linux \u63a5\u5165\u5230\u4f60\u7684 WiFi \u7f51\u7edc\u91cc\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u5728 Linux \u91cc\u6709\u5f88\u591a\u7a0b\u5e8f\u6765\u8bbe\u7f6e\u65e0\u7ebf\u8fde\u63a5\uff0c\u6211\u4eec\u53ef\u4ee5\u7528 ip \u548c iw \u6765\u914d\u7f6e\u56e0\u7279\u7f51\u8fde\u63a5\uff0c\u4f46\u662f\u5bf9\u4e8e\u65b0\u624b\u6765\u8bf4\u6709\u70b9\u590d\u6742\u3002\u6240\u4ee5\u6211\u4eec\u4f1a\u4f7f\u7528 netctl \u547d\u4ee4\uff0c\u8fd9\u662f\u4e00\u4e2a\u57fa\u4e8e\u547d\u4ee4\u884c\u7684\u5de5\u5177\uff0c\u7528\u6765\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\u6765\u8bbe\u7f6e\u548c\u7ba1\u7406\u7f51\u7edc\u8fde\u63a5\u3002<\/p>\n

\"arch-linux-wifi-ts\"<\/p>\n

\u6ce8\u610f<\/strong>\uff1a\u6240\u6709\u7684\u8bbe\u5b9a\u90fd\u9700\u8981 root \u6743\u9650\uff0c\u6216\u8005\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528 sudo \u547d\u4ee4\u6765\u5b8c\u6210\u3002<\/div>\n
<\/div>\n

\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u67e5\u770b\u4f60\u7684\u7f51\u7edc\u63a5\u53e3\uff1a<\/p>\n

iwconfig\r\n<\/pre>\n

\u8fd0\u884c\u5982\u4e0b\u547d\u4ee4\u542f\u7528\u4f60\u7684\u7f51\u7edc\u63a5\u53e3\uff0c\u5982\u679c\u6ca1\u6709\u542f\u7528\u7684\u8bdd\uff1a<\/p>\n

ip link set &nbsp;interface&nbsp;up\r\n<\/pre>\n

\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u641c\u7d22\u53ef\u7528\u7684 WiFi \u7f51\u7edc\u3002\u53ef\u4ee5\u5411\u4e0b\u7ffb\u9875\u6765\u67e5\u770b\u3002<\/p>\n

iwlist interface scan | less\r\n<\/pre>\n
\u6ce8\u610f\uff1a<\/strong> \u547d\u4ee4\u91cc\u7684 interface \u662f\u4e4b\u524d\u7528 iwconfig \u83b7\u53d6\u5230\u7684\u5b9e\u9645\u7f51\u7edc\u63a5\u53e3\u3002<\/div>\n

\u626b\u63cf\u5b8c\uff0c\u5982\u679c\u4e0d\u4f7f\u7528\u8be5\u63a5\u53e3\u53ef\u4ee5\u8fd0\u884c\u5982\u4e0b\u547d\u4ee4\u5173\u95ed\uff1a<\/p>\n

ip link set interface down\r\n<\/pre>\n
\u4f7f\u7528 netctl \u914d\u7f6e Wi-Fi\uff1a<\/strong><\/div>\n

\u5728\u4f7f\u7528 netctl \u8bbe\u7f6e\u8fde\u63a5\u4e4b\u524d\uff0c\u4f60\u5fc5\u987b\u5148\u68c0\u67e5\u4e00\u4e0b\u4f60\u7684\u7f51\u5361\u5728 Linux \u4e0b\u7684\u517c\u5bb9\u6027\u3002<\/p>\n

\u8fd0\u884c\u547d\u4ee4\uff1a<\/p>\n

lspci -k\r\n<\/pre>\n

\u8fd9\u6761\u547d\u4ee4\u662f\u7528\u6765\u68c0\u67e5\u5185\u6838\u662f\u5426\u52a0\u8f7d\u4e86\u4f60\u7684\u65e0\u7ebf\u7f51\u5361\u9a71\u52a8\u3002\u8f93\u51fa\u5fc5\u987b\u662f\u50cf\u8fd9\u6837\u7684\uff1a<\/p>\n

\"\u5982\u4f55\u5728<\/p>\n

\u5982\u679c\u5185\u6838\u6ca1\u6709\u52a0\u8f7d\u9a71\u52a8\uff0c\u4f60\u5c31\u5fc5\u987b\u4f7f\u7528\u6709\u7ebf\u8fde\u63a5\u6765\u5b89\u88c5\u4e00\u4e0b\u3002\u8fd9\u91cc\u662f Linux \u65e0\u7ebf\u7f51\u7edc\u7684\u5b98\u65b9\u7ef4\u57fa\u9875\u9762\uff1ahttps:\/\/wireless.wiki.kernel.org\/\u3002<\/p>\n

\u5982\u679c\u4f60\u7684\u65e0\u7ebf\u7f51\u5361\u548c Linux \u517c\u5bb9\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 netctl configuration\u3002<\/p>\n

netctl \u4f7f\u7528\u914d\u7f6e\u6587\u4ef6\uff0c\u8fd9\u662f\u4e00\u4e2a\u5305\u542b\u8fde\u63a5\u4fe1\u606f\u7684\u6587\u4ef6\u3002\u521b\u5efa\u8fd9\u4e2a\u6587\u4ef6\u6709\u7b80\u5355\u548c\u56f0\u96be\u4e24\u79cd\u65b9\u5f0f\u3002<\/p>\n

\u7b80\u5355\u65b9\u5f0f \u2013 Wifi-menu<\/strong><\/span><\/div>\n

\u5982\u679c\u4f60\u60f3\u7528 wifi-menu\uff0c\u5fc5\u987b\u5b89\u88c5 dialog\u3002<\/p>\n

    \n
  1. \u8fd0\u884c\u547d\u4ee4: wifi-menu<\/li>\n
  2. \u9009\u62e9\u4f60\u7684\u7f51\u7edc\"\u5982\u4f55\u5728<\/li>\n
  3. \u8f93\u5165\u6b63\u786e\u7684\u5bc6\u7801\u5e76\u7b49\u5f85\"\u5982\u4f55\u5728<\/li>\n<\/ol>\n

    \u5982\u679c\u6ca1\u6709\u8fde\u63a5\u5931\u8d25\u7684\u4fe1\u606f\uff0c\u4f60\u53ef\u4ee5\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u786e\u8ba4\u4e0b\uff1a<\/p>\n

    ping -c 3 www.google.com\r\n<\/pre>\n

    \u54c7\uff01\u5982\u679c\u4f60\u770b\u5230\u6b63\u5728 ping\uff0c\u610f\u5473\u7740\u7f51\u7edc\u8bbe\u7f6e\u6210\u529f\u3002\u4f60\u73b0\u5728\u5df2\u7ecf\u5728 Arch Linux \u4e0b\u8fde\u4e0a WiFi \u4e86\u3002\u5982\u679c\u6709\u4efb\u4f55\u95ee\u9898\uff0c\u53ef\u4ee5\u5012\u56de\u53bb\u91cd\u6765\u3002\u4e5f\u8bb8\u6f0f\u4e86\u4ec0\u4e48\u3002<\/p>\n

    >\u56f0\u96be\u65b9\u5f0f<\/strong><\/span><\/div>\n

    \u6bd4\u8d77\u4e0a\u9762\u7684 wifi-menu \u547d\u4ee4\uff0c\u8fd9\u79cd\u65b9\u5f0f\u4f1a\u96be\u4e00\u70b9\u70b9\uff0c\u6240\u4ee5\u6211\u53eb\u505a\u56f0\u96be\u65b9\u5f0f\u3002\u5728\u4e0a\u9762\u7684\u547d\u4ee4\u91cc\uff0c\u7f51\u7edc\u914d\u7f6e\u4f1a\u81ea\u52a8\u751f\u6210\u3002\u800c\u5728\u56f0\u96be\u65b9\u5f0f\u91cc\uff0c\u6211\u4eec\u5c06\u624b\u52a8\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u3002\u4e0d\u8fc7\u4e0d\u8981\u62c5\u5fc3\uff0c\u4e5f\u6ca1\u90a3\u4e48\u96be\u3002\u90a3\u6211\u4eec\u5f00\u59cb\u5427\uff01<\/p>\n

      \n
    1. \u9996\u5148\u7b2c\u4e00\u4ef6\u4e8b\uff0c\u4f60\u5fc5\u987b\u8981\u77e5\u9053\u7f51\u7edc\u63a5\u53e3\u7684\u540d\u5b57\uff0c\u901a\u5e38\u4f1a\u662f wlan0 \u6216 wlp2s0\uff0c\u4f46\u662f\u4e5f\u6709\u5f88\u591a\u4f8b\u5916\u3002\u8981\u786e\u8ba4\u4f60\u81ea\u5df1\u7684\u7f51\u7edc\u63a5\u53e3\uff0c\u8f93\u5165 iwconfig \u547d\u4ee4\u5e76\u8bb0\u4e0b\u6765\u3002\"\u5982\u4f55\u5728<\/a><\/li>\n
    2. \u8fd0\u884c\u547d\u4ee4:\n
      cd \/etc\/netctl\/examples\r\n<\/pre>\n

      \u5728\u8fd9\u4e2a\u76ee\u5f55\u91cc\uff0c\u6709\u5f88\u591a\u4e0d\u540c\u7684\u914d\u7f6e\u6587\u4ef6\u4f8b\u5b50\u3002<\/li>\n

    3. \u62f7\u8d1d\u5c06\u7528\u5230\u7684\u914d\u7f6e\u6587\u4ef6\u4f8b\u5b50\u5230 \/etc\/netctl\/your_profile\n
      cp \/etc\/netctl\/examples\/wireless-wpa \/etc\/netctl\/your_profile\r\n<\/pre>\n<\/li>\n
    4. \u4f60\u53ef\u4ee5\u7528\u8fd9\u4e2a\u547d\u4ee4\u6765\u67e5\u770b\u914d\u7f6e\u6587\u4ef6\u5185\u5bb9: cat \/etc\/netctl\/your_profile\"\u5982\u4f55\u5728<\/li>\n
    5. \u7528 vi \u6216\u8005 nano \u7f16\u8f91\u4f60\u7684\u914d\u7f6e\u6587\u4ef6\u7684\u4e0b\u9762\u51e0\u4e2a\u90e8\u5206\uff1a\n
      nano \/etc\/netctl\/your_profile\r\n<\/pre>\n
      - `Interface`\uff1a\u6bd4\u5982\u8bf4 `wlan0`\r\n- `ESSID`\uff1a\u4f60\u7684\u65e0\u7ebf\u7f51\u7edc\u540d\u5b57\r\n- `key`\uff1a\u4f60\u7684\u65e0\u7ebf\u7f51\u7edc\u5bc6\u7801\r\n<\/pre>\n<\/li>\n<\/ol>\n

      \u6ce8\u610f:<\/strong><\/p>\n

      \u5982\u679c\u4f60\u4e0d\u77e5\u9053\u600e\u4e48\u7528 nano\uff0c\u6253\u5f00\u6587\u4ef6\u540e\uff0c\u7f16\u8f91\u8981\u4fee\u6539\u7684\u5730\u65b9\uff0c\u5b8c\u4e86\u6309 ctrl+o\uff0c\u7136\u540e\u56de\u8f66\uff0c\u7136\u540e\u6309 ctrl+x\u3002<\/p>\n

      \"\u5982\u4f55\u5728<\/p>\n

      \u8fd0\u884c netctl<\/strong><\/div>\n
        \n
      1. \u8fd0\u884c\u547d\u4ee4\uff1a\n
        cd \/etc\/netctl\r\nls\r\n<\/pre>\n

        \u4f60\u4e00\u5b9a\u4f1a\u770b\u5230 wifi-menu \u751f\u6210\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u6bd4\u5982 wlan0-SSID\uff1b\u6216\u8005\u4f60\u9009\u62e9\u4e86\u56f0\u96be\u65b9\u5f0f\uff0c\u4f60\u4e00\u5b9a\u4f1a\u770b\u5230\u4f60\u81ea\u5df1\u521b\u5efa\u7684\u914d\u7f6e\u6587\u4ef6\u3002<\/li>\n

      2. \u8fd0\u884c\u547d\u4ee4\u542f\u52a8\u8fde\u63a5\u914d\u7f6e\uff1anetctl start your_profile\u3002<\/li>\n
      3. \u7528\u4e0b\u9762\u7684\u547d\u4ee4\u6d4b\u8bd5\u8fde\u63a5\uff1a\n
        ping -c 3 www.google.com\r\n<\/pre>\n

        \u8f93\u51fa\u770b\u4e0a\u53bb\u50cf\u8fd9\u6837\uff1a \"\u5982\u4f55\u5728<\/li>\n

      4. \u6700\u540e\uff0c\u4f60\u5fc5\u987b\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff1anetctl enable your_profile\u3002\n
        netctl enable your_profile\r\n<\/pre>\n

        \u8fd9\u6837\u5c06\u521b\u5efa\u5e76\u6fc0\u6d3b\u4e00\u4e2a systemd \u670d\u52a1\uff0c\u7136\u540e\u5f00\u673a\u65f6\u81ea\u52a8\u542f\u52a8\u3002\u7136\u540e\u6b22\u547c\u5427\uff01\u4f60\u5728\u4f60\u7684 Arch Linux \u91cc\u914d\u7f6e\u597d wifi \u7f51\u7edc\u5566\u3002<\/li>\n<\/ol>\n

        \u5176\u4ed6\u5de5\u5177<\/strong><\/div>\n

        \u4f60\u8fd8\u53ef\u4ee5\u4f7f\u7528\u5176\u4ed6\u7a0b\u5e8f\u6765\u8bbe\u7f6e\u65e0\u7ebf\u8fde\u63a5\uff1a<\/p>\n

        iw\uff1a<\/p>\n

          \n
        1. iw dev wlan0 link \u2013 \u72b6\u6001<\/li>\n
        2. iw dev wlan0 scan \u2013 \u641c\u7d22\u7f51\u7edc<\/li>\n
        3. iw dev wlan0 connect your_essid \u2013 \u8fde\u63a5\u5230\u5f00\u653e\u7f51\u7edc<\/li>\n
        4. iw dev wlan0 connect your_essid key your_key - \u4f7f\u7528 16 \u8fdb\u5236\u5bc6\u94a5\u8fde\u63a5\u5230 WEP \u52a0\u5bc6\u7684\u7f51\u7edc<\/li>\n<\/ol>\n

          wpa_supplicant<\/p>\n