R
R
romy42019-08-27 00:47:53
linux
romy4, 2019-08-27 00:47:53

How to map a virtual subnet to the same addresses in the tunnel?

The bottom line is that there are two vpn networks in which addresses intersect in the roughest form.
It is necessary that all requests to the local non-existent subnet 192.168.17.x (netmask 255.255.255.0) be forwarded to the same addresses tun0 (192.168.5.x). And all other requests went to the tun1 subnet.
ssh 192.168.17.44 should essentially be 192.168.5.44 via tun0, and directly ssh 192.168.5.44 should send a request to the tun1 subnet
If you can somehow add that all resolved domains from tun0 returned with addresses 192.168. super.
Naturally, all shamanism is only on the local machine, no one on remote hosts will change anything.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
wellcomer, 2019-08-27
@wellcomer

The direction is something like this:
ip route add 192.168.17.0/24 dev tun0
iptables -t nat -A POSTROUTING -d 192.168.17.0/24 -j NETMAP --to 192.168.5.0/24
iptables -t nat -A PREROUTING -i tun0 - s 192.168.5.0/24 -j NETMAP --to 192.168.17.0/24

R
romy4, 2019-09-15
@romy4

The solution is to use network namespace (ip netns). But the problem is with dns forwarding.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question