service iptables status
service iptables stop
service iptables start
service iptables restart
chkconfig iptables off
chkconfig iptables on
vim /etc/sysconfig/iptables
加入以下代碼,比着兩葫蘆畫瓢 :)vim
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
保存退出後重啓防火牆tcp
service iptables restart
systemctl status firewalld
firewall-cmd --state
service firewalld start
service firewalld restart
service firewalld stop
firewall-cmd --list-all
firewall-cmd --query-port=8080/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --remove-port=8080/tcp
firewall-cmd --reload
1. firwall-cmd:是Linux提供的操做firewall的一個工具; 2. --permanent:表示設置爲持久; 3. --add-port:標識添加的端口;