ubuntu16 在防火墙禁止“允许Traceroute探测”

ubuntu16 在防火墙ufw出站规则中禁用echo-reply(type 0)、time-exceeded(type 11)、destination-unreachable(type 3)类型的ICMP包。

方法一、直接配置UFW出站规则

复制代码
# 禁用"目的不可达"类型(Type 3)ICMP包的出站
sudo ufw deny out proto icmp to any icmp-type destination-unreachable

# 禁用"回显应答"类型(Type 0)ICMP包的出站
sudo ufw deny out proto icmp to any icmp-type echo-reply

# 禁用"超时"类型(Type 11)ICMP包的出站
sudo ufw deny out proto icmp to any icmp-type time-exceeded

方法二:编辑UFW配置文件

1.备份配置文件:在进行修改前,务必备份原始文件。

sudo cp /etc/ufw/before.rules /etc/ufw/before.rules.backup

2.编辑配置文件:使用文本编辑器 打开UFW的主要规则文件。

复制代码
sudo vim /etc/ufw/before.rules

添加:

复制代码
# 在*filter节后,在COMMIT行前的任意位置添加
-A ufw-before-output -p icmp --icmp-type destination-unreachable -j DROP
-A ufw-before-output -p icmp --icmp-type echo-reply -j DROP
-A ufw-before-output -p icmp --icmp-type time-exceeded -j DROP
复制代码

2.重启ufw

复制代码
sudo ufw disable
sudo ufw enable
复制代码
复制代码
复制代码
相关推荐
未济4 天前
linux 配置环境变量
linux
傲世仙尊4 天前
目录即文件-Ext文件系统收尾篇
linux·c语言
虎头金猫4 天前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
_艾伦 耶格尔.4 天前
进程间通信
linux
AI职业加油站4 天前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展
Liuqy-054 天前
Linux IO编程——静态库、动态库
linux
此冬歌咏4 天前
K8s 节点故障实战:优雅驱逐 31 秒,硬故障 331 秒,以及那个永远 Pending 的 Pod
运维·k8s
彧azz4 天前
Linux 环境下 Redis 学习总结:数据类型、持久化、锁、事务、主从与缓存问题
linux·redis·笔记·学习·面试
-梅4 天前
linux(8) 软硬链接
linux·运维·服务器
Wang's Blog5 天前
Java 项目实战: 外卖平台-文件下载与ServletOutputStream回写浏览器
服务器·项目开发