Work with iptables rule

1) Save the current Firewall rules to some file. (In case something goes wrong we can quickly revert the settings.


# iptables-save > /tmp/iptables.bkup


2) Now edit the file /tmp/iptables and copy paste the below command for making the port public.


# iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT


3) The below command will write the new changes of iptables into the memory.
# iptables-restore < /tmp/iptables.bkup


4) The below command will make the firewall changes permanent. After reboot also the new changes will not be lost.
# /etc/init.d/iptables save


5) Alternatively we can issue the below commands for making the ports public through terminal and we can save the iptables rules.


# iptables -I INPUT -p tcp -m tcp --dport 443 -j ACCEPT


# iptables -I INPUT -p tcp -m tcp --dport 3306 -j ACCEPT


Comments

Popular Posts

Install and configure rsyslog Centralized logging server in CentOS

How to fix postfix/smtp Network is unreachable error

Could not join realm: Necessary packages are not installed: sssd-tools sssd libnss-sss libpam-sss adcli