V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
lichao
V2EX  ›  问与答

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

  •  
  •   lichao · 2013-10-24 15:14:09 +08:00 · 4504 次点击
    这是一个创建于 3856 天前的主题,其中的信息可能已经有所发展或是发生改变。
    第 1 条附言  ·  2013-10-24 16:06:15 +08:00
    再请教一下,这种自己建的 VPN 服务器,最多支持多少人同时连接?根据 ip range,最多也就 250 个左右?
    第 2 条附言  ·  2013-10-24 19:08:03 +08:00
    哦,理论上几乎是无限的
    10 条回复    1970-01-01 08:00:00 +08:00
    alexrezit
        1
    alexrezit  
       2013-10-24 15:15:04 +08:00
    ping 一下网站? 转发没设置好?
    lichao
        2
    lichao  
    OP
       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
        3
    alexrezit  
       2013-10-24 15:26:11 +08:00   ❤️ 1
    @lichao
    目测 iptables 没配好.
    lichao
        4
    lichao  
    OP
       2013-10-24 15:28:24 +08:00
    @alexrezit 我猜也是,请问怎么解决?不太懂 iptables
    alexrezit
        5
    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
        6
    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
        7
    alexrezit  
       2013-10-24 15:34:36 +08:00
    你可以 -L 一下看看哪里不对.
    lichao
        8
    lichao  
    OP
       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
        9
    ShadowStar  
       2013-10-24 15:54:10 +08:00
    先查一下本地和服务器的路由
    lichao
        10
    lichao  
    OP
       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
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1184 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 18:32 · PVG 02:32 · LAX 11:32 · JFK 14:32
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.