设为首页 - 加入收藏 - 网站地图 SecYe安全 Www.SecYe.Com - 国内网络信息安全IT技术门户网
当前位置:首页 > 网络安全 > 无线网络 > 正文

gentoo使用wpa_supplicant配置无线网卡

时间:2016-11-14 10:46 来源:未知 作者:SecYe安全 阅读:

公司全部使用了无线网络,我也被‘逼’的开始研究gentoo的无线上网,看了网上很多文章,以及gentoo文档,但是感觉都让我很迷糊,以下是我使用wpa_supplicant是一些总结

####总结

  • 查看本机的无线网卡

emerge pciutils #这样就有了lspci这个命令
localhost ~ # lspci |grep -i wire
02:00.0 Network controller: Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express) (rev 01)

 

 

可以发现,网卡是Atheros的AR9285

  • 安装wpa_supplicant

emerge -s wpa_supplicant

 

 

  • 生成一个配置配置文件

zcat /usr/share/doc/wpa_supplicant-2.0/wpa_supplicant.conf.bz2 > /etc/wpa_supplicant/wpa_supplicant.conf

 

 

  • 配置,以下是我去掉注释行,空白行等剩下的配置,其中的psk的字符串这样生成:

localhost ~ # wpa_passphrase 我的ssid 我的key
network={
    ssid=”我的ssid”
    #psk=”我的key”
    psk=e596aa911775ed47e04f5b9a9540978203210874eb258208b87cf82b5cf72588
}

 

 

把这段加在配置文件中

localhost ~ # cat /etc/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
eapol_version=1
ap_scan=1
fast_reauth=1
network={
    ssid=”我的ssid”
    psk=e596aa911775ed47e04f5b9a9540978203210874eb258208b87cf82b5cf72588
    priority=2
}

 

 

  • 命令行启动wpa(如果想看详细的信息用于调试,加-d选项)

localhost ~ # wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
Successfully initialized wpa_supplicant
wlan0: Trying to associate with 20:dc:c6:61:ab:34 (SSID=’我的ssid’ freq=2437 MHz)
ioctl[SIOCSIWFREQ]: Device or resource busy
wlan0: Association request to the driver failed
wlan0: Associated with 20:dc:c6:61:ab:34
wlan0: WPA: Key negotiation completed with 20:dc:c6:61:ab:34 [PTK=CCMP GTK=CCMP]
wlan0: CTRL-EVENT-CONNECTED - Connection to 20:dc:c6:61:ab:34 completed [id=0 id_str=]

 

 

其中wlan0: Association request to the driver failed 没关系

  • 安装udhcpc

emerge udhcpc

 

 

  • 通过dhcp自动获得

localhost ~ # dhcpcd wlan0
dhcpcd[12395]: version 5.6.4 starting
dhcpcd[12395]: wlan0: waiting for carrier
dhcpcd[12395]: wlan0: carrier acquired
dhcpcd[12395]: wlan0: carrier lost
dhcpcd[12395]: wlan0: waiting for carrier
dhcpcd[12395]: wlan0: carrier acquired
dhcpcd[12395]: wlan0: sending IPv6 Router Solicitation
dhcpcd[12395]: wlan0: sendmsg: Cannot assign requested address
dhcpcd[12395]: wlan0: rebinding lease of 192.168.0.106
dhcpcd[12395]: wlan0: acknowledged 192.168.0.106 from 192.168.0.1 `�’
dhcpcd[12395]: wlan0: checking for 192.168.0.106
dhcpcd[12395]: wlan0: sending IPv6 Router Solicitation
dhcpcd[12395]: wlan0: leased 192.168.0.106 for 7200 seconds
dhcpcd[12462]: wlan0: wlan0: MTU set to 576
dhcpcd[12395]: forked to background, child pid 12479

 

 

看到了吧 获得了192.168.0.106这个地址

本文来源:SecYe安全网[http://www.secye.com] (责任编辑:SecYe安全)

点击复制链接 与好友分享!

顶一下
(0)
0%
踩一下
(0)
0%