V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
YK46PTT
V2EX  ›  问与答

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

  •  
  •   YK46PTT · 2018-03-02 22:16:17 +08:00 · 1336 次点击
    这是一个创建于 2245 天前的主题,其中的信息可能已经有所发展或是发生改变。
    所有端口

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

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

    谢谢各位大神.
    6 条回复    2018-03-03 07:25:11 +08:00
    hu6360567
        1
    hu6360567  
       2018-03-02 22:17:49 +08:00 via Android
    ntopng ?
    extreme
        2
    extreme  
       2018-03-02 22:20:12 +08:00 via iPhone
    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
        3
    extreme  
       2018-03-02 22:21:18 +08:00 via iPhone
    当我二楼没说…

    楼主需要根据域名过滤,需要应用层防火墙呢…
    ratazzi
        4
    ratazzi  
       2018-03-02 22:56:18 +08:00 via iPhone
    劫持 dns 查询到 dnsmasq 配合 ipset
    LGA1150
        5
    LGA1150  
       2018-03-03 00:19:50 +08:00 via Android
    接 #4 dnsmasq 加上参数 log-queries 以记录 DNS 查询
    Devin
        6
    Devin  
       2018-03-03 07:25:11 +08:00 via iPhone
    iptables 可以实现楼主需要的所有功能
    1 拦截所有 outgoing 所有流量并记录
    2 根据域名放行并记录
    3 根据 IP 放行并记录
    其中第 2 个功能用 iptables 可能会有性能问题,建议参考#4 #5 做法
    建议学习 iptables 和 dnsmasq 用法
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1750 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 16:37 · PVG 00:37 · LAX 09:37 · JFK 12:37
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.