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

2013-03-21 14:00:27 +08:00
 Eyon
可能有好多人在用基于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)
6367 次点击
所在节点    分享创造
1 条回复
dgxyzj
2014-11-12 22:42:47 +08:00
谢谢,我的ddwrt 使用pptp客户端一直挂不上vpn,用了你的代码后成功通过ipsec翻出墙外了。想问下是否有让指定设备走vpn,其他设备走普通网络的方法

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

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

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

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

© 2021 V2EX