E
E
Evgeny Oleinikov2017-10-13 14:54:20
iptables
Evgeny Oleinikov, 2017-10-13 14:54:20

Ubuntu port forwarding to network?

Good day to all.
For several days now I have been struggling with the task of port forwarding on the server using iptables. I read a ton of manuals, but I could not make port forwarding to the network.
The scheme is as follows: at the input, a router (will not be removed from the chain, optics) with a white ip, with a gateway address of 192.168.1.1, then a server that receives ip on the enp4s0 interface 192.168.1.2, there is port forwarding from 3189 to 3389 from the router to the server, then the server distributes the Internet on the enp5s0 interface with the gateway address 192.168.31.1, and then there is a PC with the address 192.168.31.128 that needs port forwarding 3389.
Please help me to forward the port to the destination PC.
Thanks in advance for your replies

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Oleinikov, 2017-10-13
@ruJumi

The issue is resolved, the ports were forwarded with the following rules

iptables -t nat -I PREROUTING --dst 192.168.1.2 -p tcp -m tcp --dport 3389 -j DNAT --to-destination 192.168.31.128:3389
iptables -t nat -A POSTROUTING -o enp4s0 -j SNAT --to-source 192.168.1.2

D
Denis Sechin, 2017-10-13
@tamogavk

the port is forwarded where NAT works, i.e. on the ROUTER

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question