D
D
Dim Boy2016-12-20 16:28:42
ubuntu
Dim Boy, 2016-12-20 16:28:42

How to properly configure iptables on 2 pc?

Digging for the second day, there is an Ubuntu 16.04 server with IP 192.168.2.200 (enp1s5)
activated at boot only enp1s5 via ifconfig, how do others (enp1s3, enp1s2) activate at boot?
1) you just need to distribute the Internet on windows on enp1s3 (on the network card static 192.168.10.10 gateway 192.168.10.1)
2) on the network card enp1s2 the second server (on the network card static 192.168.20.20 gateway 192.168.20.1), you need to do port forwarding.
like this (for example, port 22):
sudo iptables -t nat -A PREROUTING -p tcp -d 192.168.2.200 -dport 22 -j DNAT -to-destination 192.168.20.20:22
sudo iptables -t nat -A POSTROUTING -p tcp --dst 192.168.20.20 --dport 22 -j SNAT --to-source 192.168.2.200
and so on...
the question is how to make this whole thing work and save it in iptables after reboot?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question