Apr 21 2008

emule 结合 openvpn

Category: 技术ssmax @ 15:04:32

公司封了ed协议,今天手上拿了两台公网的废旧服务器,无所事事搞个vpn试试,linux的,编译openvpn,生成keys,开server,允许vpn过来的路由出去

/sbin/iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE

windows装好openvpn,设置成客户端,拿到keys,启动,发现路由设置好像有点问题,只有几个ip是出去的,试试用neo_mule绑定网卡,死活也连不出去,在command窗口加了一个路由看看,

route add 0.0.0.0 mask 0.0.0.0 10.8.0.5 METRIC 40

终于可以了,嘿嘿,然后就研究怎么在配置文件里面加,半天没找到怎么指定固定ip,最后找到用默认的网关就可以了,就一行,很强大。。。

route 0.0.0.0 0.0.0.0 default 40

因为始终无法在windows下面指定客户端ip,所以网关那里用了default,还是试了几次才试出来的。。。

后面的跳数设成40,因为我本来windows的默认网关是30,我只要emule使用vpn,所以设大一点,其他程度都不会使用,emule绑定了网卡,只能走这条路由。。。

–route network/IP [netmask] [gateway] [metric]
Add route to routing table after connection is established. Multiple routes can be specified. Routes will be automatically torn down in reverse order prior to TUN/TAP device close.This option is intended as a convenience proxy for the route(8) shell command, while at the same time providing portable semantics across OpenVPN’s platform space.netmask default — 255.255.255.255

gateway default — taken from –route-gateway or the second parameter to –ifconfig when –dev tun is specified.

The default can be specified by leaving an option blank or setting it to “default”.

The network and gateway parameters can also be specified as a DNS or /etc/hosts file resolvable name, or as one of three special keywords:

vpn_gateway — The remote VPN endpoint address (derived either from –route-gateway or the second parameter to –ifconfig when –dev tun is specified).

net_gateway — The pre-existing IP default gateway, read from the routing table (not supported on all OSes).

remote_host — The –remote address if OpenVPN is being run in client mode, and is undefined in server mode.

 

Leave a Reply