B
B
Bega2021-02-22 13:58:06
linux
Bega, 2021-02-22 13:58:06

How to forward port to local machine connected to vpn?

Guys, the question is, is it possible to somehow make a connection to a remote machine that is connected to the VPN, but in the dnsmasq options I disabled the use of the default gateway so that all traffic is not driven through vpn
The line that disables the use of the default gateway in dnsmasq.conf Forwarded the
dhcp-option=tap_virt,3
ports like this

iptables -t nat -A PREROUTING --dst xxx.xxx.xxx.xxx -p tcp --dport 3389 -j DNAT --to-destination 10.10.10.10:3389

iptables -t nat -I POSTROUTING -o tap_virt -d 10.10.10.10 -p tcp --dport 3389 -j MASQUERADE


It doesn’t work like that, it’s worth commenting out or removing
dhcp-option=tap_virt,3
everything works, what should I do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Teremshonok, 2021-03-04
@TerAnYu

I can guess like this:

iptables -t nat -A POSTROUTING -o tap_virt -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp --dport 3389 -j DNAT --to 10.10.10.10:3389

The first rule is not necessary if you already have traffic masquerading.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question