大家在租用Megalayer服务器时经常会遇到CentOS 6关闭防火墙和CentOS 6开启防火墙等各种情况,本文为大家整理汇总了CentOS 6防火墙常用命令。
关闭防火墙:
server iptablesd stop
开启防火墙:
server iptablesd start
保存防火墙配置:
server iptablesd save
关闭开机启动:
chkconfig iptables off
开启开机启动:
chkconfig iptables on
开通某个端口(如:2231端口):
iptables -I INPUT -p tcp –dport 2231 -j ACCEPT
iptables -I OUTPUT -p tcp –sport 2231 -j ACCEPT
阻挡某个端口(如:2231端口):
iptables -I INPUT -p tcp –dport 2231 -j DROP
iptables -I OUTPUT -p tcp –sport 2231 -j DROP