ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
Netfilter是Linux操作系统核心层内部的一个数据包处理模块,它具有如下功能: 网络地址转换(Network Address Translate) 数据包内容修改 以及数据包过滤的防火墙功能 iptables -t filter -L -t选择表,-L列出表。 iptables -t filter -vL INPUT(大写的链名) -v查看更多的选项 使用-n选项,看是否反解地址。 拒绝某台机器所有请求: iptables -t filter -I INPUT -s ipaddr -j DROP -I 插入input链。到最前面。 -s为source之意。 -j 指明动作 -A append到队尾 iptables -t filter -I INPUT 2 -s addr -j DROP input后要插入的位置。 使用-R修改动作时,必须用 -s 指明,否则会出现严重错误。 使用 -P(大写),修改链的默认策略。 iptables -t filter -P FORWARD DROP 在centos6中,使用service iptables save命令保存。 centos 7中禁止firewalld systemctl disable firewalld systemctl stop firewalld 常用的白名单机制,设置默认为accept,然后添加需要放行的,末尾插入reject iptables -I INPUT -p tcp --dport 80 -j 自定义链 使用-X删除引用计数为0的,空的链。 iptables过滤只能在input,output,forward中实现,想要转发,则只会经过forward。