Answer the question
In order to leave comments, you need to log in
How to access the local subnet of a client behind NAT through a WireGuard VPN tunnel?
There is a need to access the client's local subnet behind NAT using the WireGuard tunnel.
There is:
Raised WireGuard server with white Internet address xxxx (internal 10.0.0.1)
Clients connected to it:
Client 1 connected to this server (interface1 10.0.0.2, interface2 192.168.0.1)
Client 2 connected to this server (10.0.0.3 )
All 3 hosts see each other, traffic runs. However, I need to access the 192.168.0.0/24 subnet of Client 1 from Client 2 .
How correctly in this situation to configure routing and routing?
Host systems - it doesn't matter, let's say linux
VPN - WireGuard, yes, I know about OpenVpn and others, but in this situation, WireGuard is very convenient for me. Yes, and it doesn't matter.
Answer the question
In order to leave comments, you need to log in
You need to set routes on computers in your network and on the client's to routers that hold vpn. So that they know where to forward packets for specific subnets.
Allow appropriate subnets in wireguard configs.
More details here - https://medium.com/@jmarhee/configuring-and-managi...
I think the following will help you:
On a computer with interface 192.168.0.1
# enable IP forwarding if it is not enabled
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o INTERFACE_NAME_С_192.168.0.1 -j MASQUERADE
On computers on the 10.xxx network
route add -net 192.168.0.0/24 gw 10.0.0.2
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question