1

i do have a little problem.

I set up an OpenVPN connection (client) (which runs using DD WRT on a router) to an OpenVPN server which works great, the thing is i dont know how to route the traffic through the tunnel.

I am able to ping the VPN Server on the router but i cannot access nor ping the vpn server using a pc which is connected to the router.

The OpenVPN client created a tun1 but i do not know how to forward / route everything pointing to 192.168.50.1 through the tunnel on a pc.

Hope someone can help.

Regards

5
  • Is the OpenVPN Server a 3rd party or one that you're running?
    – JW0914
    Commented Oct 10, 2019 at 11:58
  • i am running the server currently - its not 3rd party and it runs locally using 192.168.60.x while the server has 192.168.50.x
    – Cevrah
    Commented Oct 10, 2019 at 12:00
  • I'll create an answer with the config options required. What OS is the server running on (Linux, OpenWrt, DD-WRT, etc.)?
    – JW0914
    Commented Oct 10, 2019 at 12:03
  • the openvpn server runs on linux - the connection between client and server is site 2 site, the connection between them works (the routers can ping each other) but clients (pcs) connected to the client router cant ping the server
    – Cevrah
    Commented Oct 10, 2019 at 12:06
  • If my answer below does not work, please post your server and client config, anonymizing sensitive info before doing so (i.e. generalize the WAN IP/DDNS and port #)
    – JW0914
    Commented Oct 10, 2019 at 12:56

1 Answer 1

1

If you're looking to:

  • Route traffic behind a router (i.e. remote access), you'll use the route directive in the server config:

    # Linux:
    
      # Pushed Routes #
      #---------------------------------------------------
        push                'route 192.168.1.0 255.255.255.0'
    
        push                'dhcp-option    DNS 192.168.1.1'
        push                'dhcp-option    WINS 192.168.1.1'
    
        client-to-client    '1'
    
    
    # OpenWrt:
    
      # Pushed Routes #
      #---------------------------------------------------
        list    push                'route 192.168.1.0 255.255.255.0'
    
        list    push                'dhcp-option    DNS 192.168.1.1'
        list    push                'dhcp-option    WINS 192.168.1.1'
    
        option  client_to_client    '1'
    
    • Where 192.168.1.0/24 is the subnet behind the VPN you want to access

  • Route all traffic, including web traffic, through the VPN, use the redirect-gateway directive

    • This directive will vary depending on the OS the OpenVPN server is running on:

      push                'redirect-gateway def1'
      


General FYI:

Many simply use the generic configs found online, however, the most benefit and best security comes from tuning the configs.

  • I have a tuned server config and client config on my GitHub as an example.
    • tls_auth needs to be updated to tls_crypt in the Server config (see man page below).

I always recommend taking the time to read the OpenVPN HowTo (~15min) & man page (~45min).

You must log in to answer this question.

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