Total Pageviews

Thursday, 17 November 2011

用第三方路由固件dd-wrt翻墙

vpn 这种高级东西,一般家庭路由器不可能支持。但有了 DD-WRT 就不同了,DD-WRT 内置 VPN 功能,你可以通过简单的设置让你的路由器成为一个 VPN Server。
说起路由器的第三方固件,本人已经在在保的情况下刷坏了2个buffalo g54s(准确来说第一个刷坏了。第二个用坏了),现在换了个新版的g125(内存少一半,buffalo学了linsys的阴招),由于过保了,就没有再用上。
现在比较流行的就是dd-wrt 和tomato或者openwrt等。前两者比较流行,两者也各有好处。
dd-wrt在蹭网方面功能很强(就是把别人的无线信号通过自己的路由放大,在让终端接收)附:支持列表
tomato在qos方面做得更强,而且界面反应速度也很快.带宽紧张的朋友选择这个比较爽!
现在如果你的路由刷了以上的第三方软件,好处就是你用低于300块的价钱,用上千元级别高级路由了!
当然稳定性不能跟那些官方os比了!这个比较适合爱折腾的朋友。 笔者前文提过的翻墙利器alonvpnVPN就终于派上用场了。
上个图:
vpn 用第三方路由固件翻墙
server ip:路由器ip 地址
client ip(s):设置用vpn的电脑ip。(最后不要跟自动分配dhcp重叠,可能会发生冲突)
chap-secrets:username * password *格式填写
设置ok,大家赶快享受去吧!
题外话,使用vpn后,可以通过操作系统内置的 VPN 拨号功能,连接到我的路由器,实行游戏局域网对战!
这个对住集体宿舍的朋友好处实在太大了。
from: http://www.congoilublog.com/2009/04/%E7%94%A8%E7%AC%AC%E4%B8%89%E6%96%B9%E8%B7%AF%E7%94%B1%E5%9B%BA%E4%BB%B6%E7%BF%BB%E5%A2%99/
-----------------------------------------------------------------------
DD-WRT 上 VPN 的设置

什么是 DD-WRT?
这个说起来,话就长了。简单来说,就像电脑需要操作系统一样,路由器也需要,这样有些路由器的制造商就用专门改造过的 Linux 来作自己产品的操作系统。Linux 的内核就是是按 GPL 协议发布,而按照 GPL 的规定,你修改使用了 GPL 协议下的代码,再传播时需要把你修改过的代码继续开源并按照 GPL 协议发布。这样一来,就给了许多人研究这样路由器源码的机会,也在这个基础上产生了很多版本的“加强版”路由器操作系统,DD-WRT 就是其中非常优秀的一个。

DD-WRT 有着一个伟大的社区,有着一群了不起的 nerds, 他们把普通的电子产品变成让人惊喜的玩具。这跟种族无关,但我就是喜欢德意志人那种认真精确聪明的劲头,DD-WRT 让我确认了这点,DD-WRT 来自 OpenWRT 却比后者发展的更健康更快也更好,这应该能说明一些问题。
OK,回到 DD-WRT 上来,如果你有一个 DD-WRT 支持的路由器,你应该试试把它变成 DD-WRT 的版本,It’s really fun!

什么是 VPN?
我知道术语总是让人烦的,不过 VPN 应该对于很多朋友来说并不陌生。VPN 是 Virtual Private Network 的缩写,可以通过开辟一条加密过的“隧道”把局域网外的电脑连到局域网内。比如说,很多公司的内部的 LAN 是无法从外部 WAN 访问的,但如果公司有 VPN 接口的话,你就可以通过这条隧道在家连接到公司局域网内获取资料,就像在公司的电脑上一样。

怎么设置?
以下假设你已经有一个 DD-WRT 的路由器了,如果没有而又想有,可以参看一下支持刷成 DD-WRT 的路由器列表(http://www.dd-wrt.com/wiki/index.php/Supported_Devices),看看你的路由器在不在里面.

具体的设置如下:
    * Server IP: 就是你的路由器 IP
    * Client IP(s): 这里你可以为连到路由器的电脑分配一个 IP 的范围,最好不要用 DHCP 自动分配的 IP 范围冲突。这分配在同一网段,你也可以为之另起一个网段来分配。
    * CHAP-Secrets: 在这里设置用户名和密码,格式为 username * password *,每一行设定一个用户名和密码组合。
只需要上面几个地方就设置完成了。

你可以拿 VPN 来什么?
最吸引我的一点是,拿来玩局域网游戏。给我的朋友一个用户名和密码,他们就可以用操作系统内置的 VPN 拨号功能连接到我的路由器,接连成功后大家都在一个局域网里,然后星际,CS,魔兽什么的游戏就都可以一起玩了。
---------------------------------------------------------------------------------------------------------------------------
自制一个翻墙猫

用DD-WRT刷路由器 + PPTP VPN + 墙内外自动切换

1) 需要一个 支持 DD-WRT 的路由器

这个东东 http://search.taobao.com/search?shopf=newsearch&q=dd-wrt

2) 需要一个能访问海外的 PPTP VPN 帐号

索取测试帐号 请电邮给 eevpn.com@gmail.com 标题 VPN TEST

3)按这个操作指南

http://code.google.com/p/autoddvpn/wiki/README

THAT'S IT. 你的猫能自动翻墙,家里所有连接的电脑,手机。。。都能自动翻墙啦。

from: https://www.google.com/buzz/puff1984/91AuwXPvgi5/%E9%80%8F%E6%98%8E%E7%BF%BB%E5%A2%99-%E8%87%AA%E5%88%B6%E4%B8%80%E4%B8%AA%E7%BF%BB%E5%A2%99%E7%8C%AB-%E7%94%A8D
-----------------------------------
基于tomato+openvpn+国内外分流翻墙猫
最近一直在研究一种零技术壁垒的翻墙技术,想来想去,觉得可以在无线路由上下下功夫,经过半个多月的调试和测试,已经完工,而且效果非常之好。
我希望有技术的朋友掌握了之后,可以在一些提供公用WIFI的地方架设这样的翻墙猫,这样没有了翻墙的技术壁垒,翻墙就会成为一种势不可挡的趋势
我的设想就是以后一个咖啡店没有可以翻墙的WIFI都不好意思给别人打招呼,宾馆的翻墙猫就像卫星电视一样成为一种必备(类似宾馆能收到家里收不到的频道)
其实这样的好处有很多,我就不一一举例了,言归正传,介绍一下我的翻墙猫制作过程。
==========所需硬件及软件=========
1、AP无线路由一个,能够刷Tomato1.27vpn3.6,一般4M Flash的猫都可以,我这里使用的linksys WRT54G2 8M Flash版本;
2、国外VPN服务器一台,可以买VPS自己搭OPENVPN,至于OPENVPN的搭建我前面也有教程,网上也多,这里就不多说了;
小提示:对于一些有限制的网络,我们可以把openvpn服务器的端口设置为tcp 的 80 或者 443
3、Tomato1.27vpn3.6(下载地址 http://tomatovpn.tomatomod.de/release/1.27vpn3.6/),为什么不用DDWRT?因为DDWRT的启动脚本比较麻烦,不容易上手;
4、OPENVPN 2.1.1,客户端和服务器都必须是这个版本,因为早期版本不支持 max-routes 参数和内置证书,后面要用到max-routes做国内外分流;
==========翻墙猫的制作==========
1、刷新路由到 Tomato1.27vpn3.6 版本(这个版本内置的Openvpn是 2.1.1,满足我们的需求)(本文不对刷成砖的猫负责,但是可以提供技术支持,虽然我也很烂)
2、设置启动脚本
进入猫的管理界面,到Administration选项下面的Scripts
A、设置初始化Init,启用tun模块,OPENVPN必须的
insmod /lib/modules/2.4.20/kernel/drivers/net/tun.o

B、设置iptables转发,到Firewall选项,sleep 10 是要等待前面的模块载入正常,不然会冲过去,后面这个IP是你内网的IP地址范围
sleep 10
iptables -t nat -A POSTROUTING -s 192.38.38.0/24 -j MASQUERADE
C、设置启动OPENVPN连接,到WAN UP脚本下设置,因为tomato的脚本有字节限制,就连最简单的一个OPENVPN+证书的配置都容纳不下,所以我这里耍了一个小聪明,用下载的方式, 例子中是用了2个文件,第一个就是OPENVPN客户端的conf文件(后面有详细说明),第二个suoluo文件是用户密码,如果不想启用用户密码认证的 筒靴可以跳过下载用户密码这一步。每次操作都要sleep一下,是为了保证每个指令都执行成功,时间按照你的猫的速度而定,反正我觉得现在这个sleep 时间比较靠谱。最后一条指令就是启动OPENVPN了,如果不做国内外分流的筒靴可以看完这里就去实践了,要做分流的筒靴请继续。
sleep 20
cd /tmp
sleep 30
openvpn –config suoluo.conf
D、其他的Tomato设置
比如QoS了,就看个人需要了,这里就不浪费口水了
==========OPENVPN.CONF的分流配置==========
#OPENVPN的基本配置
client
dev tun
proto udp
resolv-retry infinite
nobind
persist-key
persist-tun
reneg-sec 86400
auth-user-pass suoluo #这个是用户名密码验证的参数,不需要用户密码验证的去掉这行,顺便说一下啊,suoluo就是刚才下载的那个文件,这个文件的格式很操蛋,必须要多一个回车,也就是用户一行,密码一行,最后还有一个空行才行,官方文档都没写,我都不知道自己怎么琢磨出来的 :-P
auth-retry interact
ns-cert-type server
comp-lzo
verb 3
max-routes 2000 # 这个就是设置国内外分路由的参数了,我设置的最大2000跳,其实就940多条,只不过为了以后的扩展预留。这些都是国内的IP,也就是说加了这个之后, 国内的流量就直接走,不去VPN,这样保证了国内的速度,而且降低了openvpn服务器的压力,IP地址池你也可以自己维护,我是用的 http://ftp.apnic.net/apnic/dbase/data/country-ipv4.lst 的列表做的,目前是最新的。
#push_cn_routes
route 110.6.0.0 255.254.0.0 net_gateway 5
route 110.16.0.0 255.252.0.0 net_gateway 5
…….文章太长了,这里截掉的一段在这里下载 routes
route 61.232.0.0 255.252.0.0 net_gateway 5
route 61.236.0.0 255.254.0.0 net_gateway 5
route 61.240.0.0 255.252.0.0 net_gateway 5
#push_chn_route
#下面是CA证书,也就是你服务器生成的ca.crt文件内容
<ca>
—–BEGIN CERTIFICATE—–
证书内容
—–END CERTIFICATE—–
</ca>
#下面是用户证书,也就是你服务器生成的client.crt文件内容,比如我的suoluo.crt
<cert>
—–BEGIN CERTIFICATE—–
证书内容
—–END CERTIFICATE—–
</cert>
#下面是用户key,也就是你服务器生成的client.key文件内容,比如我的suoluo.key
<key>
—–BEGIN RSA PRIVATE KEY—–
KEY内容
—–END RSA PRIVATE KEY—–
</key>

key-direction 1
#下面是tls认证,也就是你服务器生成的ta.key文件内容
<tls-auth>
#
# 2048 bit OpenVPN static key
#
—–BEGIN OpenVPN Static key V1—–
ta.key内容
—–END OpenVPN Static key V1—–
</tls-auth>

好了,到这里全部都搞定了,如果要用到分流,做路由表大概需要5分钟左右,猫启动后5分钟左右就能上网了,如果不做分流,就2分多种,有什么问题和经验可以一起交流。
 
from: http://suoluo.org/2010/05/223/
----------------------------------------------------------------------------------------------

基于openwrt的超低廉目田猫制作

只要60!!!!!!!!!只花60你就能够无缝翻墙!!!!赶快行动吧!!!!!(仿豆瓣咆哮组)
神马翻墙猫、神马崂山路由器、还有那个神马威众山寨路由器(他们挺黑的,一个破RG100A的猫要卖360,还有一年几百的VPN费用)统统趴下
现在你只需要去淘宝购买一个RG100A-AA或者DB120路由器(如果店主不错估计已经给你刷好了openwrt中文版)成色好点一般淘宝70-80,成色差点就50-60
制作前准备:
1、RG100A-AA路由器一个
2、OPENVPN服务器或者帐号一台(推荐 rapidxen.net的VPS制作OPENVPN,不限流量,速度保证快,我北京联通24小时看u2b的480p不卡,但是由于是PR的线路,老抽 疯,抽抽就好了,最近似乎抽得比较厉害,先观望观望,一年80刀左右,20个朋友一起分担基本上完全够用,或者用我的纯公益性质一年50的 openvpn,哈哈
3、能上网
4、OPENWRT的固件
开始:
一般在淘宝买的都刷好了openwrt.org.cn站长制作的backfire 10.03.166中文版,如果使用的这个版本可以直接跳过网络配置这一段直接到OPENVPN的配置
1、下载固件
最新的openwrt固件 Backfire 10.03.1-rc3,在下面选择openwrt-RG100A_DB120-squashfs-cfe.bin
下载地址:http://downloads.openwrt.org/backfire/10.03.1-rc3/brcm63xx/
推荐固件 openwrt.org.cn站长制作的backfire 10.03.166中文版(如果使用这个版本可直接跳过网络配置
下载地址:http://www.openwrt.org.cn/bbs/viewthread.php?tid=737
2、更新路由器固件
如果之前就是openwrt就直接用固件更新
不是的话就用免TTL的更新方式:
关掉电源,按住RESET键开机,电脑上一直ping 192.168.1.1,直到出现TTL=100的ping值出现即可松开RESET,用浏览器打开192.168.1.1,输入用户 名:telecomadmin,密码:nE7jA%5m,然后进行升级。由于某些CFE版本不一样,还有以下用户和密码可能。
用户:telecomadmin 密码:nE7jA%5m
用户:admin 密码:8mCnC@bj
用户:bjcnchgw 密码:8mCnC@bj
或者密码和用户名一样。
3、网络配置(刷166的可跳过)
首先要用浏览器登录192.168.1.1,点击右边的Administrator变成管理员模式,设置了Admin的密码才能启用SSH
SSH到192.168.1.1
编辑network添加VLAN
vim /etc/config/network
config interface loopback
option ifname   lo
option proto    static
option ipaddr   127.0.0.1
option netmask  255.0.0.0


config interface lan
option type     bridge
option ifname   eth1.0
option proto    static
option ipaddr   192.168.0.38
option netmask  255.255.255.0
option gateway 192.168.0.1
option dns 192.168.0.1
option nat      1


config interface wan
option ifname eth1.1
option proto dhcp
config switch eth1
option reset 1
option enable_vlan 1


config switch eth1
option reset 1
option enable_vlan 1


config switch_vlan
option device eth1
option vlan 0
option ports “1 2 3 5*”


config switch_vlan
option device eth1
option vlan 1
option ports “0 5*”
保存文件,重启后
这样一来,路由器的LAN1口变成了WAN口,可以用这个口连接ADSL猫或者上级路由,通过web管理设置好IP后保证能连上网。
对于无线,如果有问题可以在SSH下通过这个命令重置无线的参数,然后再通过web管理进行设置。

rm -f /etc/config/wireless; wifi detect > /etc/config/wireless
4、OPENVPN设置
确保连上网后可以进行openvpn的安装和配置,超级简单!!!!!!!
首先更新于软件源
opkg update
然后安装openvpn
opkg install openvpn
这样会附带把openvpn需要的lzo压缩库一并就安装好了
完了。。。到这儿就完了。。哈哈
其实重点还是在我之前的翻墙猫的教程中OPENVPN客户端的配置文件上
一般openvpn配置都有ca.crt user.key user.crt user.ovpn文件,我们需要把这4个文件合并成一个文件
可以参照下面的这个文件,如果不需要国内外分流全局VPN就从配置文件中去掉route那些参数
然后执行openvpn –config openvpn.conf 就可以自由翻墙了。。。。(把这个做个执行脚本放在启动里面,开机就自动翻,多爽
等等。。。。
这里还有一个关键的设置,没有iptables的可以通过opkg install 安装
iptables -I FORWARD -o tun0 -j ACCEPT
iptables -t -nat -A POSTROUTEING -s 192.168.1.0/24 -j MASQUERADE
这个可以添加到 /etc/firewall.user里面,就不用每次都输入了,上面那个IP段是路由器下面的IP段,根据你自己设置的LAN下的情况自行更改
==========OPENVPN.CONF的分流配置实例==========
#OPENVPN的基本配置
client
dev tun
proto udp
remote openvpn.suoluo.org
resolv-retry infinite
nobind
persist-key
persist-tun
reneg-sec 86400
auth-user-pass suoluo #这个是用户名密码验证的参数,不需要用户密码验证的去掉这行,顺便说一下啊,suoluo就是刚才下载的那个文件,这个文件的格式很操蛋,必须要多一个回车,也就是用户一行,密码一行,最后还有一个空行才行,官方文档都没写,我都不知道自己怎么琢磨出来的 :-P
auth-retry interact
ns-cert-type server
comp-lzo
verb 3
max-routes 2000 # 这个就是设置国内外分路由的参数了,我设置的最大2000跳,其实就940多条,只不过为了以后的扩展预留。这些都是国内的IP,也就是说加了这个之后, 国内的流量就直接走,不去VPN,这样保证了国内的速度,而且降低了openvpn服务器的压力,IP地址池你也可以自己维护,我是用的http://ftp.apnic.net/apnic/dbase/data/country-ipv4.lst 的列表做的,目前是最新的。
#push_cn_routes
route 110.6.0.0 255.254.0.0 net_gateway 5
route 110.16.0.0 255.252.0.0 net_gateway 5
…….文章太长了,这里截掉的一段在这里下载 routes
route 61.232.0.0 255.252.0.0 net_gateway 5
route 61.236.0.0 255.254.0.0 net_gateway 5
route 61.240.0.0 255.252.0.0 net_gateway 5
#push_chn_route
#下面是CA证书,也就是你服务器生成的ca.crt文件内容
<ca>
—–BEGIN CERTIFICATE—–
证书内容
—–END CERTIFICATE—–
</ca>
#下面是用户证书,也就是你服务器生成的client.crt文件内容,比如我的suoluo.crt
<cert>
—–BEGIN CERTIFICATE—–
证书内容
—–END CERTIFICATE—–
</cert>
#下面是用户key,也就是你服务器生成的client.key文件内容,比如我的suoluo.key
<key>
—–BEGIN RSA PRIVATE KEY—–
KEY内容
—–END RSA PRIVATE KEY—–
</key>

key-direction 1
#下面是tls认证,也就是你服务器生成的ta.key文件内容,可以不要,看服务器是否启用了tls认证
<tls-auth>
#
# 2048 bit OpenVPN static key
#
—–BEGIN OpenVPN Static key V1—–
ta.key内容
—–END OpenVPN Static key V1—–
</tls-auth>
最后,这里 http://downloads.openwrt.org/backfire/10.03.1-rc3/brcm63xx/packages/
有很多软件,可以自己装来玩玩
对了,DNSmasq是默认安装的,这个一定要启用,可以防止GFW的DNS污染。
多说几句:
以前写翻墙猫的教程目的就是让大家自己动起手来制作,后来出了ddwrt的自动vpn翻墙项目(http://code.google.com/p/autoddvpn/)还有神马威众路由器我还挺高兴,就打算不再折腾了,留给大家继续研究,我就算是起了一个带头作用,结果你们一犯懒就有人用此来谋利。
我不反对利用翻墙来谋利,淘宝上卖VPN的多得是,但是把这个翻墙猫做成垄断的而且谋暴利我就要反对了。我一直倡导的是参与的人越多,TG就越没法管这个翻墙猫,因为无从下手,像威众这样做成独家,TG一旦有目标就好动手了,害的不仅是自己,还有可能还殃及使用这个路由器的朋友们。
听说最近VPN都不保了,所以这年头还是自己动手好,教程都写得很清楚了,只要多花一点点时间就能搞定,有问题可以问我。
到此为止路由器上Tomato、DD-wrt、openwrt三种固件的翻墙方案都有了,任君选择。
from https://suoluo.org/2010/09/297/
----------------------------------------------------------------------------------
openvpn is also integrated into the Tomato and DD-WRT and open-wrt firmware that we've used to upgrade our routers into home network superstars.
----------------------------------------------------
http://lifehacker.com/5487500/five-best-vpn-tools
VPN software brings the security of a private network to an insecure network, and allows you to access private local networks from anywhere. As we've explained in the past, you can do things between computers on your local network you can't from out on the internet: like listen to a shared iTunes library or access files in shared folders. Virtual private network applications give you access to your computer from anywhere on the internet as if you were home on your local network. Earlier this week we asked you to share your favorite software for establishing and maintaining virtual private networks. We rounded up the votes, and now we're back with the five most popular VPN applications.
If you're new to the idea of virtual private networks, you can read up on the technical nitty-gritty at the Wikipedia entry for VPNs. Note: This Hive Five contains both VPN server applications (the apps that create virtual private networks on your local network so it's accessible from the outside world) and VPN client applications (the apps that connect to virtual private networks from the outside world). In many instances companies produce VPN servers, VPN clients, VPN servers with accompanying clients, or VPN clients that are designed to work with a variety of servers.

OpenVPN (Windows/Mac/Linux, Free)


OpenVPN is an open source VPN server that's easy to set up for use with open source VPN clients. You can easily export configuration files from OpenVPN to import into a variety of open source and commercial clients. OpenVPN is also integrated into several router firmware packages including popular DD-WRT, OpenWRT, and Tomato. The OpenVPN system isn't compatible with popular commercial VPN providers, but it provides an open source and free alternative for setting up VPNs to expensive and closed commercial models.

Cisco VPN (Windows/Mac/Linux, Variable Cost)

Cisco has a high market saturation in corporate and educational environments, and for many of you, any experience you've had with virtual private networks is through such exposure. The price to run a Cisco VPN is highly variable—and you can't even get a concrete number without a quote from the company—but you can, as an end user, download the free Cisco VPN client for Windows and Mac—though many readers complained about the lack of 64-bit support in the free Cisco client.

LogMeIn Hamachi (Windows/Mac/Linux, Free)


Hamachi's strongest attribute is its ease of use. If you've read some of the other entries in the Hive Five and realized that you don't want a contract for a corporate VPN or the hassle of configuring a bunch of routers with open-source firmware packages, and you just want to set up a simple virtual network between you and your friend, your phone, or your office, Hamachi offers nearly instant deployment. Install the Hamachi client on all the machines and devices you want to connect into your network and add them to your Hamachi VPN and you're done. It's dead simple. The downside, if you're concerned about it, is that your VPN isn't locally managed—it's centrally managed by Hamachi through their servers.

Shrew Soft (Windows/Linux, Free)


Shrew Soft offers a VPN that, while popular in its own right, received quite a boost when people started adopting Windows 7 64-bit in droves and found that Cisco wasn't in any hurry to release a 64-bit client to accommodate them. Shrew Soft works with a variety of VPN server protocols including IPsec, OpenSWAN, freeSWAN, and strongSWAN.

Windows Built-In VPN (Windows, Free)


Windows has a built-in VPN client. Surprised? Many people are. It's not a heavily advertised feature, but it covers many people's needs. Before exploring other client solutions, it's worth pulling up the quick launch box in the Windows start menu and typing "VPN" to start the configuration process. In Windows versions prior to Windows Vista, the built-in VPN client received a fair amount of criticism for lacking features and supported protocols. Since Vista and especially in the Windows 7 implementation, it's grown significantly and unless you need a feature or standard that isn't implemented you may not need to install anything at all.

Now that you've had a chance to look at the five most popular VPN solutions, it's time to cast your vote in the poll below:
Which VPN Tool is Best? (Poll Closed)
Total Votes: 5907


An honorable mention goes out to the Mac OS X built-in VPN client. Have a VPN tip, trick, or application to share? Let's hear about it in the comments
-----------------------------------------------------------------------

基于DD-WRT和OpenVPN的透明翻墙路由


DD-WRT就不解释了 一个强大的无线路由固件,以万能中继为特色。
OpenVPN是一个用于创建虚拟专用网络加密通道的软件包
简单的说下基本的制作:
准备工作:
路由器:我的路由器上是淘宝上买的netgear 614 v6,我的有JTAG口,刷不死啊
固件:因为我有8M flash,所以刷了dd-wrt.v24-14471_NEWD_big.bin(带有OpenVPN 2.1.1),这个固件可以自行去下载,因机器而异,我就不给出链接了。
Openvpn:我买了@yegle 的openvpn,感觉很好
软件操作:
1 刷好路由器,在“设置”页设置好“时间服务”,确保路由的时间是正确的,否则会影响OpenVPN的连接。
破学校的客户端和这个NTP服务冲突,我就手动date设置了。
还有一步请打开路由SSH的功能,在“服务”-“Secure Shell”。
2 编辑你的OpenVPN配置文件,这里需要加入路由信息,路由信息来自于chnroutes
路由的添加我就直接照抄chnroutes项目的说明了,如果有不清楚的直接参见http://code.google.com/p/chnroutes/wiki/Usage
本方法适用于使用openvpn v2.1或更高版本的用户. 因为openvpn v2.1比之前版本增加了一个名为max-routes的新参数, 通过设置该参数, 我们可以在配置文件里(服务端, 客户端)直接添加超过100条以上的路由信息. 具体设置步骤如下:
  1. 下载 chnroutes_openvpn_v2.1 文件
  2. 在命令行里执行 python chnroutes_openvpn_v2.1, 这将生成一个名为 routes.txt 的文本文件. 对于不想安装python的用户, 可以直接从项目下来列表里下载该文件. 它将会每月更新一次.
  3. 使用你喜欢的文本编辑器打开上述文件, 并把内容复制粘贴到openvpn配置文件的末尾
  4. 同时在openvpn配置文件的头部添加一句 max-routes num, 其中num是一个不小于文件routes.txt的行数的数字, 实际上因为还有一些服务器端push过来的路由信息, 所以保险起见可以用 routes.txt的行数加上50, 比如目前得到的routes.txt的行数是940, 你可以把数字设置为1000: max-routes 1000
  5. 修改完之后, 重新进行openvpn连接, 你可以用之前描述过的方法进行测试是否成功
3 不要使用路由界面上自带的OpenVPN设置,那个玩意实在不好说什么了。
在SSH或Telnet下,输入iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE变更iptables的设置。注意啦,很重要的一步,不要照抄,注意内网ip范围是否适用于你自己的环境。
将openvpn的配置文件通过SCP(SSH)放在任何地方,我是直接放在/tmp/root/下,虽然一旦掉电就悲剧了,但是像我这样从来不关路由的没什么影响。
4 命令:
openvpn –daemon –config openvpn配置文件路径
通过观察路由表(route)和进程信息(ps),确认路由信息添加完毕后就行了
至此通过这个路由的网络访问便是国内外分流的了,国内访问照常走国内线路,国外访问则是走VPN(注意是国外访问不是被墙的访问)
终于不用再设置什么xxx代理了……
---------------------------------------------------------------------------------

在自己的无线路由器上开代理(HTTPS2Socks)

在学校只能上教育网,看公网网页必须通过学校的HTTP proxy,很多页面没法看,挂QQ和MSN也不行。

想了个法,写了个软件解决了这个问题。

HTTP proxy 对HTTPS请求一般不作过滤处理直接转发。在内网运行客户端程序作Socks v4/v5服务器,利用此原理将

socks v4/v5 request作为HTTPS流穿透proxy发至家中的无线路由器上,由无线路由器转发并传回结果。这样就可以存在浏览限制的场合使用QQ/MSN和其他上网软件了。原理图如下:

家用路由器使用DDWRT v24作为固件,可以视为一个精简版的Linux。在路由器上开代理/跳板可以利用家里的带宽资源,省电环保又安全。

只要在学校里可以看任何https开头的公网网页,如:https://www.cib.com.cn ,就可使用这种方法访问Internet了。
 
DD-WRT介绍:

DD-WRT其实就是一个供无线路由器使用的嵌入版Linux,它可以在普通的家用无线路由器实现数千元的商用无线路由器功能,不仅如此,对于高手它甚至可以允许自行编译程序,自由扩展无线路由器功能。
DD- WRT的起源要追溯到2003年,当时Cisco/Linksys发售了WRT54G无线路由器,它支持当时最高54Mbps的连接速度。同年有爱好者发 现WRT54G的IOS固件是基于Linux的(IOS就是Cisco对于自己网络设备操作系统的称呼),然而使用Linux作为操作系统的一个基础条件 就是必须把原代码公开,这件事传开之后,本来Cisco 拒绝公开源代码,但最后迫于公众压力,2003年三月份,Cisco公开了WRT54G的源代码。这一下可是打开了一个大宝库,众多基于此源代码的第三方 固件纷纷出台,其中DD-WRT就是最出彩的一个。

使用DD-WRT的好处很多,它具有友好的配置界面,支持多语言(包括简体中 文),可以让无线路由器支持QoS宽带设置、QoS L7过滤,优化带宽并限制最大上行、下行速度和最大连接数等,并可以封杀或者加速BT、电驴下载。支持多种客户端连接模式,如网桥、中继、客户端等模式。 支持数种安全机制,支持客户WPA模式、VLAN、WPA2等安全模式和机制。还支持花生壳的DDNS,方便建立个人网站。它甚至有改造后的直接BT下载 功能。这么强大的DD-WRT是完全免费的。
当然并不是所有的路由器都可以刷新DD-WRT的,毕竟它运行的是Linux系统,需要比较完善 的硬件支持,现在可以刷新为DD-WRT的路由器都是基于Broadcom的CPU的系统,并且对内存和存放固件的Flash闪存容量也有一定要求。 Flash闪存容量至少4MB,而所有的WRT54GS v4.0版本之前的型号都拥有8MB的Flash闪存容量,而也有部分路由器(包括WRT54G和WRT54GS的v5.0型号)仅有2MB的 Flash。需要大家注意的是:DD-WRT的完整版(Standard Vision)和迷你版(Mini vision)的安装都需要4MB的Flash,而2MB Flash容量的路由器只能使用微型版(Micro Vision)。
在此笔者推 荐一些适合刷新DD-WRT的经典无线路由器,它们要么价格便宜,要么性能最强,兼容性也都是最好的。其中包括Buffalo WHR G54s、Buffalo WHR G54s、Asus WL 500G Deluxe以及Motorola WR850G这几个产品,当然也包括WRT54G拥有8MB Flash的产品。

DD-WRT支持的无线路由器 列表

看 过上面的介绍,刷好DDWRT的无线路由器即可看作一个运行精简版Linux的小主机。小主机直接挂在internet上,耗电省,能长时间稳定工作,不 怕网上攻击和病毒,不必担心安全问题,很适合用作个人代理服务器使用。另外i刷好DDWRT还可以安装电驴和BT等实现脱机下载。
只要找一台支持DDWRT的无线路由器刷上内置代理的DDWRT v24中文版即可方便的架设代理服务器了。
感兴趣的同学可以在TAOBAO上淘一台刷好DDWRT中文版的无线路由器。这里注意一定要使中文版的DDWRT,因为能刷中文版DD的无线路由器必定配有4M Flash,可以方便地进行固件升级。
用本贴的链接下载固件,然后固件升级。DDWRT固件升级的界面如下:
 
 
刷好无线路由器,接上家里的ADSL或Cable Modem


在电脑IE浏览器上访问http://192.168.1.1,DDWRT设置界面出现后,选Setup。


输入ADSL 用户和密码信息


保存设置后, 还需要上网注册DDNS服务并在DDWRT的DDNS上贴写DDNS信息。这样做主要是为了在局域网内能够方便的得到家里无线路由器的地址。
 
设置好家里的无线路由器后,只要在局域网内运行跳板程序即可联机家里的无线路由器,突破局域网防火墙限制了。具体使用步骤:

1.下载跳板程序 iTube.exe。iTube是纯绿色软件无需安装直接运行,经测试在XP环境下运转正常。

2.设置无线路由器跳板服务接入密码

3.设置iTube
分两种情况:如果通过HTTP proxy上网浏览的,需要填写HTTP proxy地址/端口/NT用户名/密码等信息;如果不通过proxy上网的,只需随机贴写端口信息即可:

4.贴写好信息后选择应用,如何看到如下信息就说明程序已成功和无线路由联机,可以使用程序提供的socks v4/v5代理服务了!
 
在路由器上开代理/跳板可以利用家里的带宽资源,省电环保又安全。原来还可以这么弄啊。
from http://bbs.proxycn.com/read-htm-tid-266530.html
-----------------------------------------------------------

多台电脑使用DD-WRT路由器 同时使用VPN

What is DD-WRT?
DD-WRT is firmware that is available at www.dd-wrt.com that allows you to replace your current firmware on your router to a modified featured packed one.
Once done you will have much more functionality on your router. In regarding VPN the most important being the ability to connect your VPN directly from your router.
This is very popular for customers wanting their whole home network on the VPN. It’s also popular for Xbox and PS3 users that are looking to give their consoles a American IP.
As you can see from the graphic below, this is how it works:

Without DD-WRT each computer will require it’s own VPN account:
DD-WRT 设置:

--------------------------------------------------------------------------------------------------------
最近入手了了一个DIR-600,据传这是能刷DDWRT固件的最便宜的路由了,并且这个路由刷不死,不用担心变成转头,我买的硬件版本是B2,完美支持DDWRT,这里给出适用于DIR-600的DDWRT固件
dlink-dir600b-factory-webflash.bin
dir600b-revb-ddwrt-webflash.bin
把这两个文件下载到本地,把本地IP改成192.168.0.x,网关改成192.168.0.1,然后进路由器升级界面,刷dlink-dir600b-factory-webflash.bin,过个两三分钟刷完后,然后把网关和本地IP改为192.168.1.x,然后在ddwrt路由界面刷dir600b-revb-ddwrt-webflash.bin,就可以了.DDWRT界面是有中文的哦.在设置选择就好了.
dir-600号称刷不死的路由,随时可以刷回官方的固件,这里也给出原厂固件的下载地址,这是最新版的B2原厂固件,和刚买回来的时候是一样的.
DIR-600_fw_revB_2-03B04_all_en_20100601.zip
下 载下来解压后有固件和语言包,要刷回官方固件,按那个dir-600后面的Reset那个孔,大概三十秒左右指示灯开始变黄开始闪,这时候打开 192.168.0.1选择下载回来的原厂固件 一分多钟就刷好了,按后进路由器升级界面刷中文语言包就可以变成中文了.很方便.
ddwrt真是个牛逼的固件,现在正在玩无线中继.不过dir-600对这个支持好像不怎么样,我也还没测试,配合
autoddvpn来用那是相当的爽啊,和现在网上卖的威众路由器差不多吧!只是不要那么贵,dir-600之前新蛋和京东的价格都是145来着,前段时间京东降到了125我就果断的出手了,结果刚发货就有降到99了,价格保护也申请不了,真是悲剧,性价比蛮高的一款路由.
from http://aenes.com/archives/664.html
---------------------------------------------
http://www.dd-wrt.com/wiki/index.php/OpenVPN
--------------------------------------------------

Tomato DualWan

Tomato DualWAN 使那些能刷Tomato或DD-WRT固件的路由器由原来的单WAN口变成双WAN口,而这一切不需要在路由器上增加任何硬件,只需要刷一下 Tomato DualWAN 固件就可以。刷了Tomato DualWAN之后转变出来的第二个WAN口可以接有线网络也可以接无线网络,双WAN模式支持带宽合并或智能路由。
注意:要工作在双WAN模式,您必须要有两条线路(可以是自己的线路+别人的无线网络)或者有两个宽带帐号,否则无法工作在双WAN模式。
刷了 Tomato DualWAN 的路由器除了具备普通路由器的基本功能以外,还提供如下特色功能:
带 宽合并/负载均衡,可以将两条线路的带宽合并实现快速下载 智能路由,自动根据目标IP所属ISP选择最优线路出去,加快用户访问速度 QoS/IP限速,合理分配网络带宽 设备流量实时查看,了解每台电脑的流量状况 ARP绑定,可以阻止非法用户使用网络 IPID防电信网络尖兵 VPN(PPTP)服务器和客户端,可以将分布在不同地方的办公室组成一个局域网 支持Apple(Mac OS X)的NAT-PMP(UPnP的另外一种) BT脱机下载功能(路由器需要有USB接口),睡觉前或者上班的时候让路由器帮你下载喜欢的游戏或者电影,而不需要开着电脑 Samba服务器(路由器需要有USB接口),提供文件共享功能,以便直接在PC上播放路由器下载好的电影 FTP服务器(路由器需要有USB接口) 3G上网功能(路由器需要有USB接口),插上USB接口的3G上网卡或者智能手机后,路由器就变成一个3G路由器,团队出差的时候多人共享上网很方便 上网通告功能 建议第一次接触Tomato DualWAN的朋友请先看一下FAQ和用户手册
项目地址http://code.google.com/p/dualwan/
下载地址http://code.google.com/p/dualwan/downloads/list
-------------------------------------------------------------------
有没有想过将翻墙这一行为在路由器端完成,这样一来下游的所有接入设备就自然处于无墙的网络环境了,答案是肯定的,本文作为抛砖引玉来浅层次探讨,技术细节不在讨论范围之内。
目前最成熟和稳定的翻墙方法是VPN,但市面上的路由器几乎都不提供VPN的连接功能,好在有一个叫做DD-WRT的第三方路由器固件,我们可以通 过刷机的方法来将自己的路由器固件升级为DD-WRT,以获得包括VPN连接在内的多种客制化功能。以实用性为出发点,基于VPN的无墙网络方案有两种:
DD-WRT是 一个基于linux的开源路由器固件,提供VPN,OpenVPN,无线中继,QoS流量控制,甚至增大发射功率等等功能。并且你可以telnet或是 ssh登陆DD-WRT,执行各种命令或是hack。包括TP-Link, D-Link, Buffalo, Cisco Linksys在内的不少路由器已经支持刷DD-WRT固件,这里是详细的设备支持列表
第一种方案属于技术型,需要自己手动给路由器升级固件,配置autoddvpn:
技术架构:VPN + DD-WRT + autoddvpn
将路由器升级至DD-WRT固件以支持VPN连接功能后,即实现了全局VPN上网,但全局VPN有个问题:一旦连上VPN,下游设备的所有流量都会 路由到VPN线路上,也就是上国内的网站也需要到美国(以美国为例,严格来说是VPN所在地)去绕一圈,浪费VPN流量事小,还会影响到上国内网站的速 度,解决这个恼人问题的项目叫做autoddvpn,你需要做的仅仅是在浏览器上登陆路由器的管理页面,在防火墙的页面上添加一行命令,然后保存。autoddvpn 的原理是,按IP地址的物理属性进行路由,即所有中国大陆的IP地址直接走本地网关,其余的则全部走VPN通道。
资金投入:支持DD-WRT的家用(无线)路由器,200元左右;VPN,目前的市价约为150元每年。
第二种方案属于懒人型,你只需要掏钱而已:
国内已经有团队将整套翻墙方案集成到家用路由器里面,提供一条龙的完美无墙网络,做这个事情的是威众安全路由器。你只需要购买他们的路由器,然后以年为单位支付服务费用,其余所有问题都不用你操作和担心。值得推荐的是,威众安全路由器除适合家庭环境外,也相当适合咖啡馆或是小型公司。
资金投入:官方公布的标准版价格是360元每台,包括一年的服务费用。
-------------------------------------------------------------------------------------------------------------

Setup SSH on Your Router for Secure Web Access from Anywhere

Connecting to the internet from Wi-Fi hotspots, at work, or anywhere else away from home, exposes your data to unnecessary risks. You can easily configure your router to support a secure tunnel and shield your remote browser traffic—read on to see how.

What is and Why Set Up a Secure Tunnel?

You might be curious why you would even want to set up a secure tunnel from your devices to your home router and what benefits you would reap from such a project. Let’s lay out a couple different scenarios that involve you using the internet to illustrate the benefits of secure tunneling.
Scenario one: You’re at a coffee shop using your laptop to browse the internet through their free Wi-Fi connection. Data leaves your Wi-Fi modem, travels through the air unencrypted to the Wi-Fi node in the coffee shop, and then is passed on to the greater internet. During the transmission from your computer to the greater internet your data is wide open. Anyone with a Wi-Fi device in the area can sniff your data. It’s so painfully easy that a motivated 12 year old with a laptop and a copy of Firesheep could snatch up your credentials for all manner of things. It’s as though you’re in a room filled with English-only speakers, talking into a phone speaking Mandarin Chinese. The moment somebody who speaks Mandarin Chinese comes in (the Wi-Fi sniffer) your pseudo-privacy is shattered.
Scenario two: You’re at a coffee shop using your laptop to browse the internet through their free Wi-Fi connection again. This time you’ve established an encrypted tunnel between your laptop and your home router using SSH. Your traffic is routed through this tunnel directly from your laptop to your home router which is functioning as a proxy server. This pipeline is impenetrable to Wi-Fi sniffers who would see nothing but a garbled stream of encrypted data. No matter how shifty the establishment, how insecure the Wi-Fi connection, your data stays in the encrypted tunnel and only leaves it once it has reached your home internet connection and exits to the greater internet.
In scenario one you’re surfing wide open; in scenario two you can login to your bank or other private web sites with the same confidence you would from your home computer.
Although we used Wi-Fi in our example you could use the SSH tunnel to secure a hardline connection to, say, launch a browser on a remote network and punch a hole through the firewall to surf as freely as you would on your home connection.
Sounds good doesn’t it? It’s incredibly easy to set up so there’s no time like the present—you can have your SSH tunnel up and running within the hour.

What You’ll Need

whatyouneed
There are many ways to setup an SSH tunnel to secure your web browsing. For this tutorial we’re focusing on setting up an SSH tunnel in the easiest possible way with the least amount of fuss for a user with a home router and Windows-based machines. To follow along with our tutorial you’ll need the following things:
  • A router running the Tomato or DD-WRT modified firmware.
  • An SSH client like PuTTY.
  • A SOCKS-compatible web browser like Firefox.
For our guide we’ll be using Tomato but the instructions are almost identical to the ones you would follow for DD-WRT so if you’re running DD-WRT feel free to follow along. If you don’t have modified firmware on your router check out our guide to installing DD-WRT and Tomato before proceeding.

Generating Keys for Our Encrypted Tunnel

2011-07-12_154823
Although it might seem odd to jump right to generating the keys before we even configure the SSH server, if we have the keys ready we’ll be able to configure the server in a single pass.
Download the full PuTTY pack and extract it to a folder of your choice. Inside the folder you’ll find PUTTYGEN.EXE. Launch the application and click Key –> Generate key pair. You’ll see a screen much like the one pictured above; move your mouse around to generate random data for the key creation process. Once the process has finished your PuTTY Key Generator  window should look something like this; go ahead and enter a strong password:
2011-07-12_155057
Once you’ve plugged in a password, go ahead and click Save private key. Stash the resulting .PPK file somewhere safe. Copy and paste the contents of the “Public key for pasting…” box into a temporary TXT document for now.
If you plan on using multiple devices with your SSH server (such as a laptop, a netbook, and a smartphone) you need to generate key pairs for each device. Go ahead and generate, password, and save the additional key pairs you need now. Make sure you copy and paste each new public key into your temporary document.

Configuring Your Router for SSH

2011-07-12_161125
Both Tomato and DD-WRT have built-in SSH servers. This is awesome for two reasons. First, it used to be a huge pain to telnet into your router to manually install an SSH server and configure it. Second, because you’re running your SSH server on your router (which likely consumes less power than a light bulb), you never have to leave your main computer on just for a lightweight SSH server.
Open a web browser on a machine connected to your local network. Navigate to the web interface of your router, for our router—a Linksys WRT54G running Tomato—the address is http://192.168.1.1. Login to the web interface and the navigate to Administration –>SSH Daemon. There you need to check both Enable at Startup and Remote Access. You can change the remote port if you desire but the only benefit to doing so is that it marginally obfuscates the reason the port is open if anyone port scans you. Uncheck Allow Password Login. We will not be using a password login to access the router from afar, we will be using a key pair.
Paste the public key(s) you generated in the last part of the tutorial into the Authorized Keys box. Each key should be its own entry separated by a line break. The first portion of the key ssh-rsa is very important. If you do not include it with each public key they will appear invalid to the SSH server.
Click Start Now and then scroll down to the bottom of the interface and click Save. At this point your SSH server is up and running.

Configuring Your Remote Computer to Access Your SSH Server

This is where the magic happens. You’ve got a key pair, you’ve got a server up and running, but none of that is of any value unless you’re able to remotely connect from the field and tunnel into your router. Time to bust out our trusty net book running Windows 7 and set to work.
First, copy that PuTTY folder you created to your other computer (or simply download and extract it again). From here out all instructions are focused on your remote computer. If you ran the PuTTy Key Generator on your home computer make sure you’ve switched over to your mobile computer for the rest of the tutorial. Before you settle you’ll also need to make sure you have a copy of the .PPK file you created. Once you have PuTTy extracted and the .PPK in hand, we’re ready to proceed.
Launch PuTTY. The first screen you’ll see is the Session screen. Here you’ll need to enter the IP address of your home internet connection. This is not the IP of your router on the local LAN this is the IP of your modem/router as seen by the outside world. You can find it by looking at the main Status page in your router’s web interface. Change the Port to 2222 (or whatever you substituted in the SSH Daemon configuration process).  Make sure SSH is checked. Go ahead and give your session a name so that you can save it for future use. We titled ours Tomato SSH.
2011-07-12_164342
Navigate, via the left-hand pane, down to Connection –> Auth. Here you need to click the Browse button and select the .PPK file you saved and brought over to your remote machine.
2011-07-12_164236
While in the SSH sub-menu, continue down to SSH –> Tunnels. It is here we are going to configure PuTTY to function as proxy server for your mobile computer. Check both boxes under Port Forwarding. Below, in the Add new forwarded port section, enter 80 for the Source port and the IP address of your router for the Destination. Check Auto and Dynamic then click Add.
2011-07-12_165154
Double check that an entry has appeared in the Forwarded Ports box. Navigate back the Sessions section and click Save again to save all your configuration work. Now click Open. PuTTY will launch a terminal window. You may get a warning at this point indicating that the server’s host key is not in the registry. Go ahead and confirm that you trust the host. If you’re worried about it you can compare the fingerprint string it gives you in the warning message with the fingerprint of the key you generated by loading it up in PuTTY Key Generator. Once you’ve opened PuTTY and clicked through the warning you should see a screen that looks like this:
2011-07-12_171145
At the terminal you will only need to do two things. At the login prompt type root. At the passphrase prompt enter your RSA keyring password—this is the password you created a few minutes ago when you generated your key and not your router’s password. The router shell will load and you’re done at the command prompt. You’ve formed a secure connection between PuTTY and your home router. Now we need to instruct your applications how to access PuTTY.
Note: If you want to simplify the process at the price of slightly decreasing your security you can generate a keypair without a password and set PuTTY to login to the root account automatically (you can toggle this setting under Connect –> Data –> Auto Login). This reduces the PuTTY connection process to simply opening the app, loading the profile, and clicking Open.

Configuring Your Browser to Connect to PuTTY

2011-07-12_201109
At this point in the tutorial your server is up and running, your computer is connected to it, and only one step remains. You need to tell the important applications to use PuTTY as a proxy server. Any application which supports SOCKS protocol can be linked to PuTTY—such as Firefox, mIRC, Thunderbird, and uTorrent, to name a few—if you’re unsure if an application supports SOCKS dig around in the options menus or consult the documentation. This is a critical element that shouldn’t be overlooked: all your traffic isn’t routed through the PuTTY proxy by default; it must be attached to the SOCKS server. You could, for example, have a web browser where you turned on SOCKS and a web browser where you didn’t—both on the same machine—and one would encrypt your traffic and one wouldn’t.
For our purposes we want to secure our web browser, Firefox Portable, which is simple enough. The configuration process for Firefox translates to practically any application you’ll need to plug in SOCKS information for. Launch Firefox and navigate to Options –> Advanced –> Settings. From within the Connection Settings menu, select Manual proxy configuration and under SOCKS Host plug in 127.0.0.1—you’re connecting to the PuTTY application running on your local computer so you must put the local host IP, not the IP of your router as you’ve been putting in every slot so far. Set the port to 80, and click OK.
We have one tiny little tweak to apply before we’re all set. Firefox, by default, doesn’t route DNS requests through the proxy server. This means that your traffic will always be encrypted but somebody snooping the connection would see all your requests. They’d know you were at Facebook.com or Gmail.com but they wouldn’t be able to see anything else. If you wan to route your DNS requests through the SOCKS, you’ll need to turn it on.
2011-07-12_202336
Type about:config in the address bar, then click “I’ll be careful, I promise!” if you get a stern warning about how you can screw up your browser. Paste network.proxy.socks_remote_dns into the Filter: box and then right click on the entry for network.proxy.socks_remote_dns and Toggle it to True. From here out, both your browsing and your DNS requests will be sent through the SOCKS tunnel.
Although we’re configuring our browser for SSH-all-the-time, you may wish to easily toggle your settings. Firefox has a handy extension, FoxyProxy, that makes it super easy to toggle your proxy servers on and off. It supports tons of configuration options like switching between proxies based on the domain you’re on, the sites you’re visiting, etc. If you want to be able to easily and automatically turn your proxy service off based on whether you’re at home or away, for example, FoxyProxy has you covered. Chrome Users will want to check out Proxy Switchy! for similar functionality.
Let’s see if everything worked as planned, shall we? To test things out we opened up two browsers: Chrome (seen on the left) with no tunnel and Firefox (seen on the right) freshly configured to use the tunnel.
2011-07-12_163523
On the left we see the IP address of the Wi-Fi node we’re connecting to and on the right, courtesy of our SSH tunnel, we see the IP address of our distant router. All Firefox traffic is being routed through the SSH server. Success!

Have a tip or trick for securing remote traffic? Use a SOCKS server/SSH with a particular app and love it? Need help figuring out how to encrypt your traffic? Let’s hear about it in the comments.

 
This article was originally written on 07/13/11 Tagged with: Other
HTML design tool. Free 30 day trial HTML5 & CSS3 support
Free webhosting & domain 1 year, with e-mail & blog - Setup only £9!
Try it now 2 Minutes and you're done!
Appears on your computer like any disk drive. Access files anywhere.
Free 1Gbps, Xeon, DDR3, 100% SLA, Control Panel, UK, Buy Online 24/7
Plesk Control Panel Fast Uk hosting, same hour setup
Find Routers at Great Prices! Top Brands At Low Prices.
The Ultimate Choice for Webmail. Free E-mail Address. Now Go for It!
Manage, Monitor & Control donwoads from your wordpress site
Yes, it's easy. Nothing to install. Try it Free!
Linux/Win 2008, Xen/Hyper-V, instantly up, no contract, £1 trial
Business Forecasting and Planning Software. Free Demo!
Try CenturyLink's Network-Based IP VPN. Learn More Today.
Stable, high-performance server supports SSH, FTP/S transfers
Fixo + celular ! Um mês grátis
Sick of the Same Content? Play the RIFT Free Trial!
Compare Products, Prices & Stores. X Box Games At Low Prices.
Football Info & Football Games Picks Instantly To Your E-mail - Free!
Broadband & Phone 4 months Free! Then £13p/m. Online Exclusive Offer
Help you tackle online market & help your business grow from £129.
Experience Opera, Ballet, Operetta. New Program Available - Book Now!
Comfort with Accuracy. Compact & Portable Design. Buy Today!
Choose from 1M+ Verified Suppliers. Contact Directly & Get Live Quotes!
Show Your Value In The Workplace Earn an IT Degree From Kaplan Now!
Find more sources/options for what your looking for
Find Anonymous Web Proxies at Great Prices.
Great quality custom suits @ great prices, visiting all major cities.
Save Big on High-Speed Wireless Modems/Routers. Find Many Models!
Small, high performance, low cost 169Mhz 868Mhz Wireless M-Bus Module
Award winning wireless DMX and RDM, Wireless Ethernet protocols
Affordable UK Web Hosting for your Business. No Setup Fees!
Host Unlimited WordPress Domains with Heroic Support for under $3/mo
Professional UK Hosting from 75p/mo Hosting, VPS and Dedicated Servers
800+ Linksys Products Shop, Compare and Save at Pronto.
Search multiple engines for ip address management
Ligações ilimitadas por $12 mensais + número local em todo Brasil
Find New Markets For Your Products Use Global Market Finder Now!
220Gbit Global Network Speed US, CA, UK and EU Servers.
Send faxes through FOIP with GFI FaxMaker. 2011 version out now!
All the latest top OEM transceivers 100% Compatible 70-90% Savings
To the User's Browser, via Toolbar. Enjoy Increased Traffic & Revenues.
The pen that turns your handwritten notes into editable text!
Partez à la chasse et assouvissez votre soif! Jouez gratuitement
mídias digitais e impressas (convites, marcas, sites, videos..)
Over 10 Million Images Online Sign Up For Free Hi-Res Images!
Cheap, fast and reliable domains & web hosting. Perfect for every one!
Plesk, PHP 5, Web Apps, Joomla AtMail, 24/7 Support, Instant Setup
Airtime bundles + OS grid refs from established UK specialist dealer
Editing xml is difficult. Xopus makes it simple.
Public Transportation, Railway Fernwartung, CCTV, ÖPNV
Sync/backup file by schedule Easy-to-Use, yet powerful features
Sick of the Same Content? Play the RIFT Free Trial!
Compare Products, Prices & Stores. X Box Games At Low Prices.
Football Info & Football Games Picks Instantly To Your E-mail - Free!
More Custom Hosting From A Trusted Source. 24x7 Support. Chat Now.
800+ Linksys Products Shop, Compare and Save at Pronto.
Get Info On Domain Names Register Access 10 Search Engines At Once.
Découvre ce jeu délirant! Funny Racer enfin sur ton PC.
Le célèbre jeu de simulation de protégeant les animaux 4,99/sem
Jouez à des jeux géniaux en français gratuitement sur Zylom !
Enterprise-grade cloud services for SMB prices. VMware vCloud Powered.
Enhance your login security with Nordic Edge solutions. Free trial!
Get 100% up-to-date drivers on your system.
Great value hosting from UKHost4u. Get up to 8 domain names free!
Website Hosting Sky Data Hosting Domain Registration, Ecommerce
Web Hosting Review and Discounts Find Hosting at The Lowest Prices!
Great Deals on New and Used Servers Storage, Workstations and More!
Ultra Slim Bumper for iPhone 4 Get it Fast. Worldwide Shippng
Sistemas, Redes, Firewall, Samba Brindes e Pagtos em até 12x
Save on Women's Plus Size Dresses for Everyday & Special Occasions.
Play Disney's Pirates Online and Live the Adventure. Play Now!
Build Your Own Empire Online Unlimited Free Membership
A professional Wi-Fi analysis tool. Gain visibility into your WLAN!
220Gbit Global Network Speed US, CA, UK and EU Servers.
Worried about hackers ? SAAS authentication 4 sites & apps
Microcanelado, Canal B, Mini-micro Cartão e Cartolina
£3700 Profit. Easy To Use Software Football Tips With 47 Months Profit
Cherchez Filme Venez Vite les Découvrir!
800+ Linksys Products Shop, Compare and Save at Pronto.
Hidden Tiny Spy Camera.HD Video and HIFI Audio,Worldwide Free Shipping!
CVD ZnSe: Blanks, Windows, Lenses, Beam-Combiners, Partial-reflectors
Hands-on MCSE MCITP CCNA A+ Courses Instructor-led computer training
top speed & fast cars find your favourite sport car
800+ Linksys Products Shop, Compare and Save at Pronto.
Host your blog with OverBlog : Easy, Fast and Free !
Free Setup & Free Apps Included 33% Off Shared - 10% Off Reseller
Unlimited pages, colours & designs Upload mp3s, photos & more. Free!
Scan your Ports & Networks... Download LanGuard Free Trial Today!
Industrial main board Single Board Computer
Power supplies for routers, hubs and peripheral products
Design Clássico ou Moderno Confira! Lustres Baratos de Grande Qualidade
Cartões de visitas folders adesivos criação gráfica banners marcas
Have your memories on proud display picture frame. 32% off all items
Desarrolle Redes Inalámbricas de Sensores de manera fácil y rápida
The ultimate choice for webmail. Superior virus- & spam protection.
Find more sources/options for what your looking for
Millions of Monthly Installs. Free Consultation. Contact Us Today
Offert! Entre dans la peau des plus grands mafiosos avec Mafia 2
Classement, résultats, match live. Résultats de foot : Football365.fr
Hands-on MCSE MCITP CCNA A+ Courses Instructor-led computer training
top speed & fast cars find your favourite sport car
FTP, SFTP and FTPS in a single component. Powerful FTP controls.
Hidden Tiny Spy Camera.HD Video and HIFI Audio,Worldwide Free Shipping!
CVD ZnSe: Blanks, Windows, Lenses, Beam-Combiners, Partial-reflectors
Is your wireless network secure? free Network Vulnerability Scan.
Edit XML, DTD, XML Schema, XSL/XSLT Use FULL Functionality for 30 Days!
You can get a loan for a home in India. While you are in UK. Enquire
Conquer the galaxy in DarkOrbit and Get your exclusive Starter Pack!
Reliable, affordable web hosting. iPhone and Desktop control panels
Cheap Web Hosting £2.49/mo - Free .co.uk Domain With Every Purchase
Compare Broadband Deals. Broadband From £4.99. Latest Deals Online.
220Gbit Global Network Speed US, CA, UK and EU Servers.
100s of Droid Android Phone Top Brands at Low Prices
Try it now 2 Minutes and you're done!
Play Unlimited Free Online Games, Save Scores & Challenge Others!
£3700 Profit. This System Works Football Tips With 47 Months Profit
Vt Hokie Acc football games. Hokies football in Blacksburg Va.
Distribution & Management of your Content in Latin America.
Free Open Source Joomla extension to manage your DreamHost account
For Samsung Galaxy Indulge $4.99 - 4G for computers!
Millions of Monthly Installs. Free Consultation. Contact Us Today
Découvre ce jeu délirant. Deviens le meilleur fermier. C'est Offert!
Téléchargez à des jeux géniaux gratuitement sur Zylom.fr !
Is your wireless network secure? free Network Vulnerability Scan.
Royaty free OCR engine. For VB.NET, c#, Delphi, vb6, c++
Find differences between files. Free trial. Download now!
Hands-on MCSE MCITP CCNA A+ Courses Instructor-led computer training
sport cars pics & specs sport cars 2011-2012 reviews
800+ Linksys Products Shop, Compare and Save at Pronto.
Edit XML, DTD, XML Schema, XSL/XSLT Use FULL Functionality for 30 Days!
You can get a loan for a home in India. While you are in UK. Enquire
Conquer the galaxy in DarkOrbit and Get your exclusive Starter Pack!
Is your wireless network secure? free Network Vulnerability Scan.
Hidden Tiny Spy Camera.HD Video and HIFI Audio,Worldwide Free Shipping!
400+ Gorgeous Chiffon Dresses & Skirts from Top Brands & Designers.
Earn £ for all referrals + £5 bonus Discount codes, links, logos & more
Innovative Solutions For Business Call Free Phone on 0800 8600 372
Discount Coupons On Quality Hosting Get hosting for 1CENT!
Spend $0 to Get Started Today! Accept Credit Card Anywhere_No Cost
Cell Phone Track & More! 100,000 Stores. Deals. Reviews.
Windows utility that synchronizes and protects your flash drive data.
Search multiple engines for ip address management
Send faxes through FOIP with GFI FaxMaker. 2011 version out now!
Find Anonymous Web Proxies at Great Prices.
SMS based two-factor authentication. Try free.
Catalonia Port 3* Book now from 100€
The only real Exchange replacement for your Linux mail server.
Offert! Entre dans la peau des plus grands mafiosos avec Mafia 2
Classement, résultats, match live. Résultats de foot : Football365.fr
Microcanelado, Canal B, Mini-micro Cartão e Cartolina
Transform Your Home Entertainment System- HTPC Cases, Remotes & More!
Fast, easy-to-use and affordable backup for Linux & other OS. Try it
Sync/backup file by schedule Easy-to-Use, yet powerful features
Find more sources/options for what your looking for
FTP, SFTP and FTPS in a single component. Powerful FTP controls.
Carbide micro tools, end mills routers, drills .0002" up to .125
The first & only Platform allowing you 100% Free Gaming. Try it now!
Claim your Free Reading from this accurate & talented Astrologer now
£3700 Profit. This System Works Football Tips With 47 Months Profit
Is your wireless network secure? free Network Vulnerability Scan.
Hidden Tiny Spy Camera.HD Video and HIFI Audio,Worldwide Free Shipping!
400+ Gorgeous Chiffon Dresses & Skirts from Top Brands & Designers.
Drag-and-drop HTML creation, JavaScript, CSS & More. Try Free!
Find 3,000+ Spy Cameras Online. Wholesale Prices,From China!
Plotters e impressoras sublimáticas melhores preços do mercado
Personify Your Space With Free Glitters, Graphics, Layouts - Free!
Sites $2.75/month Unlimited Traffic No Disk Limit | Scale Up Anytime
Free 5 Page Website & Email Account Free Blog, Free Domain Forwarding
Lowest Prices Guaranteed! We ship to Central & South America
Fast, easy-to-use and affordable backup for Linux & other OS. Try it
Find a Top Brand Wireless Signal Booster at a Cheap Price. Deals!
Classic Little Black Dresses Under $100, Buy Now!
The first & only Platform allowing you 100% Free Gaming. Try it now!
Synchronization software for your files and folders. Free trial.
Design Clássico ou Moderno Confira! Lustres Baratos de Grande Qualidade
Tools to Administrate,Report,Alert Control, Secure, Deploy & Migrate.
Share your LAN connection with fast kernel-mode NAT, web cache, filter.
Le célèbre jeu de simulation de protégeant les animaux 4,99/sem
£3700 Profit. Easy To Use Software Football Tips With 47 Months Profit
Cherchez Filme Venez Vite les Découvrir!
How Do I Know My Dns Number Info Access 10 Search Engines At Once.
Adapters for AS2, SFTP, FTPS, FTP POP3, IMAP, SMTP, SSH, OFTP, etc.
Shop auto parts & accessories. Buy and save on eBay Motors!
Transform Your Home Entertainment System- HTPC Cases, Remotes & More!
Royaty free OCR engine. For VB.NET, c#, Delphi, vb6, c++
Find differences between files. Free trial. Download now!
Edit & Debug Your PHP Applications Easy-to-Use, Download a Free Trial!
Professional HTML editor control for .Net, Java, ActiveX !
Thinking of buying? Compare 100s of retailers' prices at Shopping.com
100+ Wi Fi Antennas Shop, Compare and Save at Pronto.
Luxury Brands Selection Worldwide shipping
Find more sources/options for what your looking for
Linux Virtualization Desktop The VDI platform for Linux
Download a Marketing Plan Template Just Fill-in the Blanks & Print!
International topics information and news in Multilinguale
Drag-and-drop HTML creation, JavaScript, CSS & More. Try Free!
Find Cool Headphone Online. Wide Range,Buy From China!
Plotters e impressoras sublimáticas melhores preços do mercado
Windows Server w/Event Automation WS_FTP Server. Free Demo Version.
Appears on your computer like any disk drive. Access files anywhere.
Free 1Gbps, Xeon, DDR3, 100% SLA, Control Panel, UK, Buy Online 24/7
Secure terminal and file transfer. Now with FIPS 140-2.
Up to 10 x stronger WiFi signal on laptop. 5 Min Setup
Get High Speed Wireless Broadband Starting At $9/Mo. For 24 Months.
Clientless Remote Network Access for Enterprises; View Free Demo!
Access your broadband Internet from anywhere on your property
Secure Your Site with VeriSign SSL. Get VeriSign SSL & Trust Seal Now!
We Utilize World-Class Security & Processes To Keep Your Data Safe!
Resolve app problems 10 times faster. Download AppDynamics.
Web Hosting Prices, Reviews & Ranks Compare Best Hosts Before You Buy!
Boot up Any Computers, Fix & Install Windows Easily!
Web-based Password Management Software. Free Trial Download
Start seeing higher fill rates now! Download our free SDK today
Get Maximum I/O Performance On Your Virtual Business Servers. Order Now
Scalable Performance, Lowest TCO, SSL VPN, Free Evaluation Guide
Secure terminal, file transfer, and tunneling. Download Now!
Access your broadband Internet from anywhere on your property
Scalable Performance, Lowest TCO, SSL VPN, Free Evaluation Guide
Get Maximum I/O Performance On Your Virtual Business Servers. Order Now
Fast, secure and reliable wireless networking solutions from Cisco!
Upload, Download, Share Large Files Free Trial. No Credit Card Required
Try tc Server — Free Trial. Less Complexity than J2EE.
Today: Website Selling Laptops for as low as $33.33! Buy Yours Today?
Why Pay More? Wireless Broadband For Only $9/Mo. Limited Time Offer!
Secure terminal and file transfer. Now with FIPS 140-2.
A Step-By-Step Guide For Beginners. Read Along and Start Your Own Blog.
A Step-By-Step Guide For Beginners. Read Along and Start Your Own Blog.
A Step-By-Step Guide For Beginners. Read Along and Start Your Own Blog.

Comments (41)

  1. Srivatsan Venkatesh
    1 question. Once I set everything up on the router, do I need the PC at home to be on, or is the server on the router itself?
  2. Jason Fitzpatrick
    The server is run by the embedded Linux within the router, as long as your broadband modem and router are on the only other component you need is a remote computer with PuTTY and a SOCKS-enabled application like Firefox.
  3. Dan Weston
    You should also look at the free (and portable) program called MyEnTunnel. It also runs through putty, but is slightly easier to configure and save to a USB drive. I’ve been using it for years.
  4. jasray
    Question mark on this one. Rather than go into a lengthy response, I honestly hope readers will research SSH servers and find out how many options they have. The tutorial here is much more complicated than setting up SSH needs to be. The best bet, so one doesn’t have to leave a machine on at home, is to use Hotspot Shield or some other free VPN service. In short, don’t go running out the door to purchase a Linksys router thinking Tomato and/or DDWRT are needed or that any port mentioned in the article is the only port which will work. (A lot to iron out to make this a viable tutorial, Jason.)
  5. Johann
    Good article – though why didn’t you show where to save the logon username in the putty session so you don’t have to type ‘root’ each time that you connect? Or show that if you’ve done a ‘normal’ putty install you can double-click your .ppk file to have it launched with pageant and prompting for password once but caching it for subsequent use?
    Also seeing as you’re effectively creating a SOCKS proxy it’d be good form to get people used to using the ‘correct’ default SOCKS port of 1080, not 80 which is obviously the HTTP default port and so could become confusing if users later want to expand their knowledge. You can obviously use anything but if you’re educating people, why not give them information worth learning and remembering?
    @jasray: Firstly this is ‘howtogeek’ where people enjoy learning how to do stuff themselves rather than just using an off the shelf product. Secondly setting up your own ssh server means you aren’t trusting your data to a third-party. Do you REALLY know Hotspot shield or other firms aren’t logging your activity, let alone monitoring it thoroughly? I read an article the other month where one of the free online PGP email services (where they kindly offer to ‘house’ your private key) was actually an NSA shill so worse than just using unencrypted mail!! Also, using this technique allows you to access services and data you have on your home network (I frequently access my home iTunes, wake-on-lan my PC and remote desktop to it etc.) which isn’t possible with Hotspot shield.
  6. Kevin
    Thanks Jason. I leave my router on 24/7, so I appreciate that with that “machine on at home” and these instructions I can make a viable SSH tunnel.
  7. Rod
    I wonder if I can access my NAS on my home network remotely.
  8. Jason Fitzpatrick
    @jasray: Complicated? It takes longer to read the article and download PuTTY than it does to actually configure everything. I spent more time taking the screenshots for the article than I did setting everything up. Furthermore, this tutorial has nothing to do with leaving a computer running at home as it runs off the router (you turn your router off when you leave the house?). I’ve been writing for a long time and fully expect criticism regarding anything I write but come on… this is a perfectly viable tutorial, it’s easy to do, and a significant portion of the readers won’t need to buy anything.
    @Rod: Can you run an SFTP or SCP server on your NAS? If not, here’s a guide to setting up Samba sharing through an SSH tunnel. It’s a bit of a hassle but doable: http://www.bitvise.com/file-sharing
  9. mark
    This is a good tutorial for setting up an SSH tunnel. Some people will complain it’s too complicated or it’s easier to do X, Y, and Z. If it’s too difficult to understand, this isn’t for you. If it’s so much easier to do it another way, then establish your own website and tell us about it.
    Anyone can criticize. It’s far more difficult to create or write something. Howtogeek is now what Lifehacker used to be and I thoroughly enjoy it.
  10. Jason Fitzpatrick
    @Mark: Thanks for the kind word! =)
    You don’t even have to establish your own website… if a How-To Geek reader feels like they have a superior way of doing something and is willing to take the time to write up a guide with screen shots and/or video there’s a very high probability of that write up ending up as a featured tip post here. We love reader submitted tips and tutorials!
  11. wt73
    Thanks, Jason. Great work. I love how – to’s like this. Regardless of whether it’s the “best” or not it always leads me down a learning path to what will work best for me. I have DD-WRT and other than boost the tw a little, I have been eager to utilize it’s potential.
  12. Maksym Kozlenko
    Another option is to use some Internet connected server to use as a proxy via SSH tunnel.
    With Amazon EC2 you can get a free tier server which comes with 10Gb traffic, install Linux on it and use just the same way as you would use your home router. Connection speed will be faster, since it’s not hampered by your home ADSL connection uplink speed.
    People from outside US, using US based EC2 instances, can also use it to watch online videos from Hulu and other websites, which are blocked from use by foreign IP addresses.
  13. Hmm
    Im still a bit confused. Does this mean after setting up a secure tunnel, the encrypted data is transfered to my home router and then the internet? And can be used on any wifi spot? And the Wifi spot act as extender so that i can connect to my router to connect to the internet.
  14. Rod
    Thanks for the tip towards bitvise Jason, I really appreciate it.
  15. Murphy
    Instead of PuTTY you could use the “Bitvise Tunneliner”, where it is quite easy to set up all this tunnel settings. In past I was using Putty, but I moved to tunneliner since I found it.
    Also if somebody does not have such Tomato router but has a Windows machine which is running at home, then Bitvise WinSSHD server might be a good companion to the tunneliner. :)
  16. Jason
    @Jason , Good article Do you have any links or plan on an article for setting up a ssh server on whs?
  17. Tim
    Are DNS requests through SOCKS automatically done w/ Chrome? Anyone know?
    I’ve always known you had to change it on FF, but I’m not sure how it works with Chrome
  18. Abhishek
    Would it not be a better option to use a online proxy server instead? Please correct me if am wrong..
  19. Greg
    Hi Jason,
    You talked about mobile devices, any advice about Ipod3 touch/Iphones, is it possible? For a laptop, it seems pretty easy though. I’ll try it, many thanks to you!
  20. riverfest
    any quick tips on how to use this in combination with a dynamic DNS service? in other words if I hard code (in PuTTY) the dynamic IP my ISP hands out and it changes and I’m away from home, how can this work? thanks in advance
  21. rodmunch
    That is great, but what about for Mac users. I know part of what Putty does, you can do in terminal but what about key generation????
  22. Jason Fitzpatrick
    @Hmm: That’s correct; once you set things up as laid out in this guide… all your browser traffic (or traffic from any other SOCKS-enabled app you’re using) will travel inside an encrypted tunnel from your laptop or mobile device all the way to your router and then will enter the “open” internet just like it would if you were browsing from your house. Nobody between your laptop at the coffee shop and your router at home can touch the traffic.
    @Jason: I hadn’t… although I have a WHS and I leave it on nearly 24/7 (I use the Lights Out extension to shut it down in the middle of the night for a few hours to save power when I’m not awake) I liked the router solution better… less power, always on, quick to reboot and become active again if there is a power outage or such.
    @Tim: Chrome doesn’t have a separate SOCKS config like Firefox does; it uses the system wide proxy configuration by default. This means, unfortunately, that Chrome’s DNS resolution is as leaky as the entire system (which is quite leaky). If you’re interested in using Chrome and securing the DNS requests you might want to check out this thread at the Perfect Privacy forums: https://forum.perfect-privacy.com/showthread.php?t=702 regarding forcing Windows to route DNS requests through the tunnel.
    @Greg: Unfortunately it’s not easy with iOS but it *is* possible. Here’s a guide to setting things up for iOS: http://blog.c22.cc/2009/06/21/iphone-ssh-tunnel/ –you’ll need a jailbroken iOS device. Alternatively, Here’s an SSH tunnel tool for Android: https://market.android.com/details?id=org.sshtunnel&feature=search_result
    @Riverfest: You’ll need to set up your router to communicate with a Dynamic DNS service and then use the hostname of your DDNS service (PuTTY will accept both IP addresses and hostnames). So for example, after signing up for a DDNS service you might have a hostname like riverfest.someDDNSservice.com that always points to your home internet connection regardless of how many times your ISP changes your IP–you would put that hostname in the IP slot instead of your current IP address.
    You can read how to setup a DDNS service with DD-WRT here: http://www.dd-wrt.com/wiki/ind.....yn_-_HOWTO and for Tomato here: http://blog.dreamdevil.com/ind.....th-dyndns/
    from http://www.howtogeek.com/68061/setup-ssh-on-your-router-for-secure-web-access-from-anywhere
    -----------------------------------------------------------------------------------------
    related post: http://www.howtogeek.com/60774/connect-to-your-home-network-from-anywhere-with-openvpn-and-tomato/

    Connect to Your Home Network From Anywhere with OpenVPN and Tomato

    A few weeks ago we covered installing Tomato, an open-source router firmware, on your Linksys WRT54GL. Today we’ll be going over how to install OpenVPN alongside Tomato, and setting it up to access your home network from anywhere in the world!

    What is OpenVPN?


    A virtual private network (VPN) is a trusted, secure connection between one local area network (LAN) and another. Think of your router as the middle man between the networks that you’re connecting to. Both your computer and the OpenVPN server (your router in this case) “shake hands” using certificates that validate each other. Upon validation, both the client and server agree to trust each other and the client is then allowed access on the server’s network.
    Typically, VPN software and hardware cost a lot of money to implement. If you haven’t guessed it already, OpenVPN is an open-source VPN solution that is (drum roll) free. Tomato, alongside OpenVPN, is a perfect solution for those who want a secured connection between two networks without having to open their wallet. Of course, OpenVPN won’t work right out of the box. It takes a little bit of tweaking and configuring to get it just right. Not to worry though; we’re here to make that process easier for you, so grab yourself a warm cup of coffee and let’s get started.
    For more information about OpenVPN, visit the official What Is OpenVPN? page.

    Prerequisites

    This guide assumes that you are currently running Windows 7 on your PC and that you’re using an administrative account. If you’re a Mac or Linux user, this guide will give you an idea of how things work, however, you may have to do a little more research on your own to get things perfect. Also, we will be installing a special version of Tomato called TomatoUSB VPN on a Linksys WRT54GL version 1.1 router. To find out if your router is compatible with TomatoUSB check out their Build Types page.
    The beginning of this guide assumes you have either:
    1. the original Linksys firmware installed on your router or
    2. the Tomato firmware we described in our last article
    Take note of the text above certain steps indicating whether it’s for Linksys firmware or Tomato firmware.

    Installing TomatoUSB

    In a previous article we discussed how to install the original Tomato v1.28 firmware from PolarCloud’s website. Unfortunately, that version of Tomato didn’t come with OpenVPN support, so we’ll be installing a newer version called TomatoUSB VPN.
    The first thing you’ll want to do is head over to the TomatoUSB homepage and click the Download Tomato USB link.

    Download VPN under the Kernel 2.4 (stable) section. Save the .rar file to your computer.

    You’ll need a program to extract the .rar file. We suggest using WinRAR since it’s free to try and easy to use. You can download yourself a copy of the free version on their website. After installing WinRAR, right click on the file you downloaded and click Extract Here. You should then see two files called CHANGELOG and tomato-NDUSB-1.28.8754-vpn3.6.trx.

    If you’re running Linksys firmware…

    Open up your browser and enter in your router’s IP address (default is 192.168.1.1). You’ll be prompted for a username and password. The defaults for a Linksys WRT54GL are “admin” and “admin”.

    Click the Administration tab at the top. Next, click Firmware Upgrade as seen below.
    tomato2
    Click the Browse button and navigate to the extracted TomatoUSB VPN files. Select the tomato-NDUSB-1.28.8754-vpn3.6.trx file, and click the Upgrade button in the web interface. Your router will start installing TomatoUSB VPN, and should take less than a minute to complete. After about a minute, open up a command prompt and type ipconfig –release to determine your router’s new IP address. Then type ipconfig –renew. The IP address to the right of Default Gateway… is your router’s IP address.
    tomatoovpn11
    Note: After installing Tomato go to Administration > Configuration and select “Erase all NVRAM…”.

    If you’re running Tomato firmware…

    Open up your browser and enter in your router’s IP address. We assume that if you installed Tomato, you know the IP address of your router. If you’re not sure, then it’s probably set to the default of 192.168.1.1. After, type in your username and password.

    Although it’s not required, you may want to backup your current Tomato configuration before upgrading to TomatoUSB VPN, just in case. To save your configuration, navigate to Administration > Configuration and click the Backup button. This will prompt you to save the .cfg file to your computer.

    Now it’s time to upgrade Tomato to TomatoUSB VPN. Click Upgrade in the left column and click the Choose File button. Navigate to the files we extracted earlier and choose the tomato-NDUSB-1.28.8754-vpn3.6.trx file. Then click the upgrade button.

    You’ll be asked to confirm the upgrade; just click OK.

    Your router will begin uploading the new firmware and will restart within a minute.

    It may have the same or a different IP address after it restarts. In our case, the router configuration was still the same therefore our IP address was still the same. To determine your router’s new IP address, open up a command prompt and type ipconfig –release. Then type ipconfig –renew. The IP address to the right of Default Gateway… is your router’s address. If your configuration is set back to the defaults, go back to the Configuration page (Administration > Configuration) and click the Choose File button under Restore Configuration. Browse for the .cfg file you saved to your computer earlier and click the Restore button.

    Configuring OpenVPN

    Whether you had Linksys firmware or Tomato firmware installed, you should now have the new TomatoUSB VPN installed on your router. You’ll notice a few new menus in the left column including Web Usage, USB and NAS, and VPN Tunneling. For this guide, we’re only concerned with the VPN Tunneling menu so go ahead and click VPN Tunneling. Keep this browser window open; We’ll be coming back to it shortly.

    Now let’s head over to OpenVPN’s Downloads page and download the OpenVPN Windows Installer. In this guide, we’ll be using the second latest version of OpenVPN called 2.1.4. The latest version (2.2.0) has a bug in it that would make this process even more complicated. The file we’re downloading will install the OpenVPN program that allows you to connect to your VPN network, so be sure to install this program on any other computers that you want to act as clients (as we’ll be seeing how to do that later). Save the openvpn-2.1.4-install .exe file to your computer.
    tomatoovpn17
    Navigate to the OpenVPN file we just downloaded and double click it. This will begin the installation of OpenVPN on your computer. Run through the installer with all the defaults checked. During the installation, a dialog box will pop up asking to install a new virtual network adapter called TAP-Win32. Click the Install button.
    tomatoovpn18
    Now that you have OpenVPN installed on your computer, we have to start creating the certificates and keys to authenticate devices.

    Creating the Certificates and Keys

    Click the Windows Start button and navigate under Accessories. You’ll see the Command Prompt program. Right click on it and click Run as administrator.
    tomatoovpn12
    In the command prompt, type cd c:\Program Files (x86)\OpenVPN\easy-rsa if you’re running 64-bit Windows 7 as seen below. Type cd c:\Program Files\OpenVPN\easy-rsa if you’re running 32-bit Windows 7. Then hit Enter.tomatoovpn13
    Now type init-config and hit Enter to copy two files called vars.bat and openssl.cnf into the easy-rsa folder. Keep your command prompt up as we’ll be coming back to it shortly.
    tomatoovpn14
    Navigate to C:\Program Files (x86)\OpenVPN\easy-rsa (or C:\Program Files\OpenVPN\easy-rsa on 32-bit Windows 7) and right click on the file called vars.bat. Click Edit to open it up in Notepad. Alternatively, we recommend opening this file with Notepad++ as it formats the text in the file much better. You can download Notepad++ from their homepage.
    tomatoovpn15
    The bottom portion of the file is what we are concerned with. Starting at line 31, change the KEY_COUNTRY value, KEY_PROVINCE value, etc. to your country, province, etc. For example, we changed our province to “IL”, city to “Chicago”, org to “HowToGeek”, and email to our own email address. Also, if you’re running Windows 7 64-bit, change the HOME value in line 6 to %ProgramFiles (x86)%\OpenVPN\easy-rsa. Do not change this value if you’re running 32-bit Windows 7. Your file should look similar to ours below (with your respective values, of course). Save the file by overwriting it once you’re done editing.
    tomatoovpn16
    Go back to your command prompt and type vars and hit Enter. Then type clean-all and hit Enter. Finally, type build-ca and hit Enter.
    tomatoovpn19
    After executing the build-ca command, you will be prompted to enter in your Country Name, State, Locality, etc. Since we already set up these parameters in our vars.bat file, we can skip past these options by hitting Enter, but! Before you start slamming away at the Enter key, watch out for the Common Name parameter. You can enter anything in this parameter (i.e. your name). Just make sure you enter something. This command will output two files (a Root CA certificate and a Root CA key) in the easy-rsa/keys folder.
    tomatoovpn20
    Now we’re going to build a key for a client. In the same command prompt type build-key client1. You can change “client1” to anything you’d like (i.e. Acer-Laptop). Just be sure to enter the same name as the Common Name when prompted. For example, when you run the command build-key Acer-Laptop, your Common Name should be “Acer-Laptop”. Run through all the defaults like the last step we did (except for Common Name, of course). However, at the end you will be asked to sign the certificate and to commit. Type “y” for both and click Enter.
    Also, don’t worry if you received the “unable to write ‘random state’” error. I’ve noticed that your certificates still get made without a problem. This command will output two files (a Client1 Key and a Client1 Certificate) in the easy-rsa/keys folder. If you want to create another key for another client, repeat the previous step, but be sure to change the Common Name.
    tomatoovpn21
    The last certificate we’ll be generating is the server key. In the same command prompt, type build-key-server server. You can replace “server” at the end of the command with anything you’d like (i.e. HowToGeek-Server). As always, be sure to enter the same name as the Common Name when prompted. For example, when you run the command build-key-server HowToGeek-Server, your Common Name should be “HowToGeek-Server”. Hit Enter and run through all the defaults except Common Name. At the end, type “y” to sign the certificate and commit. This command will output two files (a Server Key and a Server Certificate) in the easy-rsa/keys folder.
    tomatoovpn22
    Now we have to generate the Diffie Hellman parameters. The Diffie Hellman protocol “allows two users to exchange a secret key over an insecure medium without any prior secrets”. You can read more about Diffie Hellman on RSA’s website.
    In the same command prompt type build-dh. This command will output one file (dh1024.pem) in the easy-rsa/keys folder.
    tomatoovpn23

    Creating the Configuration Files for the Client

    Before we edit any configuration files, we should set up a dynamic DNS service. Use this service if your ISP issues you a dynamic external IP address every so often. If you have a static external IP address, skip down to the next step.
    We suggest using DynDNS.com, a service that allows you to point a hostname (i.e. howtogeek.dyndns.org) to a dynamic IP address. It’s important for OpenVPN to always know your network’s public IP address, and by using DynDNS, OpenVPN will always know how to locate your network no matter what your public IP address is. Sign up for a free hostname and point it to your public IP address. Once you’ve signed up for the service, don’t forget to set up the auto-update service in Tomato under Basic > DDNS.
    Now back to configuring OpenVPN. In Windows Explorer, navigate to C:\Program Files (x86)\OpenVPN\sample-config if you’re running 64-bit Windows 7 or C:\Program Files\OpenVPN\sample-config if you’re running 32-bit Windows 7. In this folder you will find three sample configuration files; we’re only concerned with the client.ovpn file.
    tomatoovpn24
    Right click on client.ovpn and open it with Notepad or Notepad++. You’ll notice your file will look like the picture below:
    tomatoovpn26
    However, we want our client.ovpn file to look similar to this picture below. Be sure to change the DynDNS hostname to your hostname in line 4 (or change it to your public IP address if you have a static one). Leave the port number to 1194 as it is the standard OpenVPN port. Also, be sure to change lines 11 and 12 to reflect the name of your client’s certificate file and key file. Save this as new file .ovpn file in the OpenVPN/config folder.
    tomatoovpn25

    Configuring Tomato’s VPN Tunneling

    The basic idea now is to copy the server certificates and keys we made earlier and paste them into the Tomato VPN server menus. Then we will check a few settings in Tomato, test the VPN connection, and then we’ll be able to wash our hands and call it a day!
    Open up a browser and navigate to your router. Click the VPN Tunneling menu in the left sidebar. Make sure Server1 and Basic are selected, too. Set up your settings exactly as they appear below. Click Save.
    tomatoovpn27
    Next, click the Advanced tab next to Basic. Just like before, make sure your settings are exactly as they appear below. Click Save.
    tomatoovpn28
    Our last step is pasting the keys and certificates we originally created. Open up the Keys tab next to Advanced. In Windows Explorer, navigate to C:\Program Files (x86)\OpenVPN\easy-rsa\keys on 64-bit Windows 7 (or C:\Program Files\OpenVPN\easy-rsa\keys on 32-bit Windows 7). Open each corresponding file below (ca.crt, server.crt, server.key, and dh1024.pem) with Notepad or Notepad++ and copy the contents. Paste the contents in the corresponding boxes as seen below. Click Save and then click Start Now.
    tomatoovpn29
    Before we test our VPN connection, there’s one more thing we have to check inside of Tomato. Click Basic in the left hand column and then Time. Be sure that the Router Time is correct and Time Zone displays your current time zone. Set the NTP Time Server to your country.
    tomatoovpn30

    Setting Up an OpenVPN Client

    In this example we will be using a Windows 7 laptop as our client. The first thing you’ll want to do is install OpenVPN on your client like we did above in the first steps under Configuring OpenVPN. Then navigate to C:\Program Files\OpenVPN\config which is where we’ll be pasting our files.
    Now we have to go back on our original computer and collect a total of four files to copy over to our client laptop. Navigate to C:\Program Files (x86)\OpenVPN\easy-rsa\keys again and copy ca.crt, client1.crt, and client1.key. Paste these files in the client’s config folder.
    tomatoovpn31
    Finally, we need to copy one more file over. Navigate to C:\Program Files (x86)\OpenVPN\config and copy over the new client.ovpn file we created earlier. Paste this file in the client’s config folder also.

    Testing the OpenVPN Client

    On the client laptop, click the Windows Start button and navigate to All Programs > OpenVPN. Right click on the OpenVPN GUI file and click Run as administrator. Note that you must always run OpenVPN as an administrator in order for it to work properly. To permanently set the file to always run as administrator, right click the file and click Properties. Under the Compatibility tab check Run this program as an administrator.
    tomatoovpn32
    The OpenVPN GUI icon will appear next to the clock in the taskbar. Right click the icon and click Connect. Since we only have one .ovpn file in our config folder, OpenVPN will connect to that network by default.
    tomatoovpn33
    A dialog box will pop up displaying a connection log.
    tomatoovpn34
    Once you’re connected to the VPN, the OpenVPN icon in the taskbar will turn green and will display your virtual IP address.
    tomatoovpn35
    And that’s it! You now have a secured connection between your server and client’s network using OpenVPN and TomatoUSB. To further test the connection, try opening a browser on the client laptop and navigating to your Tomato router on the server’s network.
    ------------------------------------------------------------------------------------------------------------------

    Hack Attack: Turn your $60 router into a $600 router

    Hack Attack: Turn your router into a 0 router
    Of all the great DIY projects at this year's Maker Faire, the one project that really caught my eye involved converting a regular old $60 router into a powerful, highly configurable $600 router. The router has an interesting history, but all you really need to know is that the special sauce lies in embedding Linux in your router. I found this project especially attractive because: 1) It's easy, and 2) it's totally free.
    So when I got the chance, I dove into converting my own router. After a relatively simple firmware upgrade, you can boost your wireless signal, prioritize what programs get your precious bandwidth, and do lots of other simple or potentially much more complicated things to improve your computing experience. Today I'm going to walk you through upgrading your router's firmware to the powerful open source DD-WRT firmware.
    Update: For an alternative to DD-WRT with a simplified interface and fancy charts and graphs, check out our other guide to turning your $60 router into a user-friendly super router with Tomato.
    Update two: This is a rather old post at this point, and much has changed in the world of DD-WRT. For one, DD-WRT now supports considerably more devices, and since the installation procedure varies by device, I'd recommend the following: 1) Visit the DD-WRT wiki's list of supported devices, 2) searching for your device, and 3) if it's supported, following the DD-WRT installation notes for your device. I realize we're sending you off into the wild to fend for yourself, but we can't practically maintain instructions for all the different possibilities in this post. Good luck!

    What you'll need:

    1. One of the supported routers. I used a Linksys WRT54GL Wireless router that I picked up from Newegg, and the instructions that follow detail the upgrade process specifically for that router and its close siblings. If you're upgrading one of the other supported routers, you might want to look into instructions specific to your router. These instructions may generally work for other supported routers, but I'm not making any promises.
    2. The generic DD-WRT v23 SP1 mini firmware version located here.*
    3. The generic DD-WRT v23 SP1 standard firmware version located here.*
    *You'll be upgrading the firmware twice, first using the mini firmware, then using the standard.

    Upgrading your router to the DD-WRT firmware

    Check out this gallery for the detailed step-by-step upgrade with screenshots. When you're finished, come back here for some of my favorite tweaks.
    Hack Attack: Turn your router into a 0 router Update, October '07: Reader Josh Harris writes in:
    All the new WRT54G routers being sold now are v8, and the previous DD-WRT software didn't work on them. However, recent versions added support for the new v8 router— but it's a little more in depth.
    Got this to work on the WRT54G v8 (should work on 7 as well, just replace the files with the corresponding 7 version):
    First of all, use IE explorer. Firefox didn't work at all on this for me, even after install. Second, go to this page. Read the textfile carefully and follow its instructions. Two edits to the textfile:
    1. Make sure you go to command prompt and type ipconfig /all. Record the default gateway, the subnet mask, and the two DNS addresses. When you set the IP address manually on your desktop/laptop to 192.168.1.100 as per the instructions, you will need to set these 4 numbers as well.
    2. Don't forget when you do the tftp that you need to be in the folder that contains the downloaded dd-wrt.v24_micro_wrt54gv8.bin file (for example, if it is in C:/Downloads, type /cd C:/Downloads).
    Lastly don't forget you need to be on a wire to the router, and download both vxworkskillerGv8.bin and dd-wrt.v24_micro_wrt54gv8.bin before you start. Following this procedure will install the micro version on your router.
    After this, switch your laptop/desktop back to receiving your IP address via DHCP rather than the manual configuration you set as per the instructions. You will be able to access the DD-WRt micro install via 192.168.1.1 with the login username root and the password admin. From here, you still need to install the DD-WRT standard.
    Unfortunately, you cannot go any farther than this with WRT54G v7 and v8 because Linksys downgraded the physical memory in these recent models. However, micro is still an improvement over the original Linksys firmware.

    Boost your wireless signal

    The first thing I did after I finished the firmware upgrade was give my wireless signal a much needed boost ("needed" in the sense any signal boosting that can be done needs to be done, right?). Doing so is trivial.
    Go to the Wireless tab, then to Advanced Settings. Find the entry labeled Xmit Power, which is set by default at a paltry 28mW, and can be set up to 251mW. To be honest, I don't know much about the science of the whole process, but I do know that 251 is WAY bigger than 28. However, you probably don't want to pump it up to 251mW right away.
    The DD-WRT manual suggests that a "safe increase of up to 70 would be suitable for most users." Anything too much above that and you'd be flirting with overheating your router and damaging the life of your router (though I've heard that many people have pushed it up to 100 or above). So go ahead and change your Xmit Power to 70 and click the Save Settings button at the bottom of the page.
    I can't measure for sure how the signal boost has improved things for me since I've just moved into this apartment, but I can say that the signal is full bars pretty much anywhere I go. How's that for scientific?

    Throttling your bandwidth by program

    While most routers treat one request for bandwidth the same as any other, your new $600 router is a step above. By setting up QoS (Quality of Service) rules, you can give priority to your interactive traffic (like VoIP, web browsing, or gaming) while throttling traffic that doesn't require a steady rate of bandwidth to function (like P2P programs).
    Doing so will ensure that even if your network gets clogged with lots of file sharing, you'll still have enough bandwidth left over to make all of your free SkypeOut phone calls. If you've got roommates who tend to sponge up a lot of bandwidth, you can even prioritize by IP address.

    What to do if you brick your router

    Hack Attack: Turn your router into a 0 router
    If, god forbid, while flashing your firmware you end up "bricking" your router, don't worry - all is not lost. The DD-WRT wiki (a great resource of all things DD-WRT) can help you recover from a bad flash.
    Of course, your router will handle securing your network, port forwarding, and all the other things your regular old router does.
    Obviously I've just scratched the surface here, so if you decide to try this out, there's a lot of potential for other things you can do. Any readers tricked out a router with DD-WRT or one of the other open source distros? Tell us what tweaks have worked for you in the comments or at tips at lifehacker.com.
    Adam Pash is an associate editor for Lifehacker who loves a good signal boost. His special feature Hack Attack appears every Tuesday on Lifehacker. Subscribe to the Hack Attack RSS feed to get new installments in your newsreader.
    Related Stories -------------------------------------------------------------------------------------------------------

    Turn Your $60 Router into a User-Friendly Super-Router with Tomato



    A year-and-a-half ago, we showed you how to turn your $60 router into a highly configurable $600 router with DD-WRT, a free, open source firmware. Since then there's been a lot of development of open source firmwares, and today we're taking a look at my new favorite, a firmware called Tomato. Tomato does almost everything DD-WRT does—from Wi-Fi signal boosting to Quality of Service bandwidth allocation—in addition to offering a simplified interface chock-full of fancy charts and graphs. Sound good? Let's get started.

    Check If Your Router's Supported

    wrt54gl.pngBefore you go upgrading your firmware willy-nilly, be sure to check Tomato's list of supported devices. The router I'll be using is the very same router I used for the original DD-WRT guide, this Linksys WRT54GL router. Several of the Linksys WRT54G series routers are supported, but they aren't all, so make sure you check your model number. In addition to the pervasive Linksys router, Tomato will also install on some Buffalo, ASUS, and Microsoft routers.

    Upgrade Your Router to the Tomato Firmware

    So you've either ensured that you're current router is supported or you've ordered a new cheap one off the internet? Then it's time to upgrade that router to Tomato. First, go download the latest Tomato firmware (as of this writing, that's version 1.13). You'll download a 7zip archive, so use your favorite unarchiver (may I suggest 7-Zip), and extract the contents to an easy-to-find folder on your desktop.
    Now you'll need to log into your current router to upgrade. This process may vary slightly depending on what router you're using and the firmware it's running, but for the most part it's very simple. You can go through the old DD-WRT step-by-step here if you're using a Linksys router with the default firmware (just replace DD-WRT with Tomato and quit after step 2). Below I'll describe the simple update process from DD-WRT to Tomato (which is virtually the same as it would be for any other router with one small difference).
    First, point your browser to 192.168.1.1/, the default admin page for your router. If your router has a username/password set, you'll need to enter it to continue. Next you need to navigate to the firmware upgrade section of your router's admin panel. In both DD-WRT and the default Linksys firmware, you'll click the Administration tab followed by the Firmware Upgrade tab. Now just click the Browse button and direct your router to the appropriate firmware file for your router in the folder you unzipped earlier.
    See the README file included in the Tomato_1_13 folder to determine which version you'll need to choose at this point. If you're using the same WRT54GL router as I am, pick the file named WRT54G_WRT54GL.bin. Now just click the upgrade button and wait. Be sure not to turn off your router during this upgrade.
    reset-router-button.pngWhen it's finished, you're ready to start using Tomato. (Pretty simple, right?) Point your browser back to 192.168.1.1/ and log with "admin" (without quotes) as both your username and password. If you upgraded from DD-WRT, this may not be working for you. If the login isn't working off the bat, you've got one more thing to do: Perform a hard reset on your router. To do so, just find the little Reset button on the back of your router, then press and hold it for a few seconds. When your router comes back online, the "admin" username and password should work.

    Boost Your Wi-Fi Signal

    There's a lot you can do now that you're running Tomato on your router, but let's go straight to one of the sexiest tweaks supported by Tomato: Wi-Fi signal boosting. Just click on Advanced -> Wireless in the Tomato sidebar and find the entry labeled Transmit Power. The default transmit power is 42mW, but it's capable of transmitting at up to 251mW.
    Tomato is a little low on documentation on this subject (okay, so it's low on documentation all-around), but the DD-WRT documentation suggests that an increase of up to 70mW would be "suitable for most users." A boost much above that could cause heat issues and considerably decrease the life of your router.
    I can't attest to the certainty of damage beyond what the DD-WRT documentation says, but here is what I can tell you: I've been running my router with DD-WRT for over a year transmitting at 70mW, haven't seen any hiccups in performance and so far have seen no smoke. Even better, my Wi-Fi signal easily reaches to every corner of my apartment.

    Track Your Bandwidth Usage, Set Quality of Service Rules, and More

    From this point on, if there's something you want to do with your router, chances are Tomato can do it for you. In particular the bandwidth logging is both attractive and handy, allowing you to track bandwidth usage in real-time, over the last 24 hours, or with daily, weekly, or monthly reports. Real-Time Bandwidth Monitoring.png
    A few weeks back I showed you how to set up Quality of Service rules on your DD-WRT router to ensure you don't drop Skype calls, lag on Xbox Live, and generally get your bandwidth when and where you need it. Tomato does all the same while providing even more granular control over how much bandwidth goes where... and, like the bandwidth reports, it graphs it all.
    If you've assigned a domain name to your home server (like adam-lh.homeip.net), Tomato can send alerts to the service if you've got a dynamic IP address so that the domain will always point to your computer—even if your external IP address changes.
    For a few other worthwhile uses, check out these videos for setting up Tomato's Access Restriction rules (allows you to set up rules to block browsing of certain topics at certain times, for example), using the Bandwidth Monitor, and putting your router into Wireless Client mode.
    As I said above, documentation on Tomato is slim, but this Tomato wiki is a good place to start if you want to figure out a feature.

    So Which Is Better, Tomato or DD-WRT?

    After reading this, you may have noticed that Tomato shares a lot of features with DD-WRT; if you did, you're probably wondering which is better. Honestly, the two firmwares are both excellent—you won't go wrong running either. DD-WRT has a slightly more robust feature set and a bit more polish in the layout of the admin, but most features that you'll find in DD-WRT that are not in Tomato are features most home users will never use. Both do Quality of Service (in fact, we've already gone step-by-step through how to set up QoS in DD-WRT), though Tomato seems to do it a bit better; both can boost your Wi-Fi signal; and both will transform your router into something much better than it was before you started. At the moment I prefer Tomato for the simplicity of its layout, the excellent bandwidth monitoring tools, and of course, its attractive charts. If you're a DD-WRT or Tomato fan, let's hear which you prefer and why in the comments.
    from http://lifehacker.com/344765/turn-your-60-router-into-a-user+friendly-super+router-with-tomato
    ----------------------------------------------
    Update: See the discussion on Hacker News This is one of those posts that is meant to save time for myself in the future when I’ll have to figure all of this out from scratch.
    I spend a lot of time in coffee shops and public places with unsecure wifi. Unsecure wifi scares the bejeesus out of me so I wanted to figure out a way to secure any traffic going through. It would also be nice to access things on my home network. It turns out there are a million different ways to do this and I found one that worked for me. Here were the constraints that I imposed.
    • It should be secure (duh !) for coffee-shop, public wifi browsing. This is not designed to hold up to connecting to DefCon/blackhat conference wifi.
    • It should work from anywhere in the world.
    • It shouldn’t require me to have any computing devices booted up and running at home apart from my wifi router running a DD-WRT build.
    • It should work on all my computing devices, especially on iOS.
    • It shouldn’t use any external VPN/SSH services. No good reason apart from the fact that I’m just masochistic about these things.
    If you don’t have these constraints, there are many different ways to do this. Here are some alternate options

    Alternate paths

    • If you are only using laptops, you should just use SSH using the excellent instructions here. I still use this when I’m using my MBP
    • If you’re ok with using an external service, you should use something like LogMeIn Hamachi, which is an excellent product and more secure than the setup I lay out below.
    • If you don’t need to use iOS, you should use OpenVPN instead. OpenVPN is way more secure but not supported by iOS out of the box (but jailbroken iOS will get you support).
    • If you’re ok with having a machine apart from your DD-WRT router running, there are several options. For example, there are tons of VPN servers that will let you set up a OpenVPN or a L2TP/PPTP server (both protocols supported by iOS out of the box). See this comparison of the various protocols.
    But if you happen to have these specific set of constraints I do and like DIY-hacks, read on.

    DO NOT SKIP - IMPORTANT - Security risks of using PPTP

    VPNs can be created using a multitude of protocols and the one we are going to use, PPTP, is the most insecure of the lot. Wait, what? Why are we picking the most insecure one if the whole purpose of the exercise is to make internet usage more secure? Worse, by using something insecure, we could let somebody get into our home network and rampage around. If you’re not going to use a long passphrase/password, you shouldn’t be doing this.
    Here’s why I picked PPTP and I believe using it with very long passwords/passphrases is acceptable.
    1. OpenVPN is the most secure solution, arguably but iOS doesn’t support it out of the box. iOS does support L2TP but DD-WRT doesn’t support that. So we’re stuck with PPTP. If you’re willing to run a server at home, you should be using L2TP.
    2. PPTP’s security increases when using long passwords. The security attacks are typically dictionary based. So make sure you use a long password.
    3. And finally, chances are low that an attacker at a public wifi station is going to put in the effort to go after you. If that isn’t true, you’re in trouble.
    If you don’t understand what I’m talking about or if you don’t agree, you shouldn’t be doing this.

    END SECURITY SECTION

    Setting up your DD-WRT wifi router as a VPN server

    • If you don’t have DD-WRT installed on your wifi router, stop reading right now and go install it. It will not only give you all sorts of extra features you never knew wifi routers could do, it also boosts performance over most stock firmwares. In our case, we’ll use the VPN service.
    • Get the right version of DD-WRT installed. I have v24-sp2 installed but I believe anything over v24 should be fine.
    • Read the instructions on the DD-WRT wiki. This saved me a lot of headache and when I didn’t see bits (like the one on special characters in passwords, for example), I regretted it later.
    • Go to the Services -> VPN tab on your router’s administration page (which is typically at http://192.168.1.1 ). DD-WRT moves this UI around from version to version so you might need to hunt a little.
    • The wiki tells you what each of these settings mean but here’s what I used to get it working.
      PPTP Server -> Enable
      Broadcast support -> Enable
      Force MPPE Encryption -> Enable
      Server IP -> 192.168.1.1 (you can pick anything here, just remember to use this when you forward traffic a bit later)
      Client IP -> 192.168.1.110-120 ( you can use any valid range here)
      DNS1/DNS2 -> 8.8.8.8/8.8.4.4 (not using Google’s DNS also worked for me but others on the web have reported issues here)
      CHAP-Secrets -> __ * username * “password” *
      The format of the username/password line is critical. It is asterisk-space-username-space-asterisk-space-password enclosed by quotes-space-asterisk. If you don’t have special characters in your password, you can skip the quotes. If you have multiple usernames and passwords, just use the same format in a new line. REMEMBER - use a long password with special characters or you will be in trouble.
    Hit ‘Apply Settings’.
    • Now, you need to do a couple of things to work around some iOS and OSX quirks. The first is around DNS. Add the below as a startup command in the Administration->Commands tab.
      #!/bin/sh  echo "nopcomp" >> /tmp/pptpd/options.pptpd  echo "noaccomp" >> /tmp/pptpd/options.pptpd  kill `ps | grep pptp | cut -d ' ' -f 1`  pptpd -c /tmp/pptpd/pptpd.conf -o /tmp/pptpd/options.pptpd 
    
    • Run this command using Adminstration->Commands to force encryption (the DD-WRT wiki explains this in detail if you want to understand what this does)
      sed -i -e 's/mppe .*/mppe required,stateless/' /tmp/pptpd/options.pptpd 
    • Go to Security->VPN Passthrough and make sure PPTP passthrough is enabled.

    Setting up DynDNS

    The next step is to get this accessible from anywhere in the world. DD-WRT has built-in support for DynDNS which makes this easy.
    • Create an account on DynDNS. You’ll get a host-name, something of the form username.dyndyns-server.com.
    • In DD-WRT, go to Setup->DDNS. Select DDNS service as DynDNS.org, enter your DynDNS username, password and hostname and make sure the status textarea doesn’t have any errors when you hit ‘Apply Settings’. In you type in dig username.dyndns-server.com in a terminal (or use nslookup on Windows), you should now see your public IP.
    • Now comes the scary step - forwarding traffic from the outside world. We’re going to forward two ports only (one should be sufficient but some users report errors here). Go to the NAT/QoS->Port Forwarding tab and add the following entries. If you didn’t pick 192.168.1.1 before as the server IP address, you need to change that here.
      Application - vpn, Port from - 1723, Protocol - Both, IP Address - 192.168.1.1, Port To - 1723, Enabled - Check
      Application - vpn, Port from - 1792, Protocol - Both, IP Address - 192.168.1.1, Port To - 1792, Enabled - Check
    • Hit ‘Apply Settings’.
    • Reboot the router. I typically do this by pulling out the power cord and plugging it back in.

    Setting up OSX as a VPN Client

    At this point, you should have a functional VPN server. Let’s connect to it! I’m going to lay out the instructions for OSX and since Apple uses the same terminology, iOS setup is almost identical from inside the General Settings->Network UI. All other VPN clients should have a similar configuration experience as well.
    • Open up the ‘Network’ preferences pane in System Preferences.
    • Use the ’+’ button at the left bottom of the pane.
    • Pick VPN as the interface, PPTP as VPN Type and name it anything you want (I used ‘Home VPN’).
    • You should have a VPN interface created for you. Here, enter your DynDNS hostname in ‘Server Address’, your username that you entered in the CHAP Secrets section as ‘Account Name’. Press ‘Advanced…’ and check the option to send all traffic through this connection. Now, back in the main pane, press ‘Connect’. Enter the password you typed out back in the CHAP Secrets section and…
    • Voila! You are now connected to your own VPN server. If this actually worked on your first attempt, congratulations! You can now browse securely from anywhere in the world by channeling all traffic through your home network.

    If this didn’t work

    There are several things that could go wrong above. Here are some common debugging tasks
    • Check the username, password format. This was the cause of much pain, especially around special characters.
    • Check the output at every step. For example, try connecting using 192.168.1.1 instead of the public hostname if you think DynDNS is the problem.
    • The DD-WRT forums are excellent. Search there and try posting there if you have an unresolved issue.
    • Of course, there’s always your favorite search engine to fall back on :).
    Happy VPNing.
    FROM http://sriramk.com/blog/2011/08/ddwrt-pptp-vpn.html
    --------------------------------------------------------------------------

    OpenWRT设置Openvpn并自动智能翻墙

    Network

    网络拓朴
    1) 在NW300R上编辑openvpn client配置如下:
    cat /etc/config/openvpn
    config 'openvpn' 'client'
     option 'enable' '1'
     option 'client' '1'
     option 'dev' 'tun'
     option 'proto' 'udp'
     option 'keepalive' '10 120'
     option 'resolv_retry' 'infinite'
     option 'nobind' '1'
     option 'persist_key' '1'
     option 'persist_tun' '1'
     option 'comp_lzo' '1'
     option 'verb' '3'
     option 'tun_ipv6' '0'
     option 'remote' ' '
     option 'ca' '/etc/openvpn/client.ca'
     option 'cert' '/etc/openvpn/client.cert'
     option 'key' '/etc/openvpn/client.key'
     option 'max-routes' '3000'
    
    注意your_openvpn_port在服务器端最好设置成非缺省端口1194,因为这个端口在实际使用时由于GFW监控而不稳定。
    openvpn相关的CA证书/etc/openvpn/client.ca等需要通过scp传上去。
    2) /etc/init.d/openvpn start启动openvpn
    3)可以输入route命令来校验(注意如下的路由表显示所有外网流量都将经过vpn服务器,这是因为在服务器端有设置push “redirect-gateway def1″
    root@OpenWrt2:~# route
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
      192.168.1.1     255.255.255.255 UGH   0      0        0 br-lan
    10.8.0.5        *               255.255.255.255 UH    0      0        0 tun0
    10.8.0.0        10.8.0.5        255.255.255.0   UG    0      0        0 tun0
    192.168.1.0     *               255.255.255.0   U     0      0        0 br-lan
    default         10.8.0.5        128.0.0.0       UG    0      0        0 tun0
    128.0.0.0       10.8.0.5        128.0.0.0       UG    0      0        0 tun0
    default         192.168.1.1     0.0.0.0         UG    0      0        0 br-lan
    
    或者通过ifconfig命令可以看到多了一个tun0接口
    这时可以通过ping 10.8.0.1来确认openvpn已通
    4) 修改NW300R的DNS服务器设置,确保DNS解析不被污染;否则DNS解析会走192.168.1.1而未经VPN保护
    root@OpenWrt2:~# cat /etc/resolv.conf
    search lan
    nameserver 127.0.0.1
    
    root@OpenWrt2:~# cat /etc/config/dhcp
    config 'dnsmasq'
     option 'domainneeded' '1'
     option 'boguspriv' '1'
     option 'localise_queries' '1'
     option 'rebind_protection' '1'
     option 'rebind_localhost' '1'
     option 'local' '/lan/'
     option 'domain' 'lan'
     option 'expandhosts' '1'
     option 'readethers' '1'
     option 'leasefile' '/tmp/dhcp.leases'
     option 'resolvfile' '/etc/openvpn/resolv.conf'
    
    config 'dhcp' 'lan'
     option 'interface' 'lan'
     option 'ignore' '1'
    
    config 'dhcp' 'wan'
     option 'interface' 'wan'
     option 'ignore' '1'
    
    root@OpenWrt2:~# cat /etc/openvpn/resolv.conf
    nameserver 8.8.8.8
    nameserver 8.8.4.4
    
    5) 设置智能路由
    这里用到了chnroutes项目,点击下载openvpn版本,并找一台有python的机器执行生成最新的路由规则脚本然后上传到路由器。
    该脚本会生成两个命令:vpnup, vpndown分别是启动和关闭openvpn时需要修改的路由规则(原理是把所有中国IP路由到192.168.1.1)。
    执行vpnup命令后再用route命令列出路由表会发现多了2000多路由规则。。。
    这时分别找一个中国和一个外国的IP来traceroute
    root@OpenWrt2:~# traceroute tao123.com
    traceroute to tao123.com (121.14.24.241), 30 hops max, 38 byte packets
     1  192.168.1.1 (192.168.1.1)  1.496 ms  1.322 ms  1.440 ms
     2  61.130.120.156 (61.130.120.156)  2.910 ms  2.218 ms  3.183 ms
     3  220.191.156.181 (220.191.156.181)  2.214 ms  2.136 ms  13.653 ms
     4  61.164.19.205 (61.164.19.205)  5.299 ms  2.298 ms  2.576 ms
     5  61.164.17.61 (61.164.17.61)  8.297 ms  7.966 ms  8.335 ms
     6  202.97.56.241 (202.97.56.241)  24.566 ms^C
    
    root@OpenWrt2:~# traceroute facebook.com
    traceroute to facebook.com (69.63.189.11), 30 hops max, 38 byte packets
     1  10.8.0.1 (10.8.0.1)  231.700 ms  210.645 ms  224.737 ms
     2  184.105.143.85 (184.105.143.85)  239.952 ms  259.713 ms  266.340 ms
     3  10gigabitethernet2-3.core1.fmt1.he.net (64.62.250.5)  273.158 ms  285.133 ms  285.376 ms
     4  10gigabitethernet1-1.core1.pao1.he.net (66.160.158.242)  284.708 ms  277.205 ms  277.986 ms
     5  paix.pr02.pao1.tfbnw.net (198.32.176.108)  275.467 ms  321.888 ms^C
    
    可以注意到第一行走的路由正确了!
    6) 设置iptable
    iptables -I FORWARD -o br-lan -j ACCEPT #允许br-lan端口流量被转发
    iptables -I FORWARD -o tun0 -j ACCEPT #允许tun0端口流量被转发
    iptables -t nat -I POSTROUTING -o tun0 -j MASQUERADE #tun0出口的流量SNAT出去
    7) 设置客户端
    因为NW300R关掉了DHCP(如果开启NW300R就需要设一个不同的子网如:192.168.2.1,这样还需要特殊设置来使得两个子网的机器可以 互相访问),所以使用DHCP连上的客户端的gateway和dns都是192.168.1.1,这样是不能自动翻墙的,需要要手工配一下需要自动翻墙的 网络设备的gateway和dns都为192.168.1.2,当然如果你只有一个无线路由器,就没这个问题了。这个部分我还没找到有多个无线路由器时比 较好的解决办法,还请高手指教一下。
    from http://hugozhu.wordpress.com/2011/07/17/opwrt%E8%AE%BE%E7%BD%AEopenvpn%E5%B9%B6%E8%87%AA%E5%8A%A8%E7%BF%BB%E5%A2%99/
    --------------------------------------------------------------------------------------------------

    OpenWRT设置WDS

    如果你家里需要多个无线路由器,并需要组成一个局域网,使得所有连上的电脑(有线或无线)都能互相访问,WDS就是最简单的一种配置方 法,无线组网还有Client + AP(需要设置两个网络),或Bridaged Client(仅适用与Broadcom芯片)等方法,这里只讨论WDS。

    WDS原理图
    使用WDS组网最好采用相同无线芯片的路由器,原因是各个厂商对WDS的实现不完全相同。
    OpenWRT是一个强大的基于Linux的开源路由器操作系统。关于无线的配置文件在/etc/config/wireless。
    假设你有两个路由器分别为A和B,其中A通过ADSL拨号上网,B则通过无线连接A。
    假设A的mac地址是aa:aa:aa:aa:aa:aa,B的mac地址是:bb:bb:bb:bb:bb:bb
    首先配置A的LAN IP为192.168.1.1/24,并开启DHCP服务;B的LAN IP为192.168.1.2/24,Gateway,DNS都设成192.168.1.1,并一定关闭DHCP服务。

    A的/etc/config/wireless设置
    config 'wifi-device' 'radio0'
     option 'type' 'mac80211'
     option 'macaddr' 'aa:aa:aa:aa:aa:aa'
     option 'hwmode' '11ng'
     list 'ht_capab' 'SHORT-GI-20'
     list 'ht_capab' 'SHORT-GI-40'
     list 'ht_capab' 'TX-STBC'
     list 'ht_capab' 'RX-STBC1'
     list 'ht_capab' 'DSSS_CCK-40'
     option 'channel' '3'
     option 'txpower' '20'
     option 'country' 'US'
     option 'htmode' 'HT20'
     option 'disabled' '0'
     option 'noscan' '1'
    
    config 'wifi-iface'
     option 'device' 'radio0'
     option 'mode' 'ap'
     option 'ssid' 'hugo'
     option 'wds' '1'
     option 'network' 'lan'
     option 'encryption' 'psk2'
     option 'key' 'password'
    

    B的/etc/config/wireless设置
    config 'wifi-device' 'radio0'
     option 'type' 'mac80211'
     option 'macaddr' 'bb:bb:bb:bb:bb:bb'
     option 'hwmode' '11ng'
     list 'ht_capab' 'SHORT-GI-20'
     list 'ht_capab' 'SHORT-GI-40'
     list 'ht_capab' 'TX-STBC'
     list 'ht_capab' 'RX-STBC1'
     list 'ht_capab' 'DSSS_CCK-40'
     option 'channel' '3'
     option 'country' 'US'
     option 'txpower' '20'
     option 'htmode' 'HT20'
     option 'noscan' '1'
     option 'disabled' '0'
    
    config 'wifi-iface'
     option 'device' 'radio0'
     option 'ssid' 'hugo'
     option 'mode' 'sta'
     option 'wds' '1'
     option 'network' 'lan'
     option 'essid' 'aa:aa:aa:aa:aa:aa'
     option 'encryption' 'psk2'
     option 'key' 'password'
    
    config 'wifi-iface'
     option 'device' 'radio0'
     option 'mode' 'ap'
     option 'ssid' 'hugo2'
     option 'network' 'lan'
     option 'encryption' 'psk2'
     option 'key' 'password'
    
    修改配置文件后可以执行wifi命令使之生效,这样就基本可以了。
    配置好后可以通过A的openWRT的web界面登录进去看已经连上的无线终端中是否有B的mac地址,如果不成功,请注意无线的加密方式,我采用WPA2中继成功,但采用WEP就不行。
    from http://hugozhu.wordpress.com/2011/07/13/openwrt%E8%AE%BE%E7%BD%AEwds/
    --------------------------------------------------------------------------------------

    利用block-extroot,让你的openwrt运行在USB设备上


    一、我需要这个功能吗?
    如果你对跑openwrt的设备的要求仅仅是可以上上网,那下面的可以不用看了。
    openwrt运行在USB设备上的好处:
    可以安装openwrt官方的N多软件了(但官方暂时没有mysql,郁闷),象P2P类的transmision-daemon、amule、 web服务器类的lighttpd/apache、ftp服务器类的vsftpd等等,还可以再安装其他驱动程序包驱动摄像头、USB声卡、显卡等等。这 部分功能optware也可以实现,各论坛的教程多数是基于optware的。

    二、需要的设备及环境:
    1、可以运行openwrt的设备;
    2、带USB接口;
    3、openwrt要版本比较新,往前哪个版本可以,我不知道,新版本的trunk版(最新的开发版)、Backfire版(最新的稳定版)都可以。

    三、步骤:
    1、实现USB存储支持,已实现此功能的此步骤可略。需要用到的包:
    1. kmod-usb-ohci、kmod-usb2、kmod-usb-uhci、kmod-usb-storage
    复制代码
    说明:
    kmod-usb-ohci对应usb1.1
    kmod-usb2对应USB2.0
    kmod-usb-uhci对应部分intel和VIA的usb控制器
    (这3个可能不必全部都安装,像7231-4P等只支持USB1.1的设备应该只安装kmod-usb-ohci即可)
    kmod-usb-stroage对应USB硬盘设备,如U盘、USB移动硬盘。
    为了方便新手(其实我也是个新手,汗……),将详细命令也写一下:
    1. opkg update
    2. opkg install kmod-usb-storage kmod-usb-ohci kmod-usb2 kmod-usb-uhci
    复制代码
    2、实现USB存储设备自动挂载并从USB启动,需要用到的包:block-mount、block-hotplug(这两个是自动挂载用的)和block-extroot(这个是USB启动用的)
    1. opkg update
    2. opkg install block-mount block-hotplug block-extroot
    复制代码
    3、 安装linux文件系统支持,ext2、ext3、ext4以及其他文件系统众多,用哪个看个人爱好了,推荐经典传统的ext2/ext3。我用ext4 遇到过问题,后来上openwrt果然有人报到这个bug。另,在linux下,尽量少用或者放弃fat32/ntfs
    1. opkg install kmod-fs-ext3
    复制代码
    说明:不安装文件系统支持的话,分区不能mount。

    有人会问,你为何不一下子opkg install了,当然可以,我分开来是为了帮助新手了解一下linux下设备驱动、功能包、文件系统支持的一些简单概念。

    完成以上步骤后,openwrt默认设置下,U盘插上还不能识别,openwrt有默认设置模板,但此时还是关闭U盘自动挂载功能的。

    4、准备USB硬盘及拷贝根目录所有文件。以下均以插一个U盘的情况为例:
    4.1前3个步骤完成后,你最好重启一下设备,插上U盘(USB移动硬盘)。

    4.2 准备U盘为linux分区及linux文件系统,需要用到的包:e2fsprogs,如果你在其他系统里准备分区并格式化为ext2/ext3,应该也可以
    准备分区这个步骤略过不表了,默认一个分区也可以用,如果有人想多分几个区,请看其他教程。
    1. opkg update
    2. opkg install e2fsprogs
    复制代码
    ls /dev/sd*,应该有sda sda1 字样(这是只有一个U盘一个分区的情况,如果有多个U盘,会有sdb sdc……)

    4.3 格式化U盘为ext2或ext3……,以ext3为例,。
    在命令行下执行:
    1. mkfs.ext3 /dev/sda1
    复制代码
    3.4 拷贝root根目录下的所有文件到U盘,过程:mount设备,复制文件,以一个U盘的为例,在tmp目录下创建一个目录(本例是“root”)、mount U盘到这个目录、拷贝/tmp/root目录里的所有文件到U盘。
    “#”后面为注释,粘贴命令的话,不要复制粘贴。
    1. mount /dev/sda1 /mnt #挂载U盘第一个分区到/mnt
    2. mkdir /tmp/root   #在/tmp目录下创建名叫root的一个目录
    3. mount -o bind / /tmp/root    #挂载并同步系统根目录“/”到 /tmp/root
    4. cp /tmp/root/* /mnt -a  #拷贝/tmp/root下所有文件到 “/mnt”,这个其实就是你的U盘了
    5. umount /tmp/root    卸载 /tmp/root#
    复制代码
    修改/mnt/etc/config/banner,添加一点点标识,方便你以后知道是不是从U盘启动了。(此步非必须)
    vi /mnt/etc/config/banner
    我添加了一行: Boot from USB ROOT
    注意:还有一个是/etc/config/banner,这个是系统默认的,在flash闪存上的。

    4.3 修改/etc/config/fstab。以插了一个U盘的为例:
    修改前(openwrt默认设置):

    config mount
            option target        /home
            option device        /dev/sda1
            option fstype        ext3
            option options        rw,sync
            option enabled        0

    config swap
            option device        /dev/sda2
            option enabled        0

    修改后的(注意红色部分修改的和新增的一行):

    config mount
    #        option target        /home 这一行要不要无所谓了,我一般是去掉或者在前面加一个“#”
            option device        /dev/sda1
            option fstype        ext3
            option options        rw,sync
            option enabled        1
    option is_rootfs   1
    config swap
            option device        /dev/sda2
            option enabled        0

    5、我怎么知道我已经运行在USB下了呢?
    方法一:修改u盘上etc/config/banner文件,添加标识

    BusyBox v1.16.1 (2010-04-17 04:55:14 EDT) built-in shell (ash)
    Enter 'help' for a list of built-in commands.

      _______                     ________        __
    |       |.-----.-----.-----.|  |  |  |.----.|  |_
    |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
    |_______||   __|_____|__|__||________||__|  |____|
              |__| W I R E L E S S   F R E E D O M
    KAMIKAZE (bleeding edge, r20950) ------------------
      * 10 oz Vodka       Shake well with ice and strain
      * 10 oz Triple sec  mixture into 10 shot glasses.
      * 10 oz lime juice  Salute!

           Boot from USB root!

    方法二:用df -h命令查看挂载点,查看 mini_fo:/overlay是否为 '/" 根目录。

    Filesystem                Size      Used Available Use% Mounted on
    /dev/root                 6.8M      5.6M      1.2M  82% /rom
    tmpfs                    30.3M    216.0K     30.1M   1% /tmp
    tmpfs                   512.0K         0    512.0K   0% /dev
    /dev/sdb1               118.6M     32.3M     80.2M  29% /overlay
    mini_fo:/overlay          6.8M      5.6M      1.2M  82% /
    /dev/sda1                36.7G     29.9G      4.9G  86% /mnt

    (我这台设备上装了2个USB存储设备)

    2010年10月2日补充说明:
    如果按教程操作无效,建议直接编译一个自己的openwrt固件,编译时把上述的几个添加进去。



    补:openwrt的许多设置都在/etc/config/里,很多设置都是option enable 0/1,改一下0、1就打开关闭某项功能了
    ---------------------------------------------------------------------------------------------

    OpenWrt + OpenVPN


    前不久入手一个buffalo wzr-hp-g300nh,丢掉默认的系统,换成OpenWrt,配和yegle的VPN一起用,效果还不错。
    war-hp-g300nh hardware list(From OpenWrt):
    • Architecture: MIPS
    • Vendor: Atheros
    • CPU: Atheros AR9132
    • CPU Speed: 400 Mhz
    • Flash size: 32 MB
    • RAM: 64 MB
    • Network: 4×1
    • Wireless: Atheros AR9160 BB/MAC and AR9103 2.4 GHz 3×3 MIMO radio b/g/n
    • USB: Yes
    • Serial: Yes
    • JTAG: ?
    优点
    1. 可以多人共享VPN。
    2. 不需要每次开机后都打开OpenVPN,或者其他VPN软件。
    3. yegle的VPN不限制流量。
    我所在地方网络环境如下:
    一台Netgear路由器连接ADSL Modem,buffalo路由器连接Netgear路由器,其IP属于Netgear的子网。
    Netgear路由器IP: 192.168.1.1
    buffalo路由器DHCP获得IP: 192.168.1.3
    具体步骤如下
    1. 重新下载路由器的系统。
    参考: http://wiki.openwrt.org/toh/buffalo/wzr-hp-g300h?s[]=wzr&s[]=hp
    PS: 我就是按照这个文档的说明做的。
    2.安装好后需要进行系统设置。
    a. 设置root密码,设置密码后,就不允许telnet登录了。
    b. 设置WAN口连接方式,我选的是automatic(DHCP)。
    c. 连上网后就可以安装软件了,OpenVPNIptables是必须要安装的(可以参考下附录一:我安装的软件列表)。
    3. 设置OpenVPN
    a. 启用custom_config配置(/etc/config/openvpn):
    config 'openvpn' 'custom_config'
    option 'config' '/etc/openvpn/vpn.conf'
    option 'enable' '1'
    config 'openvpn' 'sample_server'
    option 'port' '1194'
    option 'proto' 'udp'
    option 'dev' 'tun'
    option 'ca' '/etc/openvpn/ca.crt'
    option 'cert' '/etc/openvpn/server.crt'
    option 'key' '/etc/openvpn/server.key'
    option 'dh' '/etc/openvpn/dh1024.pem'
    option 'server' '10.8.0.0 255.255.255.0'
    option 'ifconfig_pool_persist' '/tmp/ipp.txt'
    option 'keepalive' '10 120'
    option 'comp_lzo' '1'
    option 'persist_key' '1'
    option 'persist_tun' '1'
    option 'status' '/tmp/openvpn-status.log'
    option 'verb' '3'
    config 'openvpn' 'sample_client'
    option 'client' '1'
    option 'dev' 'tun'
    option 'proto' 'udp'
    option 'resolv_retry' 'infinite'
    option 'nobind' '1'
    option 'persist_key' '1'
    option 'persist_tun' '1'
    option 'comp_lzo' '1'
    option 'verb' '3'
    list 'remote' 'xx.xx.xx.xx xxxx'
    list 'remote' 'xx.xx.xx.xx xxxx'
    PS: sample_server和sample_client配置可以不管,因为没有用到。
    b. 设置OpenVPN连接配置文件(/etc/openvpn/vpn.conf):
    其实就是把VPN的配置文件复制到指定位置,注意添加下面的配置,否则在OpenVPN启动时时要求输入密码。
    auth-user-pass /root/vpnpass.txt
    c. 密码配置文件(/root/vpnpass.txt): (文件只有两行内容,注意是两行)
    用户名
    密码
    4. 设置路由表 因为全局如果都使用VPN,将导致访问国内速度下降,所以需要把国内的流量指向本地网关。
    国内IP段众多,实在是不好做,所以依靠chnroutes,我就不过多介绍,主要功能一个获取国内IP段,并且插入路由表中。OpenWrt中安装Python有点太奢侈了,所以就在PC端生成路由文件,用awk转了一下,生成一个bash脚本。
    设置前我的路由表:
    root@OpenWrt:~# route
    Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface
    192.168.1.0 * 255.255.255.0 U 0 0 0 eth1
    192.168.10.0 * 255.255.255.0 U 0 0 0 br-lan
    default 192.168.1.1 0.0.0.0 UG 0 0 0 eth1
    添加路由的命令例子:
    /sbin/route add -net 203.55.116.0 netmask 255.255.254.0 gw 192.168.1.1 metric 5
    我用先用chnroutes_ovpn_linux生成shroutes.txt文件。
    awk命令:
    cat shroutes.txt |awk '{print $1 "  add -net "$2" netmask "$3" gw 192.168.1.1 metric "$5"}' > sh.txt
    生成的sh.txt就是可执行的bash脚本文件。
    其实还有另外一项目autoddvpn可以参考,是针对dd-wrt的,我没深入研究。
    5. 设置Iptables
    在连接VPN成功后,执行下面两条命令,就一切OK了。
    iptables -I FORWARD -o tun1 -j ACCEPT
    iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -j MASQUERADE
    tun1 – 对应本地VPN虚拟网卡
    192.168.10.0/24 – 对应本地网络
    参考资料
    [1] OpenWrt, https://openwrt.org/
    [2] OpenWrt Buffalo WZR-HP-G300NH Document, http://wiki.openwrt.org/toh/buffalo/wzr-hp-g300h?s[]=wzr&s[]=hp
    [3] Buffalo WZR-HP-G300NH, http://www.buffalotech.com/products/wireless/wireless-n-routers-access-points/airstation-high-power-n300-gigabit-wireless-router-ap-wzr-hp-g300nh/
    [4] http://www.tolaris.com/2010/09/01/openwrt-10-03-on-buffalo-wzr-hp-g300nh/
    [5] autoddvpn, http://code.google.com/p/autoddvpn/
    [6] chnroutes, http://code.google.com/p/chnroutes/
    附录一
    root@OpenWrt:~# opkg list-installed
    base-files - 42-r20728
    busybox - 1.15.3-2
    crda - 1.1.0-2
    dnsmasq - 2.52-2
    dropbear - 0.52-4
    firewall - 1-10
    hotplug2 - 1.0-beta-1
    iptables - 1.4.6-2
    iptables-mod-conntrack - 1.4.6-2
    iptables-mod-nat - 1.4.6-2
    iw - 0.9.19-1
    kernel - 2.6.32.10-1
    kmod-ath - 2.6.32.10+2010-03-24-5
    kmod-ath9k - 2.6.32.10+2010-03-24-5
    kmod-button-hotplug - 2.6.32.10-1
    kmod-cfg80211 - 2.6.32.10+2010-03-24-5
    kmod-crc-ccitt - 2.6.32.10-1
    kmod-crypto-aes - 2.6.32.10-1
    kmod-crypto-arc4 - 2.6.32.10-1
    kmod-crypto-core - 2.6.32.10-1
    kmod-gre - 2.6.32.10-1
    kmod-input-core - 2.6.32.10-1
    kmod-input-gpio-buttons - 2.6.32.10-1
    kmod-input-polldev - 2.6.32.10-1
    kmod-ipt-conntrack - 2.6.32.10-1
    kmod-ipt-core - 2.6.32.10-1
    kmod-ipt-nat - 2.6.32.10-1
    kmod-ipt-nathelper - 2.6.32.10-1
    kmod-leds-gpio - 2.6.32.10-1
    kmod-mac80211 - 2.6.32.10+2010-03-24-5
    kmod-nls-base - 2.6.32.10-1
    kmod-ppp - 2.6.32.10-1
    kmod-pppoe - 2.6.32.10-1
    kmod-tun - 2.6.32.10-1
    kmod-usb-core - 2.6.32.10-1
    kmod-usb2 - 2.6.32.10-1
    libc - 0.9.30.1-42
    libgcc - 4.3.3+cs-42
    libiptc - 1.4.6-2
    liblua - 5.1.4-6
    liblzo - 2.03-3
    libnl-tiny - 0.1-1
    libopenssl - 0.9.8m-3
    libuci - 12012009.5-1
    libuci-lua - 12012009.5-1
    libxtables - 1.4.6-2
    lua - 5.1.4-6
    luci - 0.9.0-1
    luci-admin-core - 0.9.0-1
    luci-admin-full - 0.9.0-1
    luci-admin-mini - 0.9.0-1
    luci-app-firewall - 0.9.0-1
    luci-app-initmgr - 0.9.0-1
    luci-app-openvpn - 0.9.0-1
    luci-cbi - 0.9.0-1
    luci-core - 0.9.0-1
    luci-http - 0.9.0-1
    luci-i18n-english - 0.9.0-1
    luci-ipkg - 0.9.0-1
    luci-lmo - 0.9.0-1
    luci-nixio - 0.9.0-1
    luci-sgi-cgi - 0.9.0-1
    luci-sys - 0.9.0-1
    luci-theme-base - 0.9.0-1
    luci-theme-openwrt - 0.9.0-1 luci-uci - 0.9.0-1
    luci-uvl - 0.9.0-1
    luci-web - 0.9.0-1
    mtd - 12
    openvpn - 2.1.1-1
    opkg - 513-2
    ppp - 2.4.4-5
    ppp-mod-pppoe - 2.4.4-5
    pptp - 1.6.0-6
    swconfig - 5
    uci - 12012009.5-1
    udevtrigger - 106-1
    uhttpd - 7
    unzip - 5.52-1
    wireless-tools - 29-4
    wpad-mini - 20100309-1
    zlib - 1.2.3-5
    from http://xtaoyumo.wordpress.com/2011/05/20/openwrt-openvpn/
    ------------------------------------------------------------------------------
    通过路由器访问猫的方法

    通常猫下面接了个路由器之后,我们不能再通过网络浏览器访问猫的设置界面了。因为通常来说,路由器和猫不在同一个网段,而且路由器通常是设置为网关而不是路由模式。如果你的路由器可以刷 DD-WRT 或者 Tomato 固件,则使用以下方法可以“穿透”路由器访问猫。
    DD-WRT:
    1. 假设你的路由器 IP 地址为 192.168.1.1 ;
    2. 假设你的猫 IP 地址为 192.168.2.1
    3. 用浏览器打开 DD-WRT 设置界面, 转到管理员>命令;
    4. 键入:
    代码:ifconfig vlan1:0 192.168.2.2 netmask 255.255.255.0
    然后点击 <保存在启动项>
    5. 键入:
    代码:/usr/sbin/iptables -I POSTROUTING -t nat -o vlan1 -d 192.168.2.0/24 -j MASQUERADE
    然后点击 <保存在防火墙>
    注意:脚本中的 IP 子网范围其实只与猫的子网有关,如上例,猫的子网是 192.168.2.X,则脚本中两个涉及子网的参数都为 192.168.2.X;我们只需保证路由器和猫的子网不同即可,这是基本原则。这个规则同样适用于以下 Tomato 的方法;
    Tomato:
    1.现在我们假设猫的 IP 地址是: 192.168.0.1 ;根据上述规则,我们不必关心路由器的 IP 地址;
    2.在浏览器中访问 Tomato 设置界面,转到 管理/脚本 页面:
    初始化 或者 外网上线 中键入:
    代码:sleep 5
    ip addr add 192.168.0.13/24 dev $(nvram get wan_ifname) brd +
    防火墙 中键入:
    代码:iptables -I POSTROUTING -t nat -o $(nvram get wan_ifname) -d 192.168.0.0/24 -j MASQUERADE
    3.重启路由器即可。
    2011-06-05 补充一个硬件的方法,适合通用路由器(未测试):
    把猫和路由设置为同一网段但是不同的 IP,例如路由器是 192.168.1.1,猫是 192.168.1.2,注意路由器的 DHCP 不要和猫的 IP 冲突(只在猫或者路由器上启用 DHCP),电脑网卡也要分配同网段的 IP 才能访问。
    接线方法是:猫连接到路由器上的任意 LAN 口,路由器的 WAN 口连接到自身的任意 LAN 口,电脑连接到路由器的任意 LAN 口。
    电脑设置好 IP 后直接访问猫的 IP 即可,缺点就是你少了两个可用的 LAN 口,优点是可以直接访问猫,而且如果你的帐号如果支持多次拨号的话还可以用电脑直接拨号上网。
    from http://www.quakemachinex.com/blog/?p=181
    -----------------------------------------------------------------
    Linksys WRT54G2 在 Tomato 下 WPS 以及无线灯设置

    关于无线灯,也就是 WLED ,用 telnet 登录路由器,输入以下指令:
    代码:nvram set wl0gpio0=8
    nvram commit
    reboot
    (wl0gpio0=8 是指无线开启LED不亮,有流量闪动,无线关闭LED常亮,这好象是 Linksys 以及 DD-WRT 默认的设置;如果设为136,则无线开启 LED 就亮,有流量闪动,无线关闭 LED 就不亮,这是我目前的设置)
    关于那个 WPS 灯,也就是 SES LED(或者叫 WPS LED 什么的都行,反正就是 WPS 加密按钮上面那个灯),加入以下启动脚本:
    代码:while sleep 1; do if [ `nvram get security_mode` = "disabled" ]; then gpio disable 3; else gpio enable 3; fi; done &
    实现的效果是,如果打开无线加密,灯是绿色,如果关闭就是黄色。
    这玩意折磨我最久,关键是 security_mode 这个参数,网络上找到的基本都是 wl0_security_mode,而这个参数在我的 WRT54G2 上,无论设置无线加密与否它都是 psk2 不变!所以脚本根本不起作用。通过不停的开关无线加密,然后用 nvram show|grep 查看参数,最后找到了这个适用于表示 WRT54G2 的无线加密切换参数。
    参考资料:
    Security LED Script WRT300n v1.1
    WZR-G300N gpio
    Useful Scripts
    Linksys WRT54G2 V1 with DD-WRT (Fixing WPS lights)
    from http://www.quakemachinex.com/blog/?p=182
    --------------------------------------------------------------------------------------------
    Tomato DNSMASQ 的优化设置

    Tomato 内置的 DNS 服务器 DNSMASQ 默认缓存条目是 150 条,默认设置不能抵挡 127.0.0.1 段的 DNS-rebind attacks 。

    如上图设置 Tomato 的 DNS,并且添加如下自定义参数:
    代码:## Some Tweak
    cache-size=8192
    stop-dns-rebind
    log-async=5
    ## Additional DNS servers
    # Hong Kong BroadBand Network DNS servers
    server=203.80.96.10
    server=203.80.96.9
    # Huchison Whampoa DNS servers
    server=202.45.84.58
    server=202.45.84.59
    这样设置后用 DNS Benchmark 测试可以得到一个完全安全的本地 DNS 服务器,并且增加 DNS 缓存数量到 8192 条;添加的 DNS 服务器位于香港,适用于广州深圳用户,其他地方的用户可以修改这些服务器地址。

    在 Telnet 控制台输入 killall -USR1 dnsmasq ,然后去 Tomato 的日志目录可以查看全部 DNS 服务器查询命中情况。
    以上适用于 TomatoUSB 或者原版,如果要用在 Tomato Duelwan 上面,要去掉 cache-size=8192 这条,因为 TD 已经内置了 cache-size=512 ,另行设置会出错导致 DNSMASQ 不能启动。
    Tomato Duelwan 修改 cache-size 的方法,telnet 登录路由器:

    代码:nvram set dnsmasq_cachesize=1024
    nvram commit
    reboot

    from http://www.quakemachinex.com/blog/?p=173
    -----------------------------------------------------------------
    路由器刷DD-WRT或tomato第三方固件的方法

    Tomato固件因其稳定性而著称,当然,它优点绝不止这点,图形化显示流量,QOS功能效果显著(上网优先级设定功能,常用封BT,迅雷等,就算不封也能让它们尽量少对浏览网页或玩游戏造成影响),中文版作者达人还为我们提供了硬件信息查看功能(可以看到CPU主频, 内存容量,闪存容量,有线及无线网卡详细信息等),最新的1.11版还提供了定时重启系统的功能,越来越多的朋友都加入到Tomato阵营中来了!
    现在网上流传刷Tomato的方法,看起来很复杂,说要刷Tomato,必须先刷DD-WRT,再用进telnetnvram show | grep http_passwd取得密码,再刷Tomato等,这样搞得一些想用Tomato的朋友,因此望而却步了……
    其实,刷Tomato哪用这么复杂?现在,我就用大家用得最多的几种环境下分别介绍如何简装快速的刷TomatoAre you ready?Let’s go!
    首先,你得确定自己的机器支持Tomato固件,否则请不要尝试刷Tomato,关于哪些机器支持Tomato,请看上一篇文章,如果你的机器型号及硬件版本号出现在了列表中,那么,恭喜你,你可以使用Tomato
    下载最新的Tomato中文版,一般你会得到image.7z的文件(也可能会是image.rar,解压后仍会得到image.7z)。这个文件也是个压缩文件,需要用最新版的WinRar解压缩软件下解压,如果你的WinRar不能打开image.7z,请上网下载最新版的WinRar来解压。解压后,会得到WRTSL54GS.binWRT54GSv4.binWRT54GS.bin,WRT54G.binWR850G.bintomato.trxreadme.htm这些文件,其中tomato.trx是通用固件,在支持列表中的机器都可以用它,那我们就用它吧!
    因为一些固件只认bin文件,所以,请先把tomato.trx改名成tomato.bin
    然后,就下面的环境刷到tomato分别进行介绍

    切记:升级固件请用有线而不要用无线,并且在升级过程中千万不要断网断电
    一、下面先说说从原厂固件的开始刷番茄:
    先登录路由器,默认的IP地址是192.168.1.1,密码和用户名都是admin,如果你更好了路由器的IP及密码,请用你自己的设置进行登录,在此我按默认的设置进行介绍:
    在浏览器中输入192.168.1.1,在弹出的输入框的两项都输入admin后就成功登录了路由器。
    下图以WRT54GS原厂固件为例进行说明:

    1.jpg:
    diyblPic
    进去后,点红圈那里的“Administrator”(在WRT54G中文固件就是管理),
    进入下图

    2.jpg:
    diyblPic
    点击“Firmware Upgrade”(WRT54G中文固件叫“固件升级”),进入固件升级页面,选“浏览”,然后,到你解压tomato的路径下选中刚刚的tomato.bin,如下图
    3.jpg:
    diyblPic

    点击红圈中的“Upgrade”(WRT54G中文固件叫“升级”),然后就等着Tomato中文版固件出现在你面前吧!
        

    请记住,从WRT54G/GS/GL等固件直接刷过来,你路由器原来的IP和密码是什么,现在仍然是什么!用户名则是adminroot都行!(因为原厂固件和Tomato都采用不加密保存密码的方式,所以刷过来密码是不会变的,并不像网上流传的要先刷DD-WRT再刷Tomato,这样就自找麻烦了!)
    在左边的菜单选“超级用户->备份恢复”中,有个“恢复默认设置”下面,选择“清除NVRAM中所有数据(完全清除)”后,点“确定”,
      如下图
    5.jpg:
    diyblPic

    清除成功后,会出现下面的页面:
    .
    6.jpg:
    diyblPic
    点红圈中的“继续”按纽,路由器会恢复默认设置,不管你以前路由器IP和密码是多少,清完后的IP都是:192.168.1.1,用户名adminroot都行,密码是admin,如果点“继续”后要你输入登录账号信息的话,只要照此输入就行了。
    耶耶耶!搞定!什么?还想知道怎么使用,这不在本教程范围内了,你先慢慢研究一下,或到网上找找其它高手请教吧!
      


    二:从DD-WRT固件刷到Tomato
    DD-WRT因出来的较早,功能也强大,能做中继及有VPN SEVER是它最大的优点,而且当时Tomato还没有中文版,所以DD-WRT是大家很熟悉的第三方固件了,但是,DD的弱点也很明显的,稳定性不好,经常进不了管理页面,一些功能根本没用!这样也导不少用户对他失去了一些信心,而Tomato中文版问世以后,更多的朋友就加入了Tomato阵营中来了,我也是从DD-WRT转学过来的^_^
    首先,DD用户想刷Toamto的要注意了,特别是那些路由器没有复位键的朋友,本段一要看要做,如果你的DD登录密码不是admin,请先把登录密码改成admin再进行后面的工作!就是在DD的工“管理->普通管理”中进行设置
    因为DD采用了加密方式保存密码,admin加密码后是bJz7PcC1rCRJQ这一串字符,刷到tomato后,用户名是adminroot都行,但密码是bJz7PcC1rCRJQ这串字符,这就是我要求你改 DD管理密码为admin的原因。
    然后,到DD的“管理-固件升级”中选“浏览”,在弹出的窗口中,定位到你解压Tomato的文件夹,双击tomato.bin,回到DD的界面,点“升级”按纽
    dd1.jpg:
    diyblPic

      升级成功后,会出现如下页面:
    dd2.jpg:
    diyblPic
    点红圈中的“继续”按纽,出来tomato的登录页面,用户名输入adminroot都行,密码输入“admin”加密后的密文:bJz7PcC1rCRJQ到密码输入框中,点“确定”按纽,哈哈,Tomato就会展示在你面前了!(其实有硬件复位功能的大多数机器,如果刷后登录密码不对,都可以通过复位键来设定成默认值,比如linksys系列的都支持。)
    别高兴太早,登录到Tomato后的第一件事,清Nvram,如何清?请看第1种环境教程中的“清理NVRAM”部分
    第3种环境:从Buffalo原厂固件刷到Tomato
             还有一种从Buffalo升级到Tomato,需要用TFTP的方式上传固件,在这里就不叙述了,感兴趣的朋友自己搞了。
    补充:如果想刷回原厂固件,如从Tomato刷回原厂,参考第一种环境,如果从DD-WRT刷回原厂,参考第二种环境!
    from http://www.diybl.com/course/6_system/linux/Linuxjs/2008813/135846.html
    -------------------------------------------------------------------------------------------
    路由器从DD-WRT固件刷到Tomato(番茄)的详细过程

    一、准备工作
    注:升级固件请用有线而不要用无线,并且在升级过程中千万不要断网断电 .
    首 先,你得确定自己的机器支持Tomato固件,否则请不要尝试刷Tomato,关于哪些机器支持Tomato,请看buffalo系列:WHR- G54S, WHR-HP-G54, WZR-G54系列, WBR2-G54,WZR-RS-G54HP,WZR-HP-G54,WZR-RS-G54,WVR-G54-NF,WHR2-A54G54,WHR3-AG54
    linksys系列: WRT54G v1-v4, WRT54GS v1-v4, WRT54GL v1.x, WRTSL54GS
    moto系列:WR850G
    FUJI:RT390W(无线模块无法驱动,可以识别型号)
    从DD-WRT固件刷到Tomato
    首 先,想刷Toamto的用户要注意了,特别是那些路由器没有复位键的朋友,如果你的DDWRT登录密码不是admin,请先把登录密码改成admin再进 行后面的工作!就是在DDWRT的”管理->普通管理”中进行设置,因为DDWRT采用了加密方式保存密码,admin加密码后是 bJz7PcC1rCRJQ这一串字符,刷到tomato后,用户名是admin或root都行,但密码是bJz7PcC1rCRJQ这串字符,这就是要 DD管理密码为admin的原因.
    如果不想改动就可TELNET进入取得密码再进行下去,否则刷完机后会发现密码不对了.
    手动读取密码:命令行模式下 telnet登陆路由器,
    运行 nvram show|grep http_pass 命令取得http登陆密码并记录下来
    然后清除nvram,命令如下:
    mtd -r erase nvram
    输入后回车,路由会断开连接.等待路由器重启.
    3.重新登陆路由器,检查语言是否为英文.如果是,证明nvram清除成功.
    二、升级方法
    到DD的”管理-固件升级”中选”浏览”,在弹出的窗谥?定位到你解压Tomato的文件夹,双击tomato.bin(因为一些固件只认bin文件,所以,请先把tomato.trx改名成tomato.bin),回到DD的界面,点”升级”按纽.
    耐 心等待一会,然后自动重启,返回界面.点 “继续”按纽,出来tomato的登录页面,用户名输入admin或root都行,密码输入”admin”加密后的密文:bJz7PcC1rCRJQ到密 码输入框中,点”确定”按纽,哈哈,Tomato就会展示在你面前了!(其实有硬件复位功能的大多数机器,如果刷后登录密码不对,都可以通过复位键来设定 成默认值,比如linksys系列的都支持.)
    别高兴太早,登录到Tomato后的第一件事,清Nvram,如何清?请看下面”清理NVRAM”部分.
    清理NVRAM:
    为了你的路由器能稳定的工作,在刷到Tomato后,你需要清一下Nvram,这并不是什么复杂的工作,Tomato已提供了这个功能.
    在左边的菜单选”超级用户->备份恢复”中,有个
    “恢复默认设置”下面,选择”清除NVRAM中所有数据(完全清除)”后,会有警告提示.点”确定”.不管你以前路由器IP和密码是多少,清完后的IP都是:192.168.1.1,用户名admin或root都行,密码是admin
    完成后重启,记得先修改密码.重启后WR850G会发现无线灯不亮了,用下面的方法恢复:
    WR850G清NVRAM后,无线状态正常,但是指示灯不亮,恢复的办法:
    telnet到WR850G后,
    输入 nvram ren wl0gpio0 wl0gpio4
    执行 nvram commit
    执行 reboot
    路由重启,无线指示灯状态就正常了,OK

    引用:恩山WIFI论坛
    摩托罗拉wr850g v2和v3版刷ddwrt后MAC地址的问题解决办法
    摩托罗拉的wr850g v2和v3版本现在都能刷ddwrt的v24了,而且支持硬件按钮复位,不过如果复位的话,lan、wan、无线这3个MAC地址全会变成以下模式:
    LAN MAC00:11:22:33:44:55
    WAN MAC00:11:22:33:44:56
    无线MAC00:11:22:33:44:57
    如果是单台AP使用无所谓,但如果几台AP桥接或者中继的话就麻烦了,有2种办法恢复:
    一、刷回原厂、然后再刷到openwrt,清空nvram,最后再刷回ddwrt即可,不过这个过程烦杂,所以下面说第二种方法.
    二、
    先说一下涉及到的几个地址的含义:
    il0macaddr 这个是无线mac地址
    et0macaddr 这个是LAN mac地址
    et1macaddr 这个是WAN mac地址
    lan_hwaddr 这个也是指LAN mac地址
    wl_hwaddr 这个也是指无线mac地址
    wan_hwaddr 这个也是指WAN mac地址
    wl0_hwaddr 这个也是指无线mac地址
    moto在ddwrt下mac地址必须遵循一个规律:
    lan mac地址
    我给一个范例:
    00:0C:E5:4B:F2:85 这个地址就可以作为LAN MAC地址
    00:0C:E5:4B:F2:86 这个地址就可以作为WAN MAC地址
    00:0C:E5:4B:F2:87 这个地址就可以作为无线 MAC地址
    下面开始说方法:
    1、XP下打开一个DOS窗口,然后输入:telnet 192.168.1.1 回车,这里的192.168.1.1是指你AP的地址,如果更改过,那就用新地址;
    2、用户名为root 密码为admin 如果你改过用户名和密码,那当然要输入新的,没改过,就用上面的;
    3、用户名和密码输入完成后,复制下面的命令直接粘贴到命令窗口内,然后回车,每条命令粘贴后按一下回车,一共9条命令、9次回车,地址你可以自己编,不过需要遵循上面说的规律:
    nvram set il0macaddr=00:0C:E5:4B:F2:87
    nvram set et0macaddr=00:0C:E5:4B:F2:85
    nvram set et1macaddr=00:0C:E5:4B:F2:86
    nvram set lan_hwaddr=00:0C:E5:4B:F2:85
    nvram set wl_hwaddr=00:0C:E5:4B:F2:87
    nvram set wan_hwaddr=00:0C:E5:4B:F2:86
    nvram set wl0_hwaddr=00:0C:E5:4B:F2:87
    nvram commit(这条命令运行后稍等10秒再运行最后一条命令)
    reboot(这个就是重启路由器,重启后路由器的地址就会变成上面的地址了)
    第二种环境:从Linksys WRT54G/GL/GS等原厂固件刷到Tomato
    先登录路由器,默认的IP地址是192.168.1.1,密码和用户名都是admin,如果你更好了路由器的IP及密码,请用你自己的设置进行登录,在此我按默认的设置进行介绍:
    在浏览器中输入192.168.1.1,在弹出的输入框的两项都输入admin后就成功登录了路由器.
    以WRT54GS原厂固件为例进行说明:
    进 去后,点”Administrator”(在WRT54G中文固件就是”管理”),点击”Firmware Upgrade”(WRT54G中文固件叫”固件升级”),进入固件升级页面,选”浏览”,然后,到你解压tomato的路径下选中刚刚的 tomato.bin,点击红圈中的”Upgrade”(WRT54G中文固件叫”升级”),然后就等着Tomato中文版固件出现在你面前吧!
    请 记住,从WRT54G/GS/GL等固件直接刷过来,你路由器原来的IP和密码是什么,现在仍然是什么!用户名则是admin或root都行!(因为原厂 固件和Tomato都采用不加密保存密码的方式,所以刷过来密码是不会变的,并不像网上流传的要先刷DD-WRT再刷Tomato,这样就自找麻烦了!) 清理NVRAM:
    为了你的路由器能稳定的工作,在刷到Tomato后,你需要清一下Nvram,这并不是什么复杂的工作,Tomato已提供了这个功能.
    --------------------------------------------------------------------------------------------------
    VPN Router is actually a normal router that has firmware that directly connects to VPN service helping all devices connected to that router to use that VPN service. This helps you pay for one VPN connection while all devices within the network use the VPN connection. Saves money, eh?

    Although it is possible to flash (if it runs a variation of Linux) your usual router to become a VPN router, I will suggest you to avoid doing any such thing as it is quiet complex and you might end up messing up your already running router.

    Recently, lot of companies have started to launch routers that are capable of connecting to VPN services directly without any hassles. This helps you route all your traffic within your network through the VPN server henceforth hiding your IP address for all the devices inside your network.

    Basic features of such VPN routers:

        Connect to any famous VPN service from around the Internet via the VPN router using VPN tunnel connections.
        Serve the VPN connection to other VPN devices in your network.
        Use wireless network for your network within your VPN router.
        Have the freedom to configure everything yourself using the famous DD-WRT open source firmware or use the pre-build firmware of that specific VPN router.

    In the weeks to come I will review some of the famous VPN routers present around the planet so as to make your life easy. Then you will be able to chose from the best possible VPN routers.

No comments:

Post a Comment