如何在命令行手动配置无线连接[已解决]
发表于 : 2009-11-29 17:26
代码: 全选
###########/etc/network/interfaces###########
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0 # or allow-hotplug eth0
iface eth0 inet static # or dhcp
hwaddress ether xx:xx:xx:xx:xx:xx
address xxx.xxx.xxx.xxx
netmask 255.255.255.0
gateway xxx.xxx.xxx.xxx
# The wireless network interface
auto wlan0 # or allow-hotplug wlan0
iface wlan0 inet static # or dhcp
hwaddress ether xx:xx:xx:xx:xx:xx
address xxx.xxx.xxx.xxx
netmask 255.255.255.0
gateway xxx.xxx.xxx.xxx
#WEP
wireless-essid xxxx
wireless-keymode open|restricted
wireless-key 12345|s:ascii
#WPA
wpa-ssid xxxx
wpa-driver wext
wpa-psk plaintext|hexadecimal
###############/etc/resolv.conf###############
# OpenDNS
nameserver 208.67.222.222
nameserver 208.67.220.220
##################MAC-Change##################
sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
sudo ifconfig eth0 up
############Make it in operation#############
sudo /etc/init.d/networking restart
############Manual wired operation#############
ifconfig eth0 up
#DHCP
dhclient eth0
#Static
ifconfig eth0 xxx.xxx.xxx.xxx netmask 255.255.255.0
route add default gw xxx.xxx.xxx.xxx
##########Manual wireless operation###########
ifconfig wlan0 up
iwlist wlan0 scan
#No encryption
iwconfig wlan0 essid "ssid"
#WEP
iwconfig wlan0 essid "ssid" key 1234567890
iwconfig wlan0 essid "ssid" key s:asciikey
#WPA/WPA2
wpa_passphrase [ssid] [passphrase] >> /etc/wpa_supplicant.conf
wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf
#DHCP
dhclient wlan0
#Static
ifconfig wlan0 xxx.xxx.xxx.xxx netmask 255.255.255.0
route add default gw xxx.xxx.xxx.xxx
你是说nm-applet看到的,还是iwconfig看到的。正常检测到无线信号
adaml 写了:LZ很幸运 我总结的
代码: 全选
###########/etc/network/interfaces########### # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 # or allow-hotplug eth0 iface eth0 inet static # or dhcp hwaddress ether xx:xx:xx:xx:xx:xx address xxx.xxx.xxx.xxx netmask 255.255.255.0 gateway xxx.xxx.xxx.xxx # The wireless network interface auto wlan0 # or allow-hotplug wlan0 iface wlan0 inet static # or dhcp hwaddress ether xx:xx:xx:xx:xx:xx address xxx.xxx.xxx.xxx netmask 255.255.255.0 gateway xxx.xxx.xxx.xxx #WEP wireless-essid xxxx wireless-keymode open|restricted wireless-key 12345|s:ascii #WPA wpa-ssid xxxx wpa-driver wext wpa-psk plaintext|hexadecimal ###############/etc/resolv.conf############### # OpenDNS nameserver 208.67.222.222 nameserver 208.67.220.220 ##################MAC-Change################## sudo ifconfig eth0 down sudo ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx sudo ifconfig eth0 up ############Make it in operation############# sudo /etc/init.d/networking restart ############Manual wired operation############# ifconfig eth0 up #DHCP dhclient eth0 #Static ifconfig eth0 xxx.xxx.xxx.xxx netmask 255.255.255.0 route add default gw xxx.xxx.xxx.xxx ##########Manual wireless operation########### ifconfig wlan0 up iwlist wlan0 scan #No encryption iwconfig wlan0 essid "ssid" #WEP iwconfig wlan0 essid "ssid" key 1234567890 iwconfig wlan0 essid "ssid" key s:asciikey #WPA/WPA2 wpa_passphrase [ssid] [passphrase] >> /etc/wpa_supplicant.conf wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf #DHCP dhclient wlan0 #Static ifconfig wlan0 xxx.xxx.xxx.xxx netmask 255.255.255.0 route add default gw xxx.xxx.xxx.xxx
eexpress 写了:你是说nm-applet看到的,还是iwconfig看到的。
cli和gui的2套管理,有冲突的。最好你说清楚。免得把你推入万丈深渊哦。
代码: 全选
iwlist eth2 scanning
代码: 全选
eth2 Scan completed :
Cell 01 - Address: 00:0F:B5:6A:D4:F6
ESSID:"NETGEAR"
Protocol:IEEE 802.11bg
Mode:Master
Frequency:2.462 GHz (Channel 11)
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s
11 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Quality=95/100 Signal level=-31 dBm
Extra: Last beacon: 224ms ago
iwconfig eth2
代码: 全选
eth2 unassociated ESSID:off/any
Mode:Managed Channel=0 Access Point: Not-Associated
Bit Rate:0 kb/s Tx-Power=20 dBm Sensitivity=8/0
Retry limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
现在不想装别的软件了。。只是想手工配置一下。。eexpress 写了:iwlist scan的哦。
那没关系。
最好使用gui的nm-applet搞无线。方便。
如果不愿意。
就搞一个脚本。其中wlan0,是可以tab补全的。
iwconfig wlan0 essid "ssid" key 1234567890
就应该在iwconfig看到Access Point是连接状态了。
eth2?
testing 写了:好文章!!!
通过LZ的文章我已经解决无线网卡的问题了,唉!搞了三天终于搞掂了。
现时还有个问题就是如果 wpa 的加密码模式下没有任何问题,但如果是 wpa2 personal 的话可连接上,但10秒左右就会断线,/etc/init.d/networking restart 一下又好了,然后10秒左右又断开!
请指教是什么问题?
环境: ubuntu 9.10 server + D-LINK DWL-520+A