windows下是可以連接vpn的,上網啊都沒什么問題。想以centos為客戶端,連接遠程的VPN,發現不是那么容易,找了半天資料,找到了方法。
1,安裝ppp pptp pptp-setup
# yum install ppp pptp pptp-setup
2,創建VPN連接
# pptpsetup --create test --server ip地址 --username test --password test --start
如果報以下錯誤:
FATAL: Module ppp_mppe not found. /usr/sbin/pptpsetup: couldn't find MPPE support in kernel.
解決方法:
# modprobe ppp_mppe
3,連接VPN連接
[root@localhost peers]# pppd call test //這里的test是上面創建vpn連接
如果報以下錯誤:
Using interface ppp0 Connect: ppp0 <--> /dev/pts/3 CHAP authentication succeeded LCP terminated by peer (MPPE required but peer refused) Modem hangup
解決方法:
# vim /etc/ppp/peers/test //test是上面創建的連接 文件尾部,加上以下內容 require-mppe-128
成功后會多出一個虛擬網口ppp0
[root@localhost peers]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 112.124.132.142 192.168.10.1 255.255.255.255 UGH 0 0 0 eth0 192.168.8.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 192.168.10.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0 0.0.0.0 192.168.10.1 0.0.0.0 UG 0 0 0 eth0
並且用ifconfig也可以看到
4,添加默認路由
[root@localhost peers]# route add -net 0.0.0.0 dev ppp0 //添加默認路由 [root@localhost peers]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 112.124.132.142 192.168.10.1 255.255.255.255 UGH 0 0 0 eth0 192.168.8.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 192.168.10.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0 0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0 0.0.0.0 192.168.10.1 0.0.0.0 UG 0 0 0 eth0
到這兒VPN就設置好了,根WINDOWS下一樣的。你可以通過IP查詢工具查一下。
5,斷開vpn連接,只需要把網絡重啟就行了。
[root@localhost peers]# /etc/init.d/network restart
6. 斷開連接
# pkill pptp