V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
Eyon
V2EX  ›  分享创造

自己DIY了一个稳定的、基于Cisco ipsec 的 dd-wrt 路由器cw方案

  •  
  •   Eyon · 2013-03-21 14:00:27 +08:00 · 6352 次点击
    这是一个创建于 4055 天前的主题,其中的信息可能已经有所发展或是发生改变。
    可能有好多人在用基于pptp的,这种一个最大的问题就是不够稳定,而 cisco ipsec 就没有这个问题。

    方法很简单,拷贝下面的代码,直接贴到dd-wrt的 administration-commands 中,然后 save startup,重启路由器即可(请自行替换xxx)。

    #!/bin/sh
    vpn_concentrator="xxx.xxx.xxx.xxx" ##enter ip or hostname of your Ipsec vpn concentrator
    vpn_groupname="xxx" ##enter the group name here
    vpn_grouppasswd="xxxxx" ##enter the group password here
    vpn_username="xxxxxxx" ##enter your username here
    vpn_password="xxxxx" ##enter your password here

    #--do not edit this--
    #Written by Alain R. (alainr /A*T/ gmx. de) 27.Sep.2007
    vpnc-disconnect
    rm -f /tmp/etc/vpnc/vpn.conf
    mkdir /tmp/etc/vpnc
    echo "
    IPSec gateway $vpn_concentrator
    IPSec ID $vpn_groupname
    IPSec secret $vpn_grouppasswd
    Xauth username $vpn_username
    Xauth password $vpn_password
    " >> /tmp/etc/vpnc/vpn.conf
    sleep 5
    vpnc /tmp/etc/vpnc/vpn.conf
    sleep 10
    iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE

    目前还没有实现指定网站cw的功能,对iptables 命令完全不懂,还在研究。如果你懂的话不妨告诉我。

    P.S.,我用的dd版本是v24-sp2 mega(15943)
    1 条回复    2014-11-12 22:42:47 +08:00
    dgxyzj
        1
    dgxyzj  
       2014-11-12 22:42:47 +08:00
    谢谢,我的ddwrt 使用pptp客户端一直挂不上vpn,用了你的代码后成功通过ipsec翻出墙外了。想问下是否有让指定设备走vpn,其他设备走普通网络的方法
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   936 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 22:43 · PVG 06:43 · LAX 15:43 · JFK 18:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.