How to redirect all Internet traffic to OpenVPN Server

Posted by JuliaS on Server Fault See other posts from Server Fault or by JuliaS
Published on 2011-11-11T21:30:23Z Indexed on 2011/11/12 1:57 UTC
Read the original article Hit count: 501

I have seen working solutions around the issue of forcing Internet traffic to go through the OpenVPN server but they are all done in Linux, all I want to know is how to add an entry to the route table in windows to make this happen. connectivity between the client and server is fine, my Windows 7 client can establish a connection to the Windows 2008 Server, but when established Internet traffic is still going from the local Windows 7 machine. Here are the details:

Server:

Windows 2008 Server with one NIC
OpenVPN IP Address: 192.168.0.1
Local NIC IP Address (connects the server to the Internet): 10.242.69.107

Client:

Windows 7 with one NIC
OpenVPN IP Address: 192.168.0.2
ISP allocated IP Address: 10.0.8.2 (gateway 10.0.8.1)

Server OpenVPN Config:

dev tun
ifconfig 192.168.0.1 192.168.0.2
secret static.key
push "redirect-gateway def1"

Client OpenVPN Config:

remote xxx.xxx.com
dev tun
ifconfig 192.168.0.2 192.168.0.1
secret static.key

I'm not an expert with adding routes...etc. I would be grateful if someone could let me know how to add this entry in my server/client route table.

EDIT:

Output from the client's netstat -rnv

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0         10.0.8.1         10.0.8.2     20
         10.0.8.0  255.255.255.252         On-link          10.0.8.2    276
         10.0.8.2  255.255.255.255         On-link          10.0.8.2    276
         10.0.8.3  255.255.255.255         On-link          10.0.8.2    276
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      192.168.0.0  255.255.255.252         On-link       192.168.0.2    286
      192.168.0.2  255.255.255.255         On-link       192.168.0.2    286
      192.168.0.3  255.255.255.255         On-link       192.168.0.2    286
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link          10.0.8.2    276
        224.0.0.0        240.0.0.0         On-link       192.168.0.2    286
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link          10.0.8.2    276
  255.255.255.255  255.255.255.255         On-link       192.168.0.2    286
===========================================================================

© Server Fault or respective owner

Related posts about Windows

Related posts about networking