共计 360 个字符,预计需要花费 1 分钟才能阅读完成。
1、关闭 CentOS 7 自带的 firewall 防火墙
# 关闭防火墙
# 取消开机启动
systemctl stop firewalld systemctl disable firewalld
2、安装 iptables-services
# Cetnos 7 默认已经装了 iptables, 只需装 services
yum install iptables-services -y
3.首先开放22端口以防止ssh掉线
iptables -A INPUT -p tcp --dport 22 -j ACCEPT iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
保存配置防止丢失
service iptables save
默认设置为拒绝
iptables -P INPUT DROP iptables -P FORWARD DROP iptables -P OUTPUT DROP
正文完