Overview
- Linux 非常好用的防火墙
Prepare
# 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