redirecting local network to openvpn network
-
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 -
@scroll_dp said in redirecting local network to openvpn network:
OpenVpn network -- 192.168.1.0/24
local network -- 192.168.0.0/24Best 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.