Ubuntu 下做怎么屏蔽 outgoing 流量并可以保存日志(IP 和域名)好?

2018-03-02 22:16:17 +08:00
 YK46PTT
所有端口

后期还希望能做到 根据 域名或 IP 放行.

有方案容易一点实现的,也可以换系统

谢谢各位大神.
1388 次点击
所在节点    问与答
6 条回复
hu6360567
2018-03-02 22:17:49 +08:00
ntopng ?
extreme
2018-03-02 22:20:12 +08:00
iptables 有个模块叫 log

--log level
Log determined genres into dmesg even if they do not match the desired one. level can be one of the following values:

0 - Log all matched or unknown signatures

1 - Log only the first one

2 - Log all known matched signatures
You may find something like this in syslog:

Windows [2000:SP3:Windows XP Pro SP1, 2000 SP3]: 11.22.33.55:4024 -> 11.22.33.44:139 hops=3 Linux [2.5-2.6:] : 1.2.3.4:42624 -> 1.2.3.5:22 hops=4
extreme
2018-03-02 22:21:18 +08:00
当我二楼没说…

楼主需要根据域名过滤,需要应用层防火墙呢…
ratazzi
2018-03-02 22:56:18 +08:00
劫持 dns 查询到 dnsmasq 配合 ipset
LGA1150
2018-03-03 00:19:50 +08:00
接 #4 dnsmasq 加上参数 log-queries 以记录 DNS 查询
Devin
2018-03-03 07:25:11 +08:00
iptables 可以实现楼主需要的所有功能
1 拦截所有 outgoing 所有流量并记录
2 根据域名放行并记录
3 根据 IP 放行并记录
其中第 2 个功能用 iptables 可能会有性能问题,建议参考#4 #5 做法
建议学习 iptables 和 dnsmasq 用法

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/434400

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX