Linux tcpdump 跟踪 IPsec 流量

添加跟踪点

bash 复制代码
# cat ipsec-debug.sh
iptables -t raw -I PREROUTING -p esp -j NFLOG --nflog-group 5
iptables -t raw -I PREROUTING -p ah -j NFLOG --nflog-group 5
iptables -t raw -I PREROUTING -p udp -m multiport --dports 500,4500 -j NFLOG --nflog-group 5

iptables -t raw -I OUTPUT -p esp -j NFLOG --nflog-group 5
iptables -t raw -I OUTPUT -p ah -j NFLOG --nflog-group 5
iptables -t raw -I OUTPUT -p udp -m multiport --dports 500,4500 -j NFLOG --nflog-group 5

iptables -t mangle -I PREROUTING -m policy --pol ipsec --dir in -j NFLOG --nflog-group 5
iptables -t mangle -I POSTROUTING -m policy --pol ipsec --dir out -j NFLOG --nflog-group 5

iptables -t filter -I INPUT -m addrtype --dst-type LOCAL -m policy --pol ipsec --dir in -j NFLOG --nflog-group 5

iptables -t filter -I FORWARD -m addrtype ! --dst-type LOCAL -m policy --pol ipsec --dir in -j NFLOG --nflog-group 5

iptables -t filter -I OUTPUT -m policy --pol ipsec --dir out -j NFLOG --nflog-group 5


# tcpdump -s 0 -n -i nflog:5

清理跟踪点

bash 复制代码
iptables -t raw -D PREROUTING -p esp -j NFLOG --nflog-group 5
iptables -t raw -D PREROUTING -p ah -j NFLOG --nflog-group 5
iptables -t raw -D PREROUTING -p udp -m multiport --dports 500,4500 -j NFLOG --nflog-group 5

iptables -t raw -D OUTPUT -p esp -j NFLOG --nflog-group 5
iptables -t raw -D OUTPUT -p ah -j NFLOG --nflog-group 5
iptables -t raw -D OUTPUT -p udp -m multiport --dports 500,4500 -j NFLOG --nflog-group 5

iptables -t mangle -D PREROUTING -m policy --pol ipsec --dir in -j NFLOG --nflog-group 5
iptables -t mangle -D POSTROUTING -m policy --pol ipsec --dir out -j NFLOG --nflog-group 5

iptables -t filter -D INPUT -m addrtype --dst-type LOCAL -m policy --pol ipsec --dir in -j NFLOG --nflog-group 5

iptables -t filter -D FORWARD -m addrtype ! --dst-type LOCAL -m policy --pol ipsec --dir in -j NFLOG --nflog-group 5

iptables -t filter -D OUTPUT -m policy --pol ipsec --dir out -j NFLOG --nflog-group 5

原文参考:

docs.strongswan.org/docs/latest...

相关推荐
ZeroTaboo7 小时前
rmx:给 Windows 换一个能用的删除
前端·后端
Coder_Boy_8 小时前
Deeplearning4j+ Spring Boot 电商用户复购预测案例
java·人工智能·spring boot·后端·spring
Victory_orsh8 小时前
AI雇佣人类,智能奴役肉体
后端
金牌归来发现妻女流落街头8 小时前
【Springboot基础开发】
java·spring boot·后端
李日灐8 小时前
C++进阶必备:红黑树从 0 到 1: 手撕底层,带你搞懂平衡二叉树的平衡逻辑与黑高检验
开发语言·数据结构·c++·后端·面试·红黑树·自平衡二叉搜索树
qq_297574679 小时前
【实战】POI 实现 Excel 多级表头导出(含合并单元格完整方案)
java·spring boot·后端·excel
郝学胜-神的一滴9 小时前
超越Spring的Summer(一): PackageScanner 类实现原理详解
java·服务器·开发语言·后端·spring·软件构建
Tony Bai9 小时前
“Go 2,请不要发生!”:如果 Go 变成了“缝合怪”,你还会爱它吗?
开发语言·后端·golang
Victor3569 小时前
Hibernate(91)如何在数据库回归测试中使用Hibernate?
后端
Victor35610 小时前
MongoDB(1)什么是MongoDB?
后端