概述

最近须在一台只有无线网络连接的电脑上安装gentoo,特意记录下过程

配置

配置内核

  1. 检查是否存在无线网卡
lspci | grep Wireless
  1. 配置内核
cd /usr/src/linux
make nconfig
[*] Networking support  --->
    [*] Wireless  --->
        <*>   cfg80211 - wireless configuration API
        [ ]     nl80211 testmode command
        [ ]     enable developer warnings
        [ ]     cfg80211 regulatory debugging
        [ ]     cfg80211 certification onus
        [*]     enable powersave by default
        [ ]     cfg80211 DebugFS entries
        [ ]     use statically compiled regulatory rules database
        [ ]     cfg80211 wireless extensions compatibility
        <*>   Generic IEEE 802.11 Networking Stack (mac80211)
        [*]   Minstrel
        [*]     Minstrel 802.11n support
        [ ]       Minstrel 802.11ac support
              Default rate control algorithm (Minstrel)  --->
        [ ]   Enable mac80211 mesh networking (pre-802.11s) support
        -*-   Enable LED triggers
        [ ]   Export mac80211 internals in DebugFS
        [ ]   Trace all mac80211 debug messages
        [ ]   Select mac80211 debugging features  ----

[*] Networking support  --->
    [*] Wireless  --->
        [*]     cfg80211 wireless extensions compatibility

网卡驱动

Device Drivers --->
    [*] Network device support --->
        [*] Wireless LAN --->
            [*] Atheros/Qualcomm devices
                [*] Atheros 802.11n wireless cards support
                ... 附属的ath9k选项一并选上
  1. 编译
make && make modules_install

更新内核,initramfs
4. 重启

reboot
  1. 检查无线网卡是否识别成功
ifconfig -a

wifi检测工具

  1. 安装
emerge wireless-tools
  1. 查看无线网络
iwlist wlp5s0 scan
# 下面会输出电脑附近的wifi网络信息

配置无线网络链接

  1. 安装 wpa_supplicant
emerge wpa_supplicant
  1. 设置配置文件
vim /etc/wpa_supplicant/wpa_supplicant-nl82011-wlp5s0.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
ap_scan=1
#update_config=1
 
network={
        ssid="YourSSID"
        psk="your-secret-key"
        scan_ssid=1
        proto=RSN
        key_mgmt=WPA-PSK
        group=CCMP TKIP
        pairwise=CCMP TKIP
        priority=5
}
  1. 启用服务
systemctl enable wpa_supplicant-nl80211@wlp5s0
systemctl start wpa_supplicant-nl80211@wlp5s0
  1. 测试
ping baidu.com

参考链接

wpa_supplicant
wpa_supplicant.conf配置文件说明