Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've set up a OpenVPN server (Windows Server 2008 R2) and client (Windows 7). Both can ping each other, I can see shared files and so, but the VPN subnet has no access to the Internet. I know (or I think) I must add a route, but I have no idea what route to add, or where.

Here's is a screenshot of my networks adapter configuration:

enter image description here

Here's the ipconfig:

C:\Users\Administrator.OWNEROR-0BE67KN>ipconfig

Windows IP Configuration


Ethernet adapter Local Area Connection 2:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::7c23:a:ec4e:2cfc%14
   IPv4 Address. . . . . . . . . . . : 10.0.0.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.252
   Default Gateway . . . . . . . . . :

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::bd18:6249:9f7d:89a2%11
   IPv4 Address. . . . . . . . . . . : 176.9.99.180
   Subnet Mask . . . . . . . . . . . : 255.255.255.224
   Default Gateway . . . . . . . . . : 176.9.99.161

Tunnel adapter Local Area Connection* 9:

   Connection-specific DNS Suffix  . :
   IPv6 Address. . . . . . . . . . . : 2001:0:5ef5:79fd:cd2:137f:4ff6:9c4b
   Link-local IPv6 Address . . . . . : fe80::cd2:137f:4ff6:9c4b%10
   Default Gateway . . . . . . . . . : ::

Tunnel adapter 6TO4 Adapter:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

And the route table:

C:\Users\Administrator.OWNEROR-0BE67KN>netstat -r
===========================================================================
Interface List
 14...00 ff e4 70 31 16 ......TAP-Win32 Adapter V9
 11...54 04 a6 7e ee ae ......Realtek PCIe GBE Family Controller
  1...........................Software Loopback Interface 1
 10...00 00 00 00 00 00 00 e0 Microsoft Teredo Tunneling Adapter
 12...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0     176.9.99.161     176.9.99.180     11
         10.0.0.0  255.255.255.252         On-link          10.0.0.1    286
         10.0.0.1  255.255.255.255         On-link          10.0.0.1    286
         10.0.0.3  255.255.255.255         On-link          10.0.0.1    286
         10.8.0.0    255.255.255.0         10.8.0.2     176.9.99.180     11
        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
     176.9.99.160  255.255.255.224         On-link      176.9.99.180    266
     176.9.99.180  255.255.255.255         On-link      176.9.99.180    266
     176.9.99.191  255.255.255.255         On-link      176.9.99.180    266
        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      176.9.99.180    266
        224.0.0.0        240.0.0.0         On-link          10.0.0.1    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      176.9.99.180    266
  255.255.255.255  255.255.255.255         On-link          10.0.0.1    286
===========================================================================
Persistent Routes:
  Network Address          Netmask  Gateway Address  Metric
          0.0.0.0          0.0.0.0     176.9.99.161       1
===========================================================================

IPv6 Route Table
===========================================================================
Active Routes:
 If Metric Network Destination      Gateway
 10     58 ::/0                     On-link
  1    306 ::1/128                  On-link
 10     58 2001::/32                On-link
 10    306 2001:0:5ef5:73b8:1c21:1dc8:4ff6:9c4b/128
                                    On-link
 11    266 fe80::/64                On-link
 14    286 fe80::/64                On-link
 10    306 fe80::/64                On-link
 10    306 fe80::1c21:1dc8:4ff6:9c4b/128
                                    On-link
 14    286 fe80::7c23:a:ec4e:2cfc/128
                                    On-link
 11    266 fe80::bd18:6249:9f7d:89a2/128
                                    On-link
  1    306 ff00::/8                 On-link
 10    306 ff00::/8                 On-link
 11    266 ff00::/8                 On-link
 14    286 ff00::/8                 On-link
===========================================================================
Persistent Routes:
  None

UPDATE 1

Here are my client and server config files:

Server:

#server config file start


port 1194
proto udp
dev tun
server 10.0.0.0 255.255.255.224   #you may choose any subnet. 10.0.0.x is used for this example.

ca "C:\\Program Files (x86)\\OpenVPN\\easy-rsa\\keys\\ca.crt" 
cert "C:\\Program Files (x86)\\OpenVPN\\easy-rsa\\keys\\server.crt" 
key "C:\\Program Files (x86)\\OpenVPN\\easy-rsa\\keys\\server.key" 
dh "C:\\Program Files (x86)\\OpenVPN\\easy-rsa\\keys\\dh1024.pem" 

push "redirect-gateway def1"

push "dhcp-option DNS 8.8.8.8"

#the following commands are optional
keepalive 10 120         
comp-lzo                   
persist-key               
persist-tun               
verb 5                   


#config file ends

Client:

#client  config file start

client
dev tun
proto udp
remote 176.9.99.180 1194   

resolv-retry infinite
nobind
persist-key
persist-tun

ca "C:\\Program Files (x86)\\OpenVPN\\easy-rsa\\keys\\ca.crt"
cert "C:\\Program Files (x86)\\OpenVPN\\easy-rsa\\keys\\client1.crt"
key "C:\\Program Files (x86)\\OpenVPN\\easy-rsa\\keys\\client1.key"
ns-cert-type server

comp-lzo
verb 5
explicit-exit-notify 2
ping 10
ping-restart 60

route-method exe
route-delay 2

# end of client config file
share|improve this question

This is a classic VPN problem. Most VPNs are created to encrypt traffic between specific networks at the source and destination.

However, the requirement here is to have a specific source, but any destination. To get all traffic from the client to be routed across the VPN you need to use the directive:

push "redirect-gateway def1"

If your VPN gateway is inside your network, or in a DMZ, then all should be well from here, your VPN servers default gateway should lead to the internet. At the perimeter of your network, you would do a PAT (or hide nat, or masquarade NAT as it is also known) to give the traffic a public source address. Response packets will come back, and be deNATed to the VPN client address they came from, so your perimeter firewall or router will need to have a static route for the VPN client subnet pointing at the VPN server.

See reference here.

share|improve this answer
    
I have edited to include my current config files. I already have the push "redirect-gateway def1" directive. I have no knowledge at all of networking, so I'm not sure to understand what your saying.. but the thing is, I don't know how to create the route. Can I do it on the server.conf? If so, can you tell me how? (You have all my IPs up there, and I can provide any additional information you ask for. What I'm in need for is to be able to redirect all my traffic trhough the server so I can have another public IP. – Dídac Punyet Jun 14 '12 at 14:47
    
BTW, I already read ALL the How-to's on OpenVPN site.. I jsut don't understand most of them :( – Dídac Punyet Jun 14 '12 at 14:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .