Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

looking for alternative solution than IPFW for slowing down an internet connection

I need to slow down (simulate bad) internet connection, I found some documentation where it was achieved by "ipfw pipe" command , the thing is that in latest MAC OS versions , ipfw was deprecated (and removed)...

I was wondering if there are any alternative to the ipfw API ? Does anyone know how latest Network Link Conditioner achieves it?

The original previous way which enabled to slow down an internet connection :

sudo ipfw pipe 1 config bw 56Kbit/s delay 200 plr 0.2

and to clear the pipe :

sudo ipfw delete 1

Thanks.

like image 719
Igal Avatar asked Oct 11 '15 11:10

Igal


People also ask

How do I simulate a slow internet connection on my computer?

To do this, click on the three vertical dots and then click on the middle dock position. Now go ahead and click on the Network tab. On the right, you should see a label called No Throttling. If you click on that, you'll get a dropdown list of a pre-configured speeds that you can use to simulate a slow connection.


2 Answers

I don't know much about Mac OS (I use Linux myself), but I'll give this a shot.

A bunch of digging established that ipfw seems unavailable, as you say.

I was also unable to find a way to use the Network Link Conditioner from the command line. Everything should be usable from the command line, so that's stupid.

One work around would be to try to access the NLC from within AppleScript. The following will get you started on toggling the NLC:

property thePane : "com.apple.Network-Link-Conditioner"  
tell application "System Preferences"  
activate  
  set the current pane to pane id thePane  
--delay 2  
end tell  
---  
tell application "System Events"  
  tell application process "System Preferences"  
  try  
  click ((checkboxes of window "Network Link Conditioner") whose description is "enable switch")  
  on error  
  click ((checkboxes of window "Network Link Conditioner") whose description is "enable switch")  
  end try  
  end tell  
end tell  

I think that you can run a script from the terminal with osascript <SCRIPT>.

As an alternative, Charles Proxy is a pay-to-use program that can be used to perform throttling, provided you can convince the software you are testing to connect to the proxy's port rather than directly to the internet. Maybe there are free proxy solutions out there somewhere?

Perhaps Squid would work in that regard. SquidMan seems to be an easy-ish way to install it for Mac. It looks as though DelayPools and or Client Bandwidth Limits might be useful for simulating a low speed connection, though I can't find evidence of people having used them for such.

like image 178
Richard Avatar answered Oct 01 '22 19:10

Richard


I found several solutions that might work. They come from some old threads, but they might help:

How to simulate slow internet connections on the mac

Apple has made a very handy official tool to slow down the network connections on you Mac for testing purposes.

The Network Link Conditioner preference is a free download from within Xcode (for Lion and later OS). Additionally, iOS has similar function accessible from within Xcode and iOS 6 or later.

How do I simulate a bad Wi-Fi connection on my iPad?

There are a few ways you can do this, depending on your situation:

  1. Move further away from your router. While this may seem a bit obvious, I realize that it isn't always possible while testing/debugging (for example, if you are working on a desktop computer).

  2. Put aluminum foil around the router and/or antenna. This will (partially) block some or all of the radio signals by creating a makeshift Faraday cage. The results you get will depend on the strength of your router signal, distance from the router, and other environmental factors.

  3. Set your router's wireless signal power to a lower setting. The method for doing this is different for each router, so you will have to look at the user guide for instructions on how to do this.

Slow down internet for iOS simulator

You can set the network to slow characteristic by testing on devices. Go to Settings -> Developer Settings -> Network Link Conditioner -> Enable. This is for iPhone/iPad running iOS 6

I don't know if the last one you can still do.

like image 24
Caleb Kleveter Avatar answered Oct 01 '22 20:10

Caleb Kleveter