V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
linzhi
V2EX  ›  Python

如何不在修改内核源码的情况下,可以监听某个端口,然后实现延时,丢包,断开呢 iptable 不能设置延时,丢包啥的

  •  
  •   linzhi · 2016-09-27 16:04:06 +08:00 · 3457 次点击
    这是一个创建于 2767 天前的主题,其中的信息可能已经有所发展或是发生改变。

    不用修改内核里面的 netfilter 这个模块,而实现对某个端口的延时、丢包控制

    7 条回复    2016-09-28 07:00:37 +08:00
    redsonic
        1
    redsonic  
       2016-09-27 16:56:13 +08:00
    google iptables netem 模块
    est
        2
    est  
       2016-09-27 16:58:57 +08:00
    tc
    linzhi
        3
    linzhi  
    OP
       2016-09-27 18:20:32 +08:00
    @redsonic
    @est
    感谢楼上 2 位,我试试 tc 和 netem
    linzhi
        4
    linzhi  
    OP
       2016-09-27 18:28:18 +08:00
    @redsonic iptables 没法针对某个端口延时控制呢
    linzhi
        5
    linzhi  
    OP
       2016-09-27 19:13:07 +08:00
    tc 和 netem 没法细粒度到端口呢
    hrong
        6
    hrong  
       2016-09-27 20:54:46 +08:00 via Android
    去问 GFW 的人,他们可精通这个了
    redsonic
        7
    redsonic  
       2016-09-28 07:00:37 +08:00   ❤️ 1
    @linzhi tc+netem 就可以:
    tc qdisc add dev eth0 root handle 1: prio && \
    tc qdisc add dev eth0 parent 1:1 handle 2: netem corrupt 20% delay 40ms && \
    tc filter add dev eth0 parent 1:0 protocol ip pref 55 handle ::55 u32 match ip dport 80 0xffff flowid 2:1

    目标端口 tcp80 ,丢包率 20%,延迟 40ms


    @hrong 能问到的 GFW 的人恐怕只精通在 web ui 上面 key 字符,以及哪些 domain 被特别关照。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   987 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 20:35 · PVG 04:35 · LAX 13:35 · JFK 16:35
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.