# Install
yum install -y iptables # 安装iptables
yum install iptables-services # 安装iptables-services
yum update iptables # 升级iptables
# Check status
service iptables status # CentOS6
systemctl status iptables # CentOS7
# Auto start
chkconfig iptables on # CentOS6
systemctl enable iptables.service # CentOS7
# 开放指定端口
iptables -A INPUT -p tcp --dport 4022 -j ACCEPT
iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
iptables -A INPUT -p tcp --dport 8087 -j ACCEPT
原文:https://www.cnblogs.com/duchaoqun/p/12658480.html