R
R
Ruslan5642018-12-28 18:09:11
openvpn
Ruslan564, 2018-12-28 18:09:11

OpenVPN Ubuntu Iptables port forwarding to client's LAN?

There is a VPN server, the Ubuntu tun0 (10.8.0.10) client is connected to it, the client has an enp2s0 (192.168.0.60) interface through which you can access other network devices in the client's local network 192.168.0.X.
The question is, what parameters need to be set for the client in Iptables in order to get to the client's devices through the VPN?
I tried like this, but it didn't work.
iptables -t nat -A PREROUTING -p tcp -d 10.8.0.10 --dport 80 -j DNAT --to-destination 192.168.0.X:80
iptables -t nat -A POSTROUTING -p tcp --dst 192.168.0 .X --dport 80 -j SNAT --to-source 10.8.0.10:80
iptables -t nat -A OUTPUT --dst 10.8.0.10 -p tcp --dport 80 -j DNAT --to-destination 192.168.0 .X:80
iptables -I FORWARD 1 -i tun0 -o enp2s0 -d 192.168.0.X -p tcp -m tcp --dport 80 -j ACCEPT
net.ipv4.ip_forward = 1 enabled.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-12-28
@q2digger

On the server, set the route to the client's network
In the server's OpenVPN config, add
or
In the client's CCD config (if you use CCD), add iroute
iroute 192.168.0.0 255.255.255.0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question