From owner-freebsd-isp Mon Apr 6 15:26:59 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA24461 for freebsd-isp-outgoing; Mon, 6 Apr 1998 15:26:59 -0700 (PDT) (envelope-from owner-freebsd-isp@FreeBSD.ORG) Received: from panda.hilink.com.au (panda.hilink.com.au [203.8.15.25]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA24452 for ; Mon, 6 Apr 1998 15:26:54 -0700 (PDT) (envelope-from danny@panda.hilink.com.au) Received: (from danny@localhost) by panda.hilink.com.au (8.8.5/8.8.5) id IAA04666; Tue, 7 Apr 1998 08:26:24 +1000 (EST) Date: Tue, 7 Apr 1998 08:26:23 +1000 (EST) From: "Daniel O'Callaghan" To: Glen Foster cc: chrism@keyworld.net, Anthony.Barlow@europe.simoco.com, freebsd-isp@FreeBSD.ORG, freebsd@plinet.com Subject: Re: Bandwidth limiter for services? In-Reply-To: <199804062152.RAA10319@gfoster.intr.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Mon, 6 Apr 1998, Glen Foster wrote: > This is speculation on my part based on scanty evidence. I wish > Dennis would 'fess up and describe the logic behind his code in this > forum. I've written a bandwidth limiter which works fairly basically. Unfortunately I lost it and have not had time to rewrite it. I'll describe *my* logic and maybe someone will pick it up and run with it. * A 64 kbps line has a throughput of 8 kBytes/second, thus each packet will take packet_len/8192 seconds to traverse the link. A 1024 byte packet will take 125 ms to traverse the link. * Since a packet takes < 1 ms to traverse a decent FreeBSD box with ethernet cards on each side, a packet which is to travel at a notional 64 kbps must be delayed in transit by (packet_len/8.192 - 1) ms, if the queue is empty. * If there is already a packet in the queue, the newly arrived packet must be scheduled for transmission (packet_len/8.192 - 1) ms after the last packet in the queue is due to be sent. You can see that the above effectively simulates what actually happens in a router which converts from your ISPs backbone ethernet/whatever to your 64 kbps ISDN link. My bandd used divert sockets, so traffic of a certain type could be sent through it - anything ipfw can test for. It should be noted that the system above will work best when there is a separate instance of bandd limiting traffic in the opposite direction, as per real life 64k lines. The above example is for 64kbps. Adjust accordingly. Danny To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message