Ubuntu 配置PPTP客户端

本文介绍一下命令配置PPTP客户端的过程。

 

A.安装pptp客户端软件 

sudo apt-get install pptp-linux

 

B.查看网络配置

root@localhost:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0c:29:19:a7:0c
          inet addr:192.168.1.113  Bcast:255.255.255.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe19:a70c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:255926 errors:0 dropped:0 overruns:0 frame:0
          TX packets:28779 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:16821541 (16.8 MB)  TX bytes:3126300 (3.1 MB)

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:65536  Metric:1
          RX packets:1123 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1123 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:125046 (125.0 KB)  TX bytes:125046 (125.0 KB)
 
root@localhost:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

  

 

C.初始化一个VPN的连接通道:myvpn

sudo pptpsetup --create myvpn --server xxx.xxx.xxx.xxx --username xx1 --password xx2 --encrypt --start

Using interface ppp0
Connect: ppp0 <--> /dev/pts/3
CHAP authentication succeeded
MPPE 128-bit stateless compression enabled
local  IP address 172.31.26.100
remote IP address 172.31.26.143

  

 

成功连接到远程VPN服务器

root@localhost:~# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:19:a7:0c brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.113/24 brd 255.255.255.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe19:a70c/64 scope link
       valid_lft forever preferred_lft forever
10: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1496 qdisc pfifo_fast state UNKNOWN group default qlen 3
    link/ppp
    inet 172.31.26.100 peer 172.31.26.143/32 scope global ppp0
       valid_lft forever preferred_lft forever

root@localhost:~# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:19:a7:0c brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.113/24 brd 255.255.255.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe19:a70c/64 scope link
       valid_lft forever preferred_lft forever
10: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1496 qdisc pfifo_fast state UNKNOWN group default qlen 3
    link/ppp
    inet 172.31.26.100 peer 172.31.26.143/32 scope global ppp0
       valid_lft forever preferred_lft forever
root@localhost:~# ping www.google.com
PING www.google.com (216.58.221.132) 56(84) bytes of data.
64 bytes from hkg07s02-in-f132.1e100.net (216.58.221.132): icmp_seq=1 ttl=53 time=310 ms
64 bytes from hkg07s02-in-f132.1e100.net (216.58.221.132): icmp_seq=2 ttl=53 time=323 ms

  

 

D.1.断开VPN连接

poff myvpn

  

 2.重新连接VPN

pon myvpn

  

 3.读取配置文件重新连接VPN

sudo pppd call myvpn  updetach

 

4.处理错误

LCP: timeout sending Config-Requests

处理方案:sudo modprobe nf_conntrack_pptp

 

posted @ 2016-02-01 19:03  麦田麦芽  阅读(1722)  评论(1编辑  收藏  举报