Linux怎么配置 WPA-PSK无线上网WPA-PSK(Pre-Shared Key),也叫做WPA Personal,是一种比较理想的家庭或小公司无线上网方案。这种方法基于共享口令,只要上网环境没有大嘴先生或女士,还算比较安全。 Linux存取WPA-PSK需要wpa_supplicant软件,Debian和它的派生系列叫做wpasupplicant,配置文件一般保存为/etc/wpa_supplicant.conf。 运行如下命令生成配置文件 $ wpa_passphrase myssid network={ ssid="myssid" #psk="waylongkeythelongerthebetterbecausewecareaboutsecurityalot" psk=ef82e334d941fd88ee8e6d6ef9d112eed40e93e2aa560fcaa326c29659ad375d } 输入ssid的口令waylongkeythelongerthebetterbecausewecareaboutsecurityalot,把以上 命令的输出保存为配置文件 /etc/wpa_supplicant.conf,假设无线接口为eth1,可用下面的命令测试一下 # iwconfig eth1 essid "myessid" # ifconfig eth1 up # wpa_supplicant -ieth1 -c/etc/wpa_supplicant.conf -i参数指定无线网络接口,-c指定配置文件,参数值前不要留空格。 运行下面的命令检查是否无线正常 $ iwconfig eth1 如果一切顺利,可把该过程加到开机启动脚本里,如果是Debian或者Ubuntu,编辑 /etc/network/interfaces auto eth1 iface eth1 dhcp up wpa_supplicant -ieth1 -c/etc/wpa_supplicant.conf -B down killall wpa_supplicant 参数-B指定以后台方式运行 如果是 RHEL或者Fedora,编辑 /etc/sysconfig/network-scripts/ifcfg-eth1,如下 DEVICE=eth1 BOOTPROTO=dhcp HWADDR=11:22:33:44:55:66 ONBOOT=yes TYPE=Ethernet 把如下行加入 /etc/sysconfig/network-scripts/ifup-wireless wpa_supplicant -iath1 -c/etc/wpa_supplicant.conf -B killall wpa_supplicant |
|