E
E
Evgeny Petryaev2019-07-19 23:36:38
iptables
Evgeny Petryaev, 2019-07-19 23:36:38

Forward iptables port?

On the router, I forwarded the port only to the network 192.168.1.0, or rather to 192.168.1.2, but I need traffic from 192.168.1.2 to get to 192.168.0.3, port 3306 5d3237864e166360875705.jpeg
There are such rules that are not mine and I don’t know what they mean5d3230e9ec8ef843435863.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Petryaev, 2019-07-23
@Gremlin92

In general, the problem was solved like this: From the beginning I made the network -> Enterprise Network, and then turned off the Windows firewall and ping went on
and such rules helped

sudo iptables -A FORWARD -i enp3s1 -o enp3s0 -p tcp --syn --dport 3306 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -i enp3s1 -o enp3s0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A FORWARD -i enp3s0 -o enp3s1 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -t nat -A PREROUTING -i enp3s1 -p tcp --dport 3306 -j DNAT --to-destination 192.168.0.3
sudo iptables -t nat -A POSTROUTING -o enp3s0 -p tcp --dport 3306 -d 192.168.0.3 -j SNAT --to-source 192.168.1.2

V
Vitsliputsli, 2019-07-19
@Vitsliputsli

Why do you need iptables? Just set up routes, well, you need to enable ipforwarding.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question