iptables 简单配置

mac2022-06-30  68

通过命令 netstat -tnl 可以查看当前服务器打开了哪些端口  Ssh代码   netstat -tnl     查看防火墙设置  Ssh代码   iptables -L -n      开放22、80端口  Ssh代码   iptables -A INPUT -p tcp --dport 22 -j ACCEPT   iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT   iptables -A INPUT -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT   iptables -A OUTPUT -p tcp --sport 80 -m state --state NEW,ESTABLISHED -j ACCEPT     取消其他端口的访问规则  Ssh代码   iptables -P INPUT DROP   iptables -P FORWARD DROP   iptables -P OUTPUT DROP     允许本地回环接口(即允许本机访问本机)  Ssh代码   iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT     允许已建立的或相关连的通行(如 数据库链接)  Ssh代码   iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT     允许所有本机向外的访问  Ssh代码   iptables -A OUTPUT -j ACCEPT     保存配置:  Ssh代码   service iptables save

转载于:https://www.cnblogs.com/yako/p/5151803.html

相关资源:iptables配置和honeyd配置实验报告
最新回复(0)