红联Linux门户
Linux帮助

在linux 环境使用WPA加密上网 以wpa-psk TKIP加密方式位例

发布时间:2008-02-06 00:02:22来源:红联作者:SMuonon
首先是安装网卡驱动,如果是atheros 的可以用 madwifi 包 可在http://madwifi.org/下载

编译时可能会用到相应的软件包 如linux-headers-'uname -r' , build-essential ,gcc 的软件包。

如果无法上网可以用安装光盘将之添加上,只要将光驱加入源即可

apt-cdrom add

apt-get install linux-headers-* build-essential gcc

linux wpa上网需要安装wpa_supplicant软件包(ubuntu).

可以在http://security.ubuntu.com/ubuntu/pool/main/w/wpasupplicant/ 的目录下在相应的软件包。

设置 WPA 验证资料

wpa_passphrase SSID WPA_Key > /etc/wpa_supplicant/fonera.conf

wpa_supplicant -BDwext -i ath0 -c/etc/wpa_supplicant/fonera.conf



vi /etc/wpa_supplicant.conf

network={

ssid="SSID"
key_mgmt=WPA-PSK
proto=WPA
pairwise=TKIP
group=TKIP
psk="WPA_Key"

}

wpa_supplicant -BDwext -i ath0 -c /etc/wpa_supplicant.conf

获取 IP

dhclient eth1

route add default gw IP_of_AP

如果觉得每次启动都要运行 wpa_supplicant -BDwext -ieth1 -c/etc/wpa_supplicant.conf 命令比较麻烦可以添加后续步骤

Starting All This Stuff Automatically
Your users probably don't want to enter all these commands every time they want to connect to your network. So, if you're feeling benevolent, you can set everything up to start at boot. On Debian, Ubuntu, and the vast herds of other Debian-based distributions, edit /etc/network/interfaces:

auto eth1
iface eth1 inet dhcp
up wpa_supplicant -i ath0 -c/etc/wpa_supplicant.conf -BDwext
down killall wpa_supplicant

-B forks the wpa_supplicant into the background, and -w tells it to do nothing unless the interface is up.

On Fedora and Red Hat, et al, configure your wireless card in the usual manner in /etc/sysconfig/network-scripts/ifcg-eth1, or whatever file belongs to the wireless interface, using the real interface name and MAC address:

DEVICE=eth1
BOOTPROTO=dhcp
HWADDR=11:22:33:44:55:66
ONBOOT=yes
TYPE=Ethernet

Then add these lines to the end of /etc/sysconfig/network-scripts/ifup-wireless, again using your own interface name:

wpa_supplicant -i ath0 -c/etc/wpa_supplicant.conf -BDwext
killall wpa_supplicant

These are simple setups that don't manage multiple locations or do any fancy hotplug management, but they work fine for single locations. We'll cover roaming, multiple profiles, and hotplug interfaces in future installments.
文章评论

共有 0 条评论