手动配置 Ubuntu 12.04 无线网络

以前 Ubuntu下的无线网络配置一直用  Network Manager,  比较方便和省事,基本上不需要配置什么,网络就可以用起来了。

前天对系统做了一下自动更新,结果  Network Manager 不能用了,网络也不通;网上  google 下,也没有找到可用的解决方案。

 一气之下,把 network manager 删了,决心自己手动配置。

还是在网上参考了很多资料,最后总算配置起来了。


$ cat  /etc/network/interfaces 
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet dhcp
pre-up ip link set wlan0 up
pre-up iwconfig wlan0 essid myssid
wpa-ssid myssid
wpa-key-mgmt WPA-PSK
wpa-group TKIP CCMP
wpa-psk mypasswd


auto dsl-provider
iface dsl-provider inet ppp
pre-up /sbin/ifconfig wlan0 up # line maintained by pppoeconf
provider dsl-provider

我使用电信宽带拨号上网,所以要先设置好无线连接,再配置 PPP.

之后,重新启动  网络:

$ sudo /etc/init.d/networking  restart
 * Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
 * Reconfiguring network interfaces...                                          Plugin rp-pppoe.so loaded.
PPP session is 15760
Connected to 00:90:1a:a3:10:4e via interface wlan0
Using interface ppp0
Connect: ppp0 <--> wlan0
PAP authentication succeeded
peer from calling number 00:90:1A:A3:10:4E authorized
replacing old default route to wlan0 [192.168.1.1]
local  IP address 114.221.181.158
remote IP address 61.155.116.121
primary   DNS address 218.2.135.1
secondary DNS address 61.147.37.1
                                                                         [ OK 
看起来是没有问题了。

但是,打开网页的时候,一个是非常慢,还有就是很多网页打不开。但是,如果直接输入IP地址,则可以正确访问。

所以很可能是  DNS配置有问题。

$ cat /etc/resolv.conf 
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.1.1
nameserver 198.41.0.4
nameserver 218.2.135.1

默认的 DNS地址 192.168.1.1 是无线路由器的地址,不是 nameserver 的地址;难怪会出错。

又在网上搜了一下,发现了一个解决方法,那就是编辑  /etc/resolvconf/interface-order
注释掉 含有  wlan 的那一行:

cat  /etc/resolvconf/interface-order  
# interface-order(5)
lo.inet*
lo.dnsmasq
lo.pdnsd
lo.!(pdns|pdns-recursor)
lo
tun*
tap*
hso*
em+([0-9])?(_+([0-9]))*
p+([0-9])p+([0-9])?(_+([0-9]))*
eth*
ath*
#wlan*
ppp*
*

然后重新启动网络,查看 DNS:

$ cat /etc/resolv.conf 
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 218.2.135.1
nameserver 61.147.37.1
nameserver 192.168.1.1

这个时候,虽然 192.168.1.1 还存在,但它已经到最后的位置了,

现在重新打开网页,可以正常浏览了!

上面说的有些改动,自己也不清楚其中的原理,等以后有时间慢慢研究!


你可能感兴趣的:(manager,ubuntu,Authentication,NetWork,interface,deprecated)