Tamadite
16-11-2008, 20:41
FOREWORD
For a couple of days ago I tried posting this HowTo under “WL-500g/WL-500gx Tutorials” where other tutorials are. Either forum’s administrators have not had the time to publish it or administrator’s rules have restrained this HowTo from being published. In any case, the result is the distortion of the intended structure of this forum leading it to find HowTos where there should not be.
SOURCE
-. “HowTo install OpenVPN server (http://wl500g.info/showthread.php?t=5312)" tutorial in this forum
ASUMPTIONS
-. Have read or installed OpenVPN server following the above source
HOW-TO 1: Automatically without user intervention
Create new server.conf and client.ovpn files as follows:
server.conf file
dev tun0
ifconfig 10.8.0.1 10.8.0.2
secret static.key
# Routing all client traffic (including web-traffic) through the VPN
push "redirect-gateway def1"
push "dhcp-option DNS 10.8.0.1"
client.ovpn file
remote myremote.mydomain
float
dev tun0
ifconfig 10.8.0.2 10.8.0.1
secret static.key
keepalive 10 60
redirect-gateway def1
route-method exe
route-delay 2
dhcp-option DNS 10.8.0.1
where myremote.mydomain is the WAN ip address or host name of your Router.
NOTES:
i) With Microsoft Vista, client.ovpn may be started as administrator (run OpenVPN GUI as administrator).
HOW-TO 2: By manipulating routing table on client
After following “HowTo install OpenVPN server (http://wl500g.info/showthread.php?t=5312)” tutorial one should gather the below parameters:
1) Internet IP address of the VPN Server. I will call it VpnSrvIp
2) Default gateway on VPN Client. I will call it GtwClntIp (see notes)
I assume far-end IP address of the VPN link is 10.8.0.1 as it is on the above mentioned tutorial.
Open a DOS prompt window and write the following:
route add VpnSrvIp MASK 255.255.255.255 GtwClnIp METRIC 1
route add 0.0.0.0 MASK 0.0.0.0 10.8.0.1 METRIC 1
It may happen that after a while Windows restructures the routing table giving priority to the Internet gateway. If so, run:
route change 0.0.0.0 MASK 0.0.0.0 10.8.0.1 METRIC 1
NOTES
i) If no DNS resolution edit file /etc/dnsmasq.conf and add line
interface=tun0and then restart the dnsmasq process (kill & invoke)
ii) One way to identify the default gateway (GtwClntIp) on a Windows XP machine is by running “route print” on a DOS prompt window. This easy the identification in case more than one NIC is present.
iii) More information: http://www.openvpn.net/index.php/documentation/howto.html
For a couple of days ago I tried posting this HowTo under “WL-500g/WL-500gx Tutorials” where other tutorials are. Either forum’s administrators have not had the time to publish it or administrator’s rules have restrained this HowTo from being published. In any case, the result is the distortion of the intended structure of this forum leading it to find HowTos where there should not be.
SOURCE
-. “HowTo install OpenVPN server (http://wl500g.info/showthread.php?t=5312)" tutorial in this forum
ASUMPTIONS
-. Have read or installed OpenVPN server following the above source
HOW-TO 1: Automatically without user intervention
Create new server.conf and client.ovpn files as follows:
server.conf file
dev tun0
ifconfig 10.8.0.1 10.8.0.2
secret static.key
# Routing all client traffic (including web-traffic) through the VPN
push "redirect-gateway def1"
push "dhcp-option DNS 10.8.0.1"
client.ovpn file
remote myremote.mydomain
float
dev tun0
ifconfig 10.8.0.2 10.8.0.1
secret static.key
keepalive 10 60
redirect-gateway def1
route-method exe
route-delay 2
dhcp-option DNS 10.8.0.1
where myremote.mydomain is the WAN ip address or host name of your Router.
NOTES:
i) With Microsoft Vista, client.ovpn may be started as administrator (run OpenVPN GUI as administrator).
HOW-TO 2: By manipulating routing table on client
After following “HowTo install OpenVPN server (http://wl500g.info/showthread.php?t=5312)” tutorial one should gather the below parameters:
1) Internet IP address of the VPN Server. I will call it VpnSrvIp
2) Default gateway on VPN Client. I will call it GtwClntIp (see notes)
I assume far-end IP address of the VPN link is 10.8.0.1 as it is on the above mentioned tutorial.
Open a DOS prompt window and write the following:
route add VpnSrvIp MASK 255.255.255.255 GtwClnIp METRIC 1
route add 0.0.0.0 MASK 0.0.0.0 10.8.0.1 METRIC 1
It may happen that after a while Windows restructures the routing table giving priority to the Internet gateway. If so, run:
route change 0.0.0.0 MASK 0.0.0.0 10.8.0.1 METRIC 1
NOTES
i) If no DNS resolution edit file /etc/dnsmasq.conf and add line
interface=tun0and then restart the dnsmasq process (kill & invoke)
ii) One way to identify the default gateway (GtwClntIp) on a Windows XP machine is by running “route print” on a DOS prompt window. This easy the identification in case more than one NIC is present.
iii) More information: http://www.openvpn.net/index.php/documentation/howto.html