From owner-freebsd-net@FreeBSD.ORG Sun Jun 9 05:09:24 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 454BD9DC for ; Sun, 9 Jun 2013 05:09:24 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by mx1.freebsd.org (Postfix) with ESMTP id 110791218 for ; Sun, 9 Jun 2013 05:09:24 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id f4so8670227iea.25 for ; Sat, 08 Jun 2013 22:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=fa8ZsxRoPtP5wKgjYpnp+S/t58oUwjYlhOIlqVEUsAo=; b=GuP01KWWylB/jy2Nxs3YAIZ/8lNDC7UQR3L4TOXNf+XB0csOBrwLnVCfA6dHUPYVOl /UOVdbQloUamKbZuRw+dXl7GK1RzRFVlqzMr6cmA6OYHkGyPugsQh19CVc0yJtcm5NvV FrnQOek36OVQ/gkKzJLev6LeuAe3P5HdpqbrdTTYU4QA9a5jwAIVkenZabjWC7AZzRgE hEeQwhT4Ez9UPrB1H1lmy3Yqfvm+ezeKN92MbvaZnOlI4yg3hvrtwoJxajnp7VhJUql/ /sYLgGA53ufLcZnJhNQsDRN6/BYkl9hh/jAPaKB7DNp4gXr2IrL9KLmTPYTNLq8IFyF1 wzVg== X-Received: by 10.50.12.99 with SMTP id x3mr1818894igb.58.1370754563223; Sat, 08 Jun 2013 22:09:23 -0700 (PDT) Received: from raichu ([24.212.218.13]) by mx.google.com with ESMTPSA id wn10sm4238408igb.2.2013.06.08.22.09.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 08 Jun 2013 22:09:22 -0700 (PDT) Sender: Mark Johnston Date: Sun, 9 Jun 2013 01:09:17 -0400 From: Mark Johnston To: Kenta Suzumoto Subject: Re: Per-IP Bandwidth Monitoring Message-ID: <20130609050917.GA31573@raichu> References: <20130607174701.9DAA0400EA@smtp.hushmail.com> <51B2228F.1000008@llaisdy.com> <20130607184536.4A4D7400EA@smtp.hushmail.com> <144D087B-9396-4FD5-90DD-2F7A29D9E55F@llaisdy.com> <20130609023211.D8E42200EA@smtp.hushmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130609023211.D8E42200EA@smtp.hushmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-net@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jun 2013 05:09:24 -0000 On Sat, Jun 08, 2013 at 10:32:11PM -0400, Kenta Suzumoto wrote: > Hello. I'm running a FreeBSD machine with 5 IP addresses, each of them attached to a specific jail. I'm wondering if there is an easy way to monitor the bandwidth usage of each of them individually. Upon googling, I ran into a lot of suggestions like bandwidthd. I gave it a try and it seemed very broken and basically didn't work at all. I'm basically looking for a "vnstat that works per IP instead of per interface" kind of thing. jnettop wasn't what I was looking for. It doesn't have to make pretty graphs(but that's nice too), just human-readable text is fine. Anyone have a recommendation? I'm not clear on what exactly you're after, but it seems like you should be able to get the info you need using the DTrace ip provider. This provider isn't available in FreeBSD yet, but a patch for it is at [1]. To use it, you'll need to recompile the kernel with my changes and then install the ip.d file from the patch to /usr/lib/dtrace. Once that's done, you can try the example script at [2] on your jail host. It just tracks the number of sent and received bytes per local IP address, and prints the totals every second. That's just an example presentation though - the point is that collecting this kind of info is pretty trivial with DTrace. The downside is that such scripts may hurt your throughput since they cause the kernel to execute some extra code for every packet sent and received through the IP stack. The actual performance hit will depend on the script. -Mark [1] http://people.freebsd.org/~markj/patches/providers/ip-provider.diff [2] http://people.freebsd.org/~markj/monitor.d