1、基本操作
# 查看防火墙状态
service iptables status
# 停止防火墙
service iptables stop
# 启动防火墙
service iptables start
# 重启防火墙
service iptables restart
# 永久关闭防火墙
chkconfig iptables off
# 永久关闭后重启
chkconfig iptables on
#禁止与某个IP的所有连接:
iptables -t nat -A PREROUTING -d 192.168.10.1 -j DROP
#禁用80端口
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DROP
#禁用某个IP的80端口
iptables -t nat -A PREROUTING -p tcp --dport 21 -d 192.168.10.1 -j DROP
更多操作请参数链接:https://www.jianshu.com/p/80d44150c183
2、查看防火墙状态,防火墙处于开启状态并且只开放了22端口
3、开启8039端口
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8039 -j ACCEPT
CentOS 6.5安装完成,默认是已经打开了22端口的。
SSH 为 Secure Shell 的缩写,由 IETF 的网络工作小组(Network Working Group)所制定;SSH 为建立在应用层和传输层基础上的安全协议。SSH 是目前较可靠,专为远程登录会话和其他网络服务提供安全性的协议。