V
V
vetash2014-01-28 15:10:28
openvpn
vetash, 2014-01-28 15:10:28

OpenVPN and port forwarding

Good day! The following problem needs to be solved:
Available:
network #1 - 192.168.21.0/29
network #2 - 192.168.20.0/16 (!)
server (debian 7)
ETH0 192.168.20.55/16
ETH1 192.168.21.132/29
TUN0 10.8.0.1 ( Openvpn server)
Client #1
ETH0 192.168.20.33/16
TUN0 10.8.0.2 (OpenVPN client)
Openvpn client connects to the server at 192.168.20.55. It is necessary to make sure that connections to 10.8.0.1 (TUN0 on the server) on port 564 are forwarded to 192.168.21.130/29 (ETH1 on the server) on the same port.
The basic iptables recipes don't work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2014-01-28
@vetash

Everything should work.

# echo 1 > /proc/sys/net/ipv4/ip_forward
# iptables -A INPUT -i tun0 -p tcp --dport 564 -j ACCEPT
# iptables -t nat -A PREROUTING -p tcp -i tun0 --dport 564 -j DNAT --to-destination 192.168.21.130:564

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question