一、查看规则

iptables -t filter -L -n
iptables -t nat -L -n
iptables -t mangle -L -n
iptables -t raw -L -n

二、修改策略:

iptables -t filter -P INPUT DROP

三、什么是五元组?

源IP地址、目的IP地址、协议号、源端口、目的端口
ping: p(icmp),sip(10.1.1.1),dip(10.1.1.3),sport(null),dport(null)

四、允许ping通服务器:

ping 10.1.1.3 -t
#电脑cmd下执行并观察
iptables -A INPUT -p icmp -j ACCEPT
iptables -L -n

五、允许ssh连接到服务器:

iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -L -n
ssh 10.1.1.3 
#使用ssh连接

六、删除防火墙规则

iptables -D INPUT -p icmp -j ACCEPT
iptables -L -n

#再次进入电脑cmd下观察

七、项目(把sever模拟宽带路由器)

最后修改:2023 年 05 月 02 日
如果觉得我的文章对你有用,请随意赞赏