Chinaunix首页 | 论坛 | 博客
  • 博客访问: 235754
  • 博文数量: 25
  • 博客积分: 643
  • 博客等级: 上士
  • 技术积分: 359
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-03 13:18
文章分类

全部博文(25)

文章存档

2017年(1)

2013年(1)

2012年(7)

2011年(16)

分类: LINUX

2011-05-07 23:53:11

  

一 环境     

   统:Ubuntu 10.04

3G模块:华为E1750

 

安装usb-modeswitch软件

       E1750 无线上网卡并没有提供linux环境下的驱动程序(听说新版的linux内核可以直接驱动,ubuntu10.04应该也能,只是我没怎么验证),但我们可以通过USB模式转换来让linux系统能识别并能使用E1750无线模块。USB_ModeSwitch是一个用来控制“flip flop”(多重设备)USB装置的USB模块转换工具,USB_ModeSwitch 从配置文件中读取重要的参数并实现所有初始化以及通讯,其中还需要来自"libusb"的重量级支持。具体信息可参看网页:      

    在网页上下载USB模式转换的软件安装包:

usb-modeswitch-1.1.7.tar.bz2   

usb-modeswitch-data-20110227.tar.bz2   //可以不用

libusb-dev  //可不用下载,直接使用apt-get命令来安装

 

1>安装libusb-dev库文件

$ sudo apt-get install libusb-dev

 

2>安装usb-modeswitch-data

$tar jxvf usb-modeswitch-data-20110227.tar.bz2     //这不其实不是必须的

$cd usb-modeswitch-data-20110227

$ sudo make install //将会在etc/usb_modeswitch.d安装一个配置文件,并且在/lib/udev/rules.d中安装udev规则文件

 

3>安装usb-modeswitch

$ tar jxvf usb-modeswitch-1.1.7.tar.bz2

$ cd usb-modeswitch-1.1.7

$ sudo make install  //此时将会在udev中安装一个shell脚本,一个大包装脚本,一个配置文件,man手册和新的二进制编译文件usb_modeswitch

 

使用usb-modeswitch调试一个未知的新设备,有两种方式进行调试:

u  使用配置文件

       使用配置文件,需要编写一个与自己硬件相关的配置文件,可参看usb-modeswitch-1.1.7下的device_reference.txt文件中,查找与自己硬件相关的部分,用做配置信息。如对于E1750无线网卡,在device_reference.txt文件中可查找到如下内容:

########################################################

# Huawei E1550

# Huawei E1750

#

# Contributor: Anders Blomdell, Ahmed Soliman

DefaultVendor=  0x12d1

DefaultProduct= 0x1446

TargetVendor=   0x12d1

TargetProduct=  0x1001

MessageContent="55534243123456780000000000000011060000000000000000000000000000"

       即可将此部分内容复制用来编写自己的配置文件(usb-modeswitch.setup,叫什么名字无所谓,只要在使用usb-modeswitch命令的时候,用“-c”来指定该文件即可),不过可能还需要根据实际检测到得ID信息来编写DefaultVendorDefaultProductTargetVendorTargetProduct等值。

u  使用命令行

使用命令行之前,需要usb_modeswitch –h来查看相应的usb_modeswitch命令,在根据

device_reference.txt文件中的相应信息,即可使用。

$ sudo usb_modeswitch -W -v 12d1 -p 1001 -V 12d1 -P 1001 -M

"55534243123456780000000000000011060000000000000000000000000000"

/*此命令行的作用相当于使用sudo usb_modeswitch -W –c usb_modeswitch.setup

usb_modeswitch.setup文件内容如下:

DefaultVendor=  0x12d1

DefaultProduct= 0x1001

TargetVendor=   0x12d1

TargetProduct=  0x1001

MessageContent="55534243123456780000000000000011060000000000000000000000000000"

*/

 

三 转换E1750 3G模块模式

    如果你的虚拟机的右下角没有出现USB设备的标识,那么可能是XP系统中的虚拟机USB相关服务没开。这时,在开始-->运行中执行services.msc命令,找到Vmware USB  Arbitration Service项,并启动,启动虚拟机系统后,便会出现USB设备的标识了,对他点击右键,连接或者断开设备即可。

使用lsusb命令查看E1750设备ID等信息

$ lsusb    //显示当前挂在的USB模块信息

Bus 002 Device 002: ID 0e0f:0002 VMware, Inc. Virtual USB Hub

Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 001 Device 036: ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB Modem  

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

注意红色的部分,在ubuntu系统中,如果先装了usb_modeswitch,则插上3G模块后,就会自动转换ID信息等,这里已经转换过的,转换之前ID为:12d1:1446。

    如果使用lsusb命令看到的ID信息还是12d1:1446,那么就需要使用usb_modeswitch转换了。

    创建usb_modeswitch.setup配置文件

$ sudo gedit usb_modeswitch.setup   //新建usb_modeswitch.setup,写入如下器件模块信息

########################################################

# Huawei E1750

DefaultVendor=0x12d1

DefaultProduct=0x1446

TargetVendor=0x12d1

TargetProduct=0x1001

MessageContent="55534243123456780000000000000011060000000000000000000000000000"

 

$ sudo usb_modeswitch -c usb_modeswitch.setup

       注:usb_modeswitch.setup中保存了要进行USB模式转换的设备ID的信息,可参考usb-modeswitch-1.1.7文件夹下的device_reference.txt文件来选择相应的设备信息。

 

四 使用wvdial拨号软件上网

       Wvdiallinux下的一款智能化拨号工具,利用wvdialppp可以实现linux下的轻松上网。在整个过程中,wvdial的作用是拨号并等待提示,并根据提示输入相应的用户名和密码等认证信息;ppp的作用是与拨入放协商传输数据的方法并维持该链接。使用wvdial时,需要使用/etc/wvdial.conf配置文件,这个配置文件可以自动生成,但是可能需要进行一点修改。Wvdial载入wvdial.conf配置文件后,会对modem进行初始化并拨号,拨号后等待拨入方的响应,收到拨入方响应后则启动pppd。注:pppdubuntu10.04上已经安装了,所以这里就不需要管它。

 

1>下载安装wvdail

$ sudo apt-get install wvdial

 

2>配置wvdail,创建/etc/wvdial.conf文件

$ sudo wvdialconf /etc/wvdial.conf

Editing `/etc/wvdial.conf'.

Scanning your serial ports for a modem.   //自动扫描外部硬件模块生成相应的配置文件

ttyS0<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud

ttyS0<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud

ttyS0<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.

ttyS1<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud

ttyS1<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud

ttyS1<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.

Modem Port Scan<*1>: S2   S3  

WvModem<*1>: Cannot get information for serial port.

ttyUSB_utps_diag<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud

ttyUSB_utps_diag<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 9600 baud

ttyUSB_utps_diag<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.

WvModem<*1>: Cannot get information for serial port.

ttyUSB_utps_modem<*1>: ATQ0 V1 E1 -- OK

ttyUSB_utps_modem<*1>: ATQ0 V1 E1 Z -- OK

ttyUSB_utps_modem<*1>: ATQ0 V1 E1 S0=0 -- OK

ttyUSB_utps_modem<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK

ttyUSB_utps_modem<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK

ttyUSB_utps_modem<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK

ttyUSB_utps_modem<*1>: Modem Identifier: ATI -- Manufacturer: huawei

ttyUSB_utps_modem<*1>: Speed 9600: AT -- OK

ttyUSB_utps_modem<*1>: Max speed is 9600; that should be safe.

ttyUSB_utps_modem<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK

WvModem<*1>: Cannot get information for serial port.

ttyUSB_utps_pcui<*1>: ATQ0 V1 E1 -- OK

ttyUSB_utps_pcui<*1>: ATQ0 V1 E1 Z -- OK

ttyUSB_utps_pcui<*1>: ATQ0 V1 E1 S0=0 -- OK

ttyUSB_utps_pcui<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK

ttyUSB_utps_pcui<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK

ttyUSB_utps_pcui<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK

ttyUSB_utps_pcui<*1>: Modem Identifier: ATI -- Manufacturer: huawei

ttyUSB_utps_pcui<*1>: Speed 9600: AT -- OK

ttyUSB_utps_pcui<*1>: Max speed is 9600; that should be safe.

ttyUSB_utps_pcui<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK

 

Found a modem on /dev/ttyUSB_utps_modem.  //找到E1750经过usb转换后的linux设备文件

Modem configuration written to /etc/wvdial.conf. //创建/etc/wvdial.conf配置文件

ttyUSB_utps_modem: Speed 9600; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

ttyUSB_utps_pcui: Speed 9600; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

 

3>检查etc/wvdial.conf文件

$ sudo gedit /etc/wvdial.conf

[Dialer Defaults]

Init1 = ATZ

Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

Modem Type = Analog Modem

; Phone =

ISDN = 0

; Password =

New PPPD = yes

; Username =

Modem = /dev/ttyUSB_utps_modem

Baud = 9600

 

/*添加PhoneUsernamePassword信息*/

Phone = *99#  //设置联通WCDMA接入点

Username = a  //注意,无线上网卡上网是没有用户及密码的,这里可以随便写个就行

Password = a

/*生成的/etc/wvdial.conf文件默认是没有设置PhoneUsernamePassword的,如果不设置这些,在使用wvdial时会出现如下错误

--> Modem initialized.

--> Configuration does not specify a valid phone number.

--> Configuration does not specify a valid login name.

--> Configuration does not specify a valid password.

 */

 

4>拨号入网

$ sudo wvdial   //使用wvdial拨号程序

--> WvDial: Internet dialer version 1.60

--> Cannot get information for serial port.

--> Initializing modem.

--> Sending: ATZ

ATZ

OK

--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

OK

--> Modem initialized.

--> Sending: ATDT*99#

--> Waiting for carrier.

ATDT*99#

CONNECT 7200000

--> Carrier detected.  Waiting for prompt.

--> Don't know what to do!  Starting pppd and hoping for the best.

--> Starting pppd at Thu Apr 14 21:22:35 2011

--> Pid of pppd: 2539

--> Using interface ppp0

--> pppd: (U{[08]@S{[08]

--> pppd: (U{[08]@S{[08]

--> pppd: (U{[08]@S{[08]

--> pppd: (U{[08]@S{[08]

--> pppd: (U{[08]@S{[08]

--> pppd: (U{[08]@S{[08]

--> local  IP address 172.17.79.184

--> pppd: (U{[08]@S{[08]

--> remote IP address 10.64.64.64

--> pppd: (U{[08]@S{[08]

--> primary   DNS address 210.21.196.6

--> pppd: (U{[08]@S{[08]

--> secondary DNS address 221.5.88.88

--> pppd: (U{[08]@S{[08]    //pppd设置好IP地址和DNS地址后,wvdial程序停在这里,这时已经接入了internet

如果要停止网络,使用ctrl+C命令,可以中断连接。

--> Disconnecting at Thu Apr 14 21:34:12 2011

 

5>网络测试

$ sudo ifconfig  //查看系统中的网络连接

[sudo] password for user:

eth6      Link encap:Ethernet  HWaddr 00:0c:29:96:62:c4 

          inet6 addr: fe80::20c:29ff:fe96:62c4/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:9465 errors:0 dropped:0 overruns:0 frame:0

          TX packets:5312 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:14096309 (14.0 MB)  TX bytes:307928 (307.9 KB)

          Interrupt:19 Base address:0x2024

 

lo        Link encap:Local Loopback 

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:116 errors:0 dropped:0 overruns:0 frame:0

          TX packets:116 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:9624 (9.6 KB)  TX bytes:9624 (9.6 KB)

 

ppp0      Link encap:Point-to-Point Protocol  //使用3G模块接入的PPP0节点

          inet addr:172.17.79.184  P-t-P:10.64.64.64  Mask:255.255.255.255

          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1

          RX packets:7 errors:0 dropped:0 overruns:0 frame:0

          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:3

          RX bytes:118 (118.0 B)  TX bytes:157 (157.0 B)

 

$ sudo ifconfig eth6 down  //将接入的有线网卡ethx关闭,使用3G模块接入的PPP0节点

$ sudo ifconfig           //

lo        Link encap:Local Loopback 

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:116 errors:0 dropped:0 overruns:0 frame:0

          TX packets:116 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:9624 (9.6 KB)  TX bytes:9624 (9.6 KB)

 

ppp0      Link encap:Point-to-Point Protocol 

          inet addr:172.17.79.184  P-t-P:10.64.64.64  Mask:255.255.255.255

          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1

          RX packets:7 errors:0 dropped:0 overruns:0 frame:0

          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:3

          RX bytes:118 (118.0 B)  TX bytes:157 (157.0 B)

 

$ ping   //使用ping命令来测试网络

PING www.a.shifen.com (61.135.169.105) 56(84) bytes of data.

64 bytes from 61.135.169.105: icmp_seq=1 ttl=50 time=140 ms

64 bytes from 61.135.169.105: icmp_seq=2 ttl=50 time=156 ms

 

--- www.a.shifen.com ping statistics ---

7 packets transmitted, 7 received, 0% packet loss, time 31656ms

rtt min/avg/max/mdev = 124.525/154.563/171.575/15.575 ms

       如上,能够pingbaidu等网络站点,说明3G模块在ubuntu系统中已经能够接入网络了。

 

五 使用pppd拨号上网

1>编写pppd拨号脚本

###/etc/ppp/peers/ppp_script###  将此脚本放在/etc/ppp/peers/目录下

nodetach

/dev/ttyUSB_utps_modem

19200

nocrtscts

connect '/usr/sbin/chat -v -f /etc/ppp/peers/chat_script'

debug

user "card"

password "card"

ipcp-accept-local

ipcp-accept-remote

defaultroute

 

2>编写chat拨号脚本

###/etc/ppp/peers/chat_script###  //将此脚本放在/etc/ppp/peers/目录下

ABORT "NO CARRIER"

ABORT "NO DIALTONE"

ABORT "ERROR"

ABORT "NO ANSWER"

ABORT "BUSY"

TIMEOUT 30

"" AT

OK ATDT*99#

#connect    为小写时出现如下错误

CONNECT

 

3>pppd拨号

$ sudo pppd call ppp_script   //使用pppd调用ppp_script脚本,在系统中pppd默认查找ppp_script脚本的路径为/etc/ppp/peers/,所以这里不需要指定路径了。

注意/etc/ppp/peers/chat_script脚本中connect的大小写状态,当为小写的connect时,拨号出现如下错误:

/******/var/log/messages*****/

……

Apr 20 22:04:31 Ubuntu1004 pppd[2299]: pppd 2.4.5 started by user, uid 0

Apr 20 22:04:32 Ubuntu1004 chat[2302]: abort on (NO CARRIER)

Apr 20 22:04:32 Ubuntu1004 chat[2302]: abort on (NO DIALTONE)

Apr 20 22:04:32 Ubuntu1004 chat[2302]: abort on (ERROR)

Apr 20 22:04:32 Ubuntu1004 chat[2302]: abort on (NO ANSWER)

Apr 20 22:04:32 Ubuntu1004 chat[2302]: abort on (BUSY)

Apr 20 22:04:32 Ubuntu1004 chat[2302]: timeout set to 30 seconds

Apr 20 22:04:32 Ubuntu1004 chat[2302]: send (AT^M)

Apr 20 22:04:32 Ubuntu1004 chat[2302]: expect (OK)

Apr 20 22:04:32 Ubuntu1004 chat[2302]: AT^M^M

Apr 20 22:04:32 Ubuntu1004 chat[2302]: OK

Apr 20 22:04:32 Ubuntu1004 chat[2302]:  -- got it

Apr 20 22:04:32 Ubuntu1004 chat[2302]: send (ATDT*99#^M)

Apr 20 22:04:32 Ubuntu1004 chat[2302]: expect (connect)

Apr 20 22:04:32 Ubuntu1004 chat[2302]: ^M

Apr 20 22:04:32 Ubuntu1004 chat[2302]: ATDT*99#^M^M

Apr 20 22:04:32 Ubuntu1004 chat[2302]: CONNECT 7200000^M

Apr 20 22:05:02 Ubuntu1004 chat[2302]: alarm   //错误退出

Apr 20 22:05:02 Ubuntu1004 chat[2302]: Failed

Apr 20 22:05:03 Ubuntu1004 pppd[2299]: Exit.

当为大写的CONNECT时,成功拨号:

user@Ubuntu1004:~$ sudo pppd call ppp_script

[sudo] password for user:

Script /usr/sbin/chat -v -f /etc/ppp/peers/chat_script finished (pid 2238), status = 0x0

Serial connection established.

using channel 1

Using interface ppp0

Connect: ppp0 <--> /dev/ttyUSB_utps_modem

sent [LCP ConfReq id=0x1 ]

rcvd [LCP ConfReq id=0x0 ]

sent [LCP ConfAck id=0x0 ]

rcvd [LCP ConfAck id=0x1 ]

sent [LCP EchoReq id=0x0 magic=0x52d90299]

rcvd [LCP DiscReq id=0x1 magic=0xf74ddb]

rcvd [CHAP Challenge id=0x1 , name = "UMTS_CHAP_SRVR"]

sent [CHAP Response id=0x1 , name = "card"]

rcvd [LCP EchoRep id=0x0 magic=0xf74ddb 52 d9 02 99]

rcvd [CHAP Success id=0x1 ""]

CHAP authentication succeeded

CHAP authentication succeeded

sent [CCP ConfReq id=0x1 ]

sent [IPCP ConfReq id=0x1 ]

rcvd [LCP ProtRej id=0x2 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]

Protocol-Reject for 'Compression Control Protocol' (0x80fd) received

rcvd [IPCP ConfNak id=0x1 ]

sent [IPCP ConfReq id=0x2 ]

rcvd [IPCP ConfNak id=0x2 ]

sent [IPCP ConfReq id=0x3 ]

rcvd [IPCP ConfReq id=0x0]

sent [IPCP ConfNak id=0x0 ]

rcvd [IPCP ConfRej id=0x3 ]

sent [IPCP ConfReq id=0x4 ]

rcvd [IPCP ConfReq id=0x1]

sent [IPCP ConfAck id=0x1]

rcvd [IPCP ConfNak id=0x4 ]

sent [IPCP ConfReq id=0x5 ]

rcvd [IPCP ConfAck id=0x5 ]

Could not determine remote IP address: defaulting to 10.64.64.64

Cannot determine ethernet address for proxy ARP

local  IP address 172.19.33.38

remote IP address 10.64.64.64

primary   DNS address 210.21.196.6

secondary DNS address 221.5.88.88      COPTS

Script /etc/ppp/ip-up started (pid 2249)

Script /etc/ppp/ip-up finished (pid 2249), status = 0x0

 

/var/log/messages信息:

……

Apr 21 02:24:12 Ubuntu1004 pppd[2236]: pppd 2.4.5 started by user, uid 0

Apr 21 02:24:13 Ubuntu1004 chat[2238]: abort on (NO CARRIER)

Apr 21 02:24:13 Ubuntu1004 chat[2238]: abort on (NO DIALTONE)

Apr 21 02:24:13 Ubuntu1004 chat[2238]: abort on (ERROR)

Apr 21 02:24:13 Ubuntu1004 chat[2238]: abort on (NO ANSWER)

Apr 21 02:24:13 Ubuntu1004 chat[2238]: abort on (BUSY)

Apr 21 02:24:13 Ubuntu1004 chat[2238]: timeout set to 30 seconds

Apr 21 02:24:13 Ubuntu1004 chat[2238]: send (AT^M)

Apr 21 02:24:13 Ubuntu1004 chat[2238]: expect (OK)

Apr 21 02:24:13 Ubuntu1004 chat[2238]: AT^M^M

Apr 21 02:24:13 Ubuntu1004 chat[2238]: OK

Apr 21 02:24:13 Ubuntu1004 chat[2238]:  -- got it

Apr 21 02:24:13 Ubuntu1004 chat[2238]: send (ATDT*99#^M)

Apr 21 02:24:13 Ubuntu1004 chat[2238]: expect (CONNECT)

Apr 21 02:24:13 Ubuntu1004 chat[2238]: ^M

Apr 21 02:24:13 Ubuntu1004 chat[2238]: ATDT*99#^M^M

Apr 21 02:24:13 Ubuntu1004 chat[2238]: CONNECT

Apr 21 02:24:13 Ubuntu1004 chat[2238]:  -- got it

Apr 21 02:24:13 Ubuntu1004 pppd[2236]: Serial connection established.

Apr 21 02:24:13 Ubuntu1004 pppd[2236]: Using interface ppp0

Apr 21 02:24:13 Ubuntu1004 pppd[2236]: Connect: ppp0 <--> /dev/ttyUSB_utps_modem

Apr 21 02:24:15 Ubuntu1004 pppd[2236]: CHAP authentication succeeded

Apr 21 02:24:15 Ubuntu1004 pppd[2236]: CHAP authentication succeeded

Apr 21 02:24:15 Ubuntu1004 kernel: [  235.783415] PPP BSD Compression module registered

Apr 21 02:24:15 Ubuntu1004 kernel: [  235.800423] PPP Deflate Compression module registered

Apr 21 02:24:17 Ubuntu1004 pppd[2236]: Could not determine remote IP address: defaulting to 10.64.64.64

Apr 21 02:24:17 Ubuntu1004 pppd[2236]: local  IP address 172.19.33.38

Apr 21 02:24:17 Ubuntu1004 pppd[2236]: remote IP address 10.64.64.64

Apr 21 02:24:17 Ubuntu1004 pppd[2236]: primary   DNS address 210.21.196.6

Apr 21 02:24:17 Ubuntu1004 pppd[2236]: secondary DNS address 221.5.88.88

 

user@Ubuntu1004:~$ sudo ifconfig eth0 down //关闭有线网卡

user@Ubuntu1004:~$ ifconfig

lo        Link encap:Local Loopback 

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:124 errors:0 dropped:0 overruns:0 frame:0

          TX packets:124 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:10204 (10.2 KB)  TX bytes:10204 (10.2 KB)

 

ppp0      Link encap:Point-to-Point Protocol 

          inet addr:172.19.33.38  P-t-P:10.64.64.64  Mask:255.255.255.255

          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1

          RX packets:16 errors:0 dropped:0 overruns:0 frame:0

          TX packets:17 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:3

          RX bytes:874 (874.0 B)  TX bytes:901 (901.0 B)

 

 

网络测试:

user@Ubuntu1004:~$ ping 220.181.112.143

PING 220.181.112.143 (220.181.112.143) 56(84) bytes of data.

64 bytes from 220.181.112.143: icmp_seq=1 ttl=46 time=2024 ms

64 bytes from 220.181.112.143: icmp_seq=2 ttl=46 time=1022 ms

--- 220.181.112.143 ping statistics ---

9 packets transmitted, 8 received, 11% packet loss, time 8075ms

rtt min/avg/max/mdev = 293.827/612.819/2024.505/582.537 ms, pipe 3

 

user@Ubuntu1004:~$ ping www.baidu.com

ping: unknown host www.baidu.com   //不能解析域名???!!!!!!!!

       解决:/etc/ppp/options文件中加入 usepeerdns”后,即可访问域名。加入usepeerdns命令后,PPPD会将分配到的DNS服务器地址自动保存到/etc/resolv.conf文件中以供系统调用,这样系统就能解析域名了。usepeerdns命令也可放在PPPD调用脚本ppp_script 中。 

 

阅读(2681) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~