Limiting bandwidth of machines on a network

Discussion in 'Mac OS X Server, Xserve, and Networking' started by haravikk, Jul 25, 2008.

  1. macrumors 65816

    Joined:
    May 1, 2005
    #1
    Hi there,

    My situation is this; I have a simple network of four Macs, all running OS X, sharing a 4mbps internet connection between them using a simple router (it routes traffic, little else).

    Now, usually things are fine, but sometimes I want one machine to have priority over the others. This occurs my main machine is wirelessly connected to the router via a wireless bridge, and seems to be automatically pushed to one side if one of the wired machines starts using higher traffic.

    Anyway, my thinking is that since OS X has ipfw (with dummynet) built in, then the machines can easily throttle themselves by putting all traffic through a bandwidth limited pipe. However, I don't want them to do this all the time, only if machines with higher priority need more traffic.

    My thinking is that I could probably do this myself using Java (which I'm familiar with) to act as a bridge between the machines and use ipfw to throttle things. I'm iffy on getting Java applications to run on system startup as root, but could probably get round it, otherwise I'd need to translate the idea into C or something.

    However, I'm wondering if any such solution exists already? To me an application managing calls to ipfw seems fairly trivial, but then there probably isn't much demand for it, as a serious network would just buy a router that does throttling automatically.

    So, does such a solution exist? If not; anyone have any idea how to get a Java application to begin on system startup (not user log-in) with root permissions? [edit] Occurs to me as well, a way of measure current network usage may be necessary. Are there any command-line tools that can do this, allowing you to simple grab a value like '524,288' for 512kbits/sec current usage?

    Thanks!
     
  2. macrumors 6502

    Joined:
    Jul 29, 2004
    #2
    I don't know if anything changed in leopard, but in my tiger experience...

    Check out the man pages for launchd and launchctl. These are the processes that control things like starting programs at login, startup(including root), and essentially replaces cron. Basic way this works is you create a .plist and load it using launchctl. There's a GUI for this as well called Lingon.
     
  3. macrumors 6502

    Joined:
    Feb 7, 2008
    #3
    Might be tougher than you think, also even if you get something working the implementation might slow things down more than what you gain. An Idea might be alternate firmware for a Linksys WRT54G/GL/GS. You should be able to get one of those pretty cheap, and http://www.polarcloud.com/tomato has firmware that seems to do what you want. I may try this with my linksys if I find a need.
     
  4. thread starter macrumors 65816

    Joined:
    May 1, 2005
    #4
    Hmm, processing the speeds and calculating the speed limit to assign to ipfw is fairly simple actually, and ipfw itself seems quite efficient. Sure there's likely a small processing overhead on the machines but not much is required. However this is assuming it's easy enough to measure the bandwidth use of the machine, so it can be determined if it should request more or can cut-back or not. If that's difficult then it would present a problem, I've not found any way to do it thus far. I assume there's some way as Activity Monitor can tell you packets in/out which is only a small step away from measuring it if you know the sizes. And there are some products (GUIs) out that can measure it in the background.

    Hmm, it's a possibility, but I did only get my current router (A Sitecom DC-202) fairly recently, sure it's not particularly expensive but I'm expecting to have to part with some money to get my recently deceased G3 iMac fixed (power supply went, I don't want to throw it away over a relatively small part, if the monitor went sure). Don't suppose you know if there's anywhere to get custom firmware for the DC-202? It's got a load of features I don't use so there's room to spare, but I dunno how common the routers are.
     
  5. macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #5
    You don't want to limit bandwidth you want to manage it with a priority assigned to each computer. It's a form of traffic shaping. SOme times people use it so HTTP goes ahead of mail and ftp. But you could set it so one compuer goes ahead of the others

    You were right: Get a router that has this feature. But you don't have to buy one. Unix/Linux machines make great routers and Mac OS X is a Unix system. Set up one machine with two or more network interaces to be the router and then set up some IPFW rules to limit bandwidth. Prioritization has to be done inside one place (the router)

    Once I set up a Linux system to act as a router. I needed some features I could not get in an afordable router but them I computed the cost of the power to run a PC 24x7.
     
  6. macrumors member

    Joined:
    Jul 16, 2007
    Location:
    England
  7. macrumors regular

    Joined:
    Jul 29, 2008
    Location:
    The Mitten State
    #7
    Seems to me you're trying to re-invent the wheel to do something that, in all reality, the router should be doing... not the clients.

    Now, i know you said it's just a simple router, however depending on which one you have... there very well could be QoS feature on the router, or with a third part Firmware. Personally I would go that route, since it really is the proper way to do this, rather than the elaborate ipfw route.
     

Share This Page