Giter Site home page Giter Site logo

limiting-bandwidth-on-macos's Introduction

Limiting-bandwidth-on-MacOS

Yosemite下 模拟低速网络

之前一直在终端使用 ipfw脚本命令,来模拟低速网络,不过在Yosemite 之后Apple移除了ipfw 命令,but now IPFW is gone, Moving to PF

GUI工具:

这是IO工具包,下载后,双击“Network Link Conditioner.prefPane” 进行安装。

启用后,配置一下very bad network,重新启动模拟器,我们就可以使用调整我们的模拟器网络环境了,模拟低速网络。(目前没办法对特定的地址限速,会降低电脑中所有请求的速度)

Terminal PF命令:

当然,如果使用终端,还是可以使用 PF命令,来替换 ipfw,下面是一断脚本


#!/bin/bash

# Reset dummynet to default config
dnctl -f flush

# Compose an addendum to the default config: creates a new anchor
(cat /etc/pf.conf &&
echo 'dummynet-anchor "my_anchor"' &&
echo 'anchor "my_anchor"') | pfctl -q -f -

# Configure the new anchor
cat <<EOF | pfctl -q -a my_anchor -f -
no dummynet quick on lo0 all
dummynet out proto tcp from any to any pipe 1
EOF

# Create the dummynet queue
dnctl pipe 1 config bw 4100byte/s

# Activate PF
pfctl -E

# to check that dnctl is properly configured: sudo dnctl list

检查配置列表

sudo dnctl list

最后的最后。。使用后别忘记重置。。

sudo dnctl -f flush
sudo pfctl -f /etc/pf.conf
sudo dnctl list

如果不起作用,可能是PF默认没有开启,使用 sudo pfctl -E 开启。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.