Basic operations for setting the CentOS firewall: query the firewall status: [root @ localhost ~] # Service & amp; nb
Basic CentOS firewall settings:
Query the firewall status:
[Root @ localhost ~] # Service iptables status
Stop firewall:
[Root @ localhost ~] # Service iptables stop
Start firewall:
[Root @ localhost ~] # Service iptables start
Restart firewall:
[Root @ localhost ~] # Service iptables restart
Permanently disable the firewall:
[Root @ localhost ~] # Chkconfig iptables off
Enable after permanent shutdown:
[Root @ localhost ~] # Chkconfig iptables on
Port Opening: (use port 8080 as an example)
/Sbin/iptables-I INPUT-p tcp -- dport 8080-j ACCEPT #8080 indicates the specified port
/Etc/rc. d/init. d/iptables save # save the changes
/Etc/init. d/iptables restart # restart the firewall to make the change take effect.
Add a line to/etc/sysconfig/iptables:
-A RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-dport 8080-j ACCEPT