Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    redirecting local network to openvpn network

    Scheduled Pinned Locked Moved OpenVPN
    2 Posts 2 Posters 438 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Scroll_DP
      last edited by

      Hi, I set up openvpn, all working fine.
      Connecting via different public ip(mobile data) connecting working, for example, in web I type my website which is in local in my network"192.168.0.0/24" (site --> 192.168.0.59, but when I am for example in the same network like me( same mask and network "192.168.0.0/24"), when I type 192.168.0.59 to my website, it does not find, because its think its located in this other local network( for example if I am in some place in the world connected to local network with internet acces). Only work 192.168.1.1 which is my pfsense router in openvpn, nothing else works.
      OpenVpn network -- 192.168.1.0/24
      local network -- 192.168.0.0/24

      V 1 Reply Last reply Reply Quote 0
      • V
        viragomann @Scroll_DP
        last edited by

        @scroll_dp said in redirecting local network to openvpn network:

        OpenVpn network -- 192.168.1.0/24
        local network -- 192.168.0.0/24

        Best practice would be to not use these networks, since they are default on many routers and hence widely used.

        But yes, it's possible to workaround the routing issue with an additional IP on the OpenVPN interface, which lies outside of these networks.
        To set this up, assign an interface to the OpenVPN server instance and activate it, say it's OPT1.
        Then go to Firewall > Virtual IPs and add an a new IP of type "IP alias" to this interface, e.g. 10.47.23.41/32.
        Then add a port forwarding rule to OPT1 for the destination IP 10.47.23.41 and target it to the concerned server. So you can use 10.47.23.41 to connect to the server from the OpenVPN.

        If you don't have "redirect gateway" in the OpenVPN server settings you have to add the virtual IP to the "Local networks", 10.47.23.41/32 in this example.

        If you have multiple IPs to be redirected you can use a /24 subnet mask for the virtual IP and add a NAT 1:1 rule to redirect the whole subnet.

        1 Reply Last reply Reply Quote 1
        • First post
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.