上一篇介绍如何安装pptp vpn服务,这里介绍如何在Linux平台下拨vpn[基于pptp协议]:
# cat /etc/ppp/peers/ct_vpn
remotename ct_vpn
linkname ct_vpn
ipparam ct_vpn
pty "pptp 114.xx.88.10 --nolaunchpppd"
name daihj
usepeerdns
require-pap
lock
refuse-eap
noauth
nobsdcomp
nodeflate
#file /etc/ppp/options.pptp
-----------------------------------------------------------------
# cat /etc/ppp/pap-secrets
# Secrets for authentication using PAP
# client server secret IP addresses
daihj ct_vpn 12345678684013 *
#我的密码是动态令牌,所以每次要拨号都得改成当前的密码.
================
拨号:
# pppd call ct_vpn logfd 1 updetach
拨号成功后ip a能看到ppp0端口,如果要访问vpn 服务器那端的局域网,需要在客户端添加相关的路由:
# cat pptp_add_route.sh
#!/bin/bash
ip rou add 192.168.9.0/24 dev ppp0
ip rou add 10.10.5.0/24 dev ppp0
ip rou add 10.10.12.0/24 dev ppp0
#每次拨号后就可以运行脚本,这样就可以访问对端的局域网了.
或者将添加路由命令添加到/etc/ppp/ip-up文件中exit 0的前面.这样更省事.
[ -x /etc/ppp/ip-up.local ] && /etc/ppp/ip-up.local "$@"
ip rou add 192.168.9.0/24 dev ppp0
ip rou add 10.10.5.0/24 dev ppp0
ip rou add 10.10.12.0/24 dev ppp0
exit 0
断开连接:
DEVICE=ppp0
kill -INT `cat /var/run/$DEVICE.pid`
阅读(1253) | 评论(0) | 转发(0) |