推荐学习书目
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 · Sep 27, 2016 · 4259 views
    This topic created in 3513 days ago, the information mentioned may be changed or developed.

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

    7 replies    2016-09-28 07:00:37 +08:00
    redsonic
        1
    redsonic  
       Sep 27, 2016
    google iptables netem 模块
    est
        2
    est  
       Sep 27, 2016
    tc
    linzhi
        3
    linzhi  
    OP
       Sep 27, 2016
    @redsonic
    @est
    感谢楼上 2 位,我试试 tc 和 netem
    linzhi
        4
    linzhi  
    OP
       Sep 27, 2016
    @redsonic iptables 没法针对某个端口延时控制呢
    linzhi
        5
    linzhi  
    OP
       Sep 27, 2016
    tc 和 netem 没法细粒度到端口呢
    hrong
        6
    hrong  
       Sep 27, 2016 via Android
    去问 GFW 的人,他们可精通这个了
    redsonic
        7
    redsonic  
       Sep 28, 2016   ❤️ 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 被特别关照。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5703 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 65ms · UTC 07:07 · PVG 15:07 · LAX 00:07 · JFK 03:07
    ♥ Do have faith in what you're doing.