1. Go to/etc/sysconfig
2. Use the VI command to edit the iptables. " VI iptables ", and then show
# Firewall configuration written by system-config-firewall# Manual customization of this file is not recommended.*filter:i Nput Accept [0:0]:forward Accept [0:0]:output Accept [0:0]-a input-m State--state established,related-j accept-a INPUT -p icmp -j ACCEPT-A INPUT -i lo -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT-A INPUT -j REJEC T--reject-with icmp-host-prohibited-a forward-j reject--reject-with icmp-host-prohibitedcommit
3. Add MySQL port 3306, here we need to pay attention to this line of command
-A input-j REJECT--reject-with icmp-host-prohibited, this line has rejected the command of the other ports, if we add the newly inserted
Open ports are not enabled after this line of command is placed, and subsequent configuration of the open ports.
# Firewall configuration written by system-config-firewall# Manual customization of this file is not recommended.*filter:i Nput Accept [0:0]:forward Accept [0:0]:output Accept [0:0]-a input-m State--state established,related-j accept-a INPUT -P icmp-j accept-a input-i lo-j accept-a input-m State--state new-m tcp-p TCP--dport 22-j ACCEPT-A input-m s Tate--state new-m tcp-p tcp--dport 3306-j ACCEPT-A input-j REJECT--reject-with icmp-host-prohibited-a FORWARD -j REJECT--reject-with Icmp-host-prohibitedcommit
4. Then call the service iptables Resatar command
, the display represents success.
[Email protected] sysconfig]# service iptables restartiptables:setting chains to policy Accept:filter [ ok
]iptables:flushing firewall rules: [ OK ]iptables:unloading modules: [ OK ]iptables: Applying firewall rules: [ OK ]
Linux firewall configuration and reject cause no effective issue