Answer the question
In order to leave comments, you need to log in
Forward mysql port to different subnet?
The Internet goes to 192.168.1.1 there is such a rule
i.e. when a request comes from an external address to the mysql port, it redirects to 192.168.1.2 now it needs to be redirected to 192.168.0.3 and the diagram is attached
Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question