歡迎您光臨本站 註冊首頁

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

←手機掃碼閱讀     火星人 @ 2014-03-23 , reply:0

首先是安裝網卡驅動,如果是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.

[火星人 ] 在linux 環境使用WPA加密上網 以wpa-psk TKIP加密方式位例已經有608次圍觀

http://coctec.com/docs/linux/show-post-115658.html