lichao
V2EX  ›  问与答

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

  •  
  •   lichao · Oct 24, 2013 · 5075 views
    This topic created in 4595 days ago, the information mentioned may be changed or developed.
    Supplement 1  ·  Oct 24, 2013
    再请教一下,这种自己建的 VPN 服务器,最多支持多少人同时连接?根据 ip range,最多也就 250 个左右?
    Supplement 2  ·  Oct 24, 2013
    哦,理论上几乎是无限的
    10 replies    1970-01-01 08:00:00 +08:00
    alexrezit
        1
    alexrezit  
       Oct 24, 2013
    ping 一下网站? 转发没设置好?
    lichao
        2
    lichao  
    OP
       Oct 24, 2013
    @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  
       Oct 24, 2013   ❤️ 1
    @lichao
    目测 iptables 没配好.
    lichao
        4
    lichao  
    OP
       Oct 24, 2013
    @alexrezit 我猜也是,请问怎么解决?不太懂 iptables
    alexrezit
        5
    alexrezit  
       Oct 24, 2013
    @lichao
    iptables -t nat -A POSTROUTING -s x.x.x.x/24 -o eth0 -j
    大概这样? x.x.x.x 换成你自己的.
    alexrezit
        6
    alexrezit  
       Oct 24, 2013
    iptables -t nat -A POSTROUTING -s x.x.x.x/24 -o eth0 -j MASQUERADE
    alexrezit
        7
    alexrezit  
       Oct 24, 2013
    你可以 -L 一下看看哪里不对.
    lichao
        8
    lichao  
    OP
       Oct 24, 2013
    @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  
       Oct 24, 2013
    先查一下本地和服务器的路由
    lichao
        10
    lichao  
    OP
       Oct 24, 2013
    @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
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5746 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 01:41 · PVG 09:41 · LAX 18:41 · JFK 21:41
    ♥ Do have faith in what you're doing.