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
复制代码
复制代码
复制代码
相关推荐
大哥您好7 小时前
QEMU 11.1.2 多架构编译指南(x86_64 / aarch64 / riscv64)
linux·服务器
道满科技8 小时前
Function Calling 参数总出错?只修参数就行
linux·windows·python
Gauss松鼠会8 小时前
高斯数据库(openGauss)的物理存储结构
运维·服务器·数据库·sql·opengauss·经验总结
Android系统攻城狮8 小时前
Linux Gstreamer深度解析之gst_audio_ring_buffer_prepare_read调用流程与实战(七十四)
linux·运维·服务器·gstreamer音视频·音视频进阶
杨云龙UP9 小时前
PostgreSQL 18.4 数据库整库迁移实战:pg_dump 备份与 pg_restore 恢复完整操作手册
运维·服务器·数据库·postgresql·pg_dump·pg_restore
我科绝伦(Huanhuan Zhou)9 小时前
Linux 通用压力测试脚本合集:磁盘 + 网络
linux·网络·压力测试
无人生还别怕10 小时前
如何安装任意版本docker
运维·docker·容器
土星云SaturnCloud10 小时前
土星云智慧服务区方案:AI视觉+边缘计算+视频存管一体化的全场景智能化落地解析
服务器·人工智能·ai·边缘计算
T0uken10 小时前
Colab:SSH 访问免费 GPU Server
运维·ssh
Python大数据分析@10 小时前
通过 MCP 实现 AI Agent自动化数据采集
运维·人工智能·爬虫·自动化