Share my knowledge, feel my life. Eric Shan' Blog myBloggie 2.1.6 © 2005   
Mar 2025 April 2025 May 2025
S M T W T F S
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30    
Categories
About[5]
Blackberry[1]
dotNet and C Charp[1]
IPhone[10]
Life[4]
Unix&Linux[19]
WEB programming[16]
Windows API[5]
Windows Mobile[1]
Windows Multimedia[4]
Recent
CentOS mount CDrom and USB
CentOS GHOST(幽灵)漏洞修复方法
centos 改变语言并立即生效
centos vpn 接通后无法连接internet
让vlc播放中文字幕不出乱码
centos 取消屏保
php中ob_flush和flush的用法
CentOS检查,添加,删除自启动服务
CentOS中开机自动启动某个服务
Top命令中的翻页
Archives
February 2010[4]
September 2009[1]
August 2009[1]
January 2009[7]
October 2008[10]
June 2008[2]
December 2007[14]
November 2007[5]
May 2007[9]
April 2007[3]
March 2007[10]
User List
Eric Shan[66]
Search
Syndication
07 Jan 2015 10:42:19 pm
centos vpn 接通后无法连接internet
vpn可以连接到服务器并成功连接,但是无法上任何外网网站。
经查:

1.在vpn client pc上ping 服务器的pptpd地址192.168.80.1,可以ping通,ping服务器的外网地址也可以ping通,ping google或任何internet地址都不能。

2.因此怀疑是服务器没有做ip转发。

上到服务器上,查iptables, (实际上iptables是centos的防火墙,但是也是用来ip转发forward的)。
用来查转发的命令是 :

iptables -t nat -nL

发现由于多次调试,里面杂乱无章,用下面命令清空:

iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X

然后重新做:

iptables -t nat -A POSTROUTING -s 192.168.80.0/24 -o seth0 -j MASQUERADE

这个指令完成后立刻生效绝对不要重启iptables, 应为错误的 iptables设置还在/etc/sysconfig/iptables中,一重启反而还是错的。

立刻测试vpn,发现问题解决,的确是转发有问题。

这时把/etc/sysconfig/iptables移走,然后

/sbin/service iptables save

把正确的/etc/sysconfig/iptables文件保留下来,这样重启iptable service才不会依然是错误的。

参考:

http://blog.csdn.net/kuailedesky/article/details/41551077
http://bbs.aliyun.com/read/163732.html?spm=5176.7189909.0.0.fnGeeC&page=2
Category : Unix&Linux | Posted By : Eric Shan | Comments [0] | Trackbacks [0]
Trackbacks
The URI to TrackBack this entry is :
http://blog.tntsoft.com/trackback.php/66
Comments

Add Your Comment

Subject

Comments

Name

Email Address (Optional)

Home Page (Optional)

Security Code

Please enter the security code as displayed :



Template theme : aura
Powered by myBloggie Copyright © 2004 2006
-- myWebland --

Sponsed by TNTSoft Store