YK46PTT
V2EX  ›  问与答

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

  •  
  •   YK46PTT · Mar 2, 2018 · 1805 views
    This topic created in 3003 days ago, the information mentioned may be changed or developed.
    所有端口

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

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

    谢谢各位大神.
    6 replies    2018-03-03 07:25:11 +08:00
    hu6360567
        1
    hu6360567  
       Mar 2, 2018 via Android
    ntopng ?
    extreme
        2
    extreme  
       Mar 2, 2018 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  
       Mar 2, 2018 via iPhone
    当我二楼没说…

    楼主需要根据域名过滤,需要应用层防火墙呢…
    ratazzi
        4
    ratazzi  
       Mar 2, 2018 via iPhone
    劫持 dns 查询到 dnsmasq 配合 ipset
    LGA1150
        5
    LGA1150  
       Mar 3, 2018 via Android
    接 #4 dnsmasq 加上参数 log-queries 以记录 DNS 查询
    Devin
        6
    Devin  
       Mar 3, 2018 via iPhone
    iptables 可以实现楼主需要的所有功能
    1 拦截所有 outgoing 所有流量并记录
    2 根据域名放行并记录
    3 根据 IP 放行并记录
    其中第 2 个功能用 iptables 可能会有性能问题,建议参考#4 #5 做法
    建议学习 iptables 和 dnsmasq 用法
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3145 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 06:09 · PVG 14:09 · LAX 23:09 · JFK 02:09
    ♥ Do have faith in what you're doing.