Copy server A's iptables rules to server B and apply it.
(At that time, in order to solve a chaotic docker environment, there was a problem with the routing between docker containers, and an iptables rule was rudely copied to solve it.)
Server A
Server A
sudo iptables-save > iptables-export cat iptables-export (modify if required) scp iptables-export user@server_b_ip_address:/tmpServer B
sudo iptables-restore < /tmp/iptables-exportCentOS:
sudo service iptables saveUbuntu:
sudo apt-get install iptables-persistent
When applying new firewall rules, you will be asked if you want to save the new configuration, just answer yes.
If you need to modify the firewall rules in the future and save the changes, you can also execute the following command:
sudo invoke-rc.d iptables-persistent save