Ubuntu 上建了一个 L2TP/IPSec,能拨通,但是拨通后不能访问任何网站,请问怎么排插原因?

2013-10-24 15:14:09 +08:00
 lichao
4508 次点击
所在节点    问与答
10 条回复
alexrezit
2013-10-24 15:15:04 +08:00
ping 一下网站? 转发没设置好?
lichao
2013-10-24 15:22:52 +08:00
@alexrezit
拨通后可以 ping 通服务器 IP 地址,但是 ping 不通任何其它 IP 地址

不太懂细节,请问转发应该在哪里设置?

参照的这篇文章,http://safesrv.net/setup-l2tp-over-ipsec-to-authenticate-off-freeradius-on-ubuntu-11-10/

同时配合了 FreeRADIUS,用户名和密码保存在 FreeRADIUS 里。
alexrezit
2013-10-24 15:26:11 +08:00
@lichao
目测 iptables 没配好.
lichao
2013-10-24 15:28:24 +08:00
@alexrezit 我猜也是,请问怎么解决?不太懂 iptables
alexrezit
2013-10-24 15:32:00 +08:00
@lichao
iptables -t nat -A POSTROUTING -s x.x.x.x/24 -o eth0 -j
大概这样? x.x.x.x 换成你自己的.
alexrezit
2013-10-24 15:32:30 +08:00
iptables -t nat -A POSTROUTING -s x.x.x.x/24 -o eth0 -j MASQUERADE
alexrezit
2013-10-24 15:34:36 +08:00
你可以 -L 一下看看哪里不对.
lichao
2013-10-24 15:39:11 +08:00
@alexrezit

root@li471-142:~# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ShadowStar
2013-10-24 15:54:10 +08:00
先查一下本地和服务器的路由
lichao
2013-10-24 15:58:36 +08:00
@ShadowStar
@alexrezit

多谢各位,搞定了

For some reason openswan does not start correctly after reboot, so I put the following lines in my /etc/rc.local

iptables --table nat --append POSTROUTING --jump MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
for each in /proc/sys/net/ipv4/conf/*
do
echo 0 > $each/accept_redirects
echo 0 > $each/send_redirects
done
/etc/init.d/ipsec restart

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/86766

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX