环境:
RouterOS 2.9.27 + archlinux 200806
routerOS上架设PPTP server,archlinux当pptp client,archlinux上有一块网卡eth0
RouterOS ip地址:192.168.88.100
archlinux ip地址:192.168.88.88
PPTP server 配置
local address : 172.16.1.1
remote address : 172.16.1.10-172.16.1.20
secret name : test
secret password : 123456
Authentication :pap chap mschap1 machap2
目的:
archlinux vpn拨号到PPTP server
实现步骤:
注意:需先修改文件 /etc/rc.conf 配置好ip地址和网关,确保可以和RouterOS通信
1、安装 ppp包 和 pptpclient包
[root@myhost ~]# pacman -S ppp pptpclient
2、在 CHAP密码文件 中添加帐户
[root@vkill ~]# vi /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
"test" PPTP "123456" *
3、创建 pptp拨号脚本,名字vpntest可以随便起
[root@vkill ~]# vi /etc/ppp/peers/vpntest
#这个是这个例子中拨号脚本中最起码的4步
pty "pptp 192.168.88.100 --nolaunchpppd"
noauth
name "test"
remotename "PPTP"
file /etc/ppp/options.pptp
#下面这行当服务端启动require-mppe-128时才用
#require-mppe-128
4、配置/etc/ppp/options.pptp文件,有下列内容就行,缺省都有的,所以不用做修改
[root@vkill ~]# vi /etc/ppp/options.pptp
lock
noauth
refuse-eap
refuse-chap
refuse-mschap
nobsdcomp
nodeflate
5、开始vpn连接,可能会出现下列提示,是因为没有ppp设备文件
[root@vkill ~]# pon vpntest
/usr/sbin/pppd: pppd is unable to open the /dev/ppp device.
You need to create the /dev/ppp device node by
executing the following command as root:
mknod /dev/ppp c 108 0
6、如出现上面提示,就照提示创建ppp设备文件
[root@vkill ~]# mknod /dev/ppp c 108 0
7、再次vpn连接,如未提示任何信息,可能就已经连接好了
[root@vkill ~]# pon vpntest
8、ifconfig查看,可以看到多了一个ppp0连接
[root@vkill ~]# ifconfig
......
ppp0 Link encap:Point-to-Point Protocol
inet addr:172.16.1.18 P-t-P:172.16.1.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1460 Metric:1
RX packets:8 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:73 (73.0 b) TX bytes:79 (79.0 b)
9、关闭vpn连接
[root@vkill ~]# poff vpntest
10、如果使用vpn连接ppp0来做缺省路由
[root@vkill ~]# route add default dev ppp0
11、设置开机自动vpn拨号
//首先重启计算机后ppp设备还需要重新创建,所以需把创建ppp设备的命令写入开机脚本
[root@vkill ~]# vi /etc/rc.local
#创建ppp设备文件
mknod /dev/ppp c 108 0
//其次是加入到daemons的起动脚本
[root@vkill ~]# vi /etc/rc.conf
#添加pptpclient到DAEMONS,@是后台
DAEMONS=(syslog-ng network netfs crond sshd @pptpclient)
//最后拷贝和修改pptpclient启动脚本
[root@vkill ~]# cp -a /etc/rc.d/ppp /etc/rc.d/pptpclient
[root@vkill ~]# vi /etc/rc.d/pptpclient
......
#/usr/bin/pon 后加入刚刚写的pptp拨号脚本名,这里是vpntest
start)
stat_busy "Starting PPP daemon"
[ -z "$PID" ] && /usr/bin/pon vpntest
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon ppp
stat_done
fi
;;
#poff 后加入刚刚写的pptp拨号脚本名,这里是vpntest
stop)
stat_busy "Stopping PPP daemon"
[ ! -z "$PID" ] && poff vpntest &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon ppp
stat_done
fi
;;
......
11、现在重新启动后就自动拨上号了,现在停止vpn连接也可以使用下面的命令了
[root@vkill ~]# /etc/rc.d/pptpclient stop
详细配置参见:http://pptpclient.sourceforge.net/howto-debian.phtml#configure_by_hand
Last modified by vkill on2008/09/07 10:24
RouterOS 2.9.27 + archlinux 200806
routerOS上架设PPTP server,archlinux当pptp client,archlinux上有一块网卡eth0
RouterOS ip地址:192.168.88.100
archlinux ip地址:192.168.88.88
PPTP server 配置
local address : 172.16.1.1
remote address : 172.16.1.10-172.16.1.20
secret name : test
secret password : 123456
Authentication :pap chap mschap1 machap2
目的:
archlinux vpn拨号到PPTP server
实现步骤:
注意:需先修改文件 /etc/rc.conf 配置好ip地址和网关,确保可以和RouterOS通信
1、安装 ppp包 和 pptpclient包
[root@myhost ~]# pacman -S ppp pptpclient
2、在 CHAP密码文件 中添加帐户
[root@vkill ~]# vi /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
"test" PPTP "123456" *
3、创建 pptp拨号脚本,名字vpntest可以随便起
[root@vkill ~]# vi /etc/ppp/peers/vpntest
#这个是这个例子中拨号脚本中最起码的4步
pty "pptp 192.168.88.100 --nolaunchpppd"
noauth
name "test"
remotename "PPTP"
file /etc/ppp/options.pptp
#下面这行当服务端启动require-mppe-128时才用
#require-mppe-128
4、配置/etc/ppp/options.pptp文件,有下列内容就行,缺省都有的,所以不用做修改
[root@vkill ~]# vi /etc/ppp/options.pptp
lock
noauth
refuse-eap
refuse-chap
refuse-mschap
nobsdcomp
nodeflate
5、开始vpn连接,可能会出现下列提示,是因为没有ppp设备文件
[root@vkill ~]# pon vpntest
/usr/sbin/pppd: pppd is unable to open the /dev/ppp device.
You need to create the /dev/ppp device node by
executing the following command as root:
mknod /dev/ppp c 108 0
6、如出现上面提示,就照提示创建ppp设备文件
[root@vkill ~]# mknod /dev/ppp c 108 0
7、再次vpn连接,如未提示任何信息,可能就已经连接好了
[root@vkill ~]# pon vpntest
8、ifconfig查看,可以看到多了一个ppp0连接
[root@vkill ~]# ifconfig
......
ppp0 Link encap:Point-to-Point Protocol
inet addr:172.16.1.18 P-t-P:172.16.1.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1460 Metric:1
RX packets:8 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:73 (73.0 b) TX bytes:79 (79.0 b)
9、关闭vpn连接
[root@vkill ~]# poff vpntest
10、如果使用vpn连接ppp0来做缺省路由
[root@vkill ~]# route add default dev ppp0
11、设置开机自动vpn拨号
//首先重启计算机后ppp设备还需要重新创建,所以需把创建ppp设备的命令写入开机脚本
[root@vkill ~]# vi /etc/rc.local
#创建ppp设备文件
mknod /dev/ppp c 108 0
//其次是加入到daemons的起动脚本
[root@vkill ~]# vi /etc/rc.conf
#添加pptpclient到DAEMONS,@是后台
DAEMONS=(syslog-ng network netfs crond sshd @pptpclient)
//最后拷贝和修改pptpclient启动脚本
[root@vkill ~]# cp -a /etc/rc.d/ppp /etc/rc.d/pptpclient
[root@vkill ~]# vi /etc/rc.d/pptpclient
......
#/usr/bin/pon 后加入刚刚写的pptp拨号脚本名,这里是vpntest
start)
stat_busy "Starting PPP daemon"
[ -z "$PID" ] && /usr/bin/pon vpntest
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon ppp
stat_done
fi
;;
#poff 后加入刚刚写的pptp拨号脚本名,这里是vpntest
stop)
stat_busy "Stopping PPP daemon"
[ ! -z "$PID" ] && poff vpntest &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon ppp
stat_done
fi
;;
......
11、现在重新启动后就自动拨上号了,现在停止vpn连接也可以使用下面的命令了
[root@vkill ~]# /etc/rc.d/pptpclient stop
详细配置参见:http://pptpclient.sourceforge.net/howto-debian.phtml#configure_by_hand
Last modified by vkill on2008/09/07 10:24
网友评论(0):


