> CentOS > CentOS教程 >

centos 6.8命令行下进行pptp拨号

centos 6.8 命令行下可使用pptpsetup进行pptp拨号

1.先安装ppp,pptp和pptp-setup三个包

yum install -y ppp pptp pptp-setup

2.使用pptpsetup进行连接

pptpsetup --create VPN名字 --server 服务器IP --username 用户名 --password 密码 --encrypt --start          
[root@centos6-8-1 ~]# pptpsetup --create vpn --server 192.168.127.128 --username user --password passw
d --encrypt --start
Using interface ppp0
Connect: ppp0 <--> /dev/pts/2
CHAP authentication succeeded
MPPE 128-bit stateless compression enabled
local  IP address 192.168.0.235
remote IP address 192.168.0.1

使用ip addr可以看到多了一个接口ppp0:

[root@centos6-8-1 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    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 qlen 1000
    link/ether 00:0c:29:27:eb:e7 brd ff:ff:ff:ff:ff:ff
    inet 192.168.127.129/24 brd 192.168.127.255 scope global eth0
    inet6 fe80::20c:29ff:fe27:ebe7/64 scope link 
       valid_lft forever preferred_lft forever
4: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1496 qdisc pfifo_fast state UNKNOWN qlen 3
    link/ppp 
    inet 192.168.0.235 peer 192.168.0.1/32 scope global ppp0

3.添加默认路由

route add default dev ppp0

此时已经可以正常使用VPN。


如果想断开pptp连接,那就直接结束pptp进程

pkill pptp


 

(责任编辑:IT)