From owner-freebsd-questions Thu Oct 4 3:58:59 2001 Delivered-To: freebsd-questions@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id B38DE37B405; Thu, 4 Oct 2001 03:58:31 -0700 (PDT) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id f94AujP57849; Thu, 4 Oct 2001 13:56:45 +0300 (EEST) (envelope-from ru) Date: Thu, 4 Oct 2001 13:56:45 +0300 From: Ruslan Ermilov To: unix@usww.com Cc: net@FreeBSD.org Subject: ifconfig(8) not counting per-IP-address outgoing statistics (was: Re: ifconfig question on the new 4.4) Message-ID: <20011004135645.E48758@sunbay.com> References: <3BBA0D10.3FA53C30@usww.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3BBA0D10.3FA53C30@usww.com>; from unix@usww.com on Tue, Oct 02, 2001 at 02:53:04PM -0400 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG [Redirected to -net] On Tue, Oct 02, 2001 at 02:53:04PM -0400, unix@usww.com wrote: > I installed the new release 4.4 on one machine to check out a feature I have been waiting for. > That is the ability to track bytes through one interface using several IP numbers. I seem to have > missed something I hope someone out there could help with. It appears to track incomming but not > outgoing bytes. > > When you do a 'netstat -bin' you get a report like: > netstat -bin > Name Mtu Network Address Ipkts Ierrs Ibytes Opkts Oerrs Obytes Coll > rl0 1500 00:48:54:1e:b9:38 13072 0 5142645 13636 0 1345022 0 > rl0 1500 10/24 10.0.0.170 3984 - 4521604 13588 - 1152144 - > rl0 1500 10.0.0.171/32 10.0.0.171 223 - 12331 0 - 0 - > rl0 1500 10.0.0.172/32 10.0.0.172 241 - 14334 0 - 0 - > rl0 1500 10.0.0.173/32 10.0.0.173 8403 - 355006 0 - 0 - > rl0 1500 10.0.0.174/32 10.0.0.174 0 - 0 0 - 0 - > rl0 1500 10.0.0.175/32 10.0.0.175 315 - 16779 0 - 0 - > rl1* 1500 00:50:bf:16:15:50 0 0 0 0 0 0 0 > rl2* 1500 00:50:bf:16:15:5f 0 0 0 0 0 0 0 > rl3* 1500 00:48:54:1e:b7:81 0 0 0 0 0 0 0 > rl4* 1500 00:50:ba:42:7f:be 0 0 0 0 0 0 0 > lp0* 1500 0 0 0 0 0 0 0 > lo0 16384 4 0 187 4 0 187 0 > lo0 16384 127 127.0.0.1 4 - 187 4 - 187 - > ppp0* 1500 0 0 0 0 0 0 0 > sl0* 552 0 0 0 0 0 0 0 > > It is not counting the Outgoing packets or bytes on any /32 ip. > > I added the following to rc.conf which appeared to be what to do from > http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtuning-virtual-hosts.html > > ifconfig_rl0="inet 10.0.0.170 netmask 255.255.255.0" > ifconfig_rl0_alias0="inet 10.0.0.171 netmask 255.255.255.255" > ifconfig_rl0_alias1="inet 10.0.0.172 netmask 255.255.255.255" > ifconfig_rl0_alias2="inet 10.0.0.173 netmask 255.255.255.255" > ifconfig_rl0_alias3="inet 10.0.0.174 netmask 255.255.255.255" > ifconfig_rl0_alias4="inet 10.0.0.175 netmask 255.255.255.255" > > Everything else seems to be fine it is just not counting the outgoing packets > or bytes. Would some tell me what I missed? > It counts them, but not for the IP address in the IP datagram itself, but rather for IP address on an interfaces recorded with the corresponding route. For example, # ifconfig rl0 inet rl0: flags=8843 mtu 1500 inet 192.168.4.115 netmask 0xffffff00 broadcast 192.168.4.255 inet 192.168.4.200 netmask 0xffffff00 broadcast 192.168.4.255 # route -vn get 192.168.4.65 [...] sockaddrs: 192.168.4.65 0.d0.b7.16.9c.c6 rl0:0.c0.df.3.2d.79 192.168.4.115 ^^^^^^^^^^^^^ The both `ping -S 192.168.4.115 192.168.4.65' and `ping -S 192.168.4.200 192.168.4.65' will count them for 192.168.4.115. If you change your route like this: # route change 192.168.4.65 -ifa 192.168.4.200 # route -vn get 192.168.4.65 [...] sockaddrs: 192.168.4.65 0.d0.b7.16.9c.c6 rl0:0.c0.df.3.2d.79 192.168.4.200 both pings will be counted for 192.168.4.200. The behavior becomes more clear when you consider the case of raw IP packet (which can have an arbitrarily source IP address), or the gateway host forwarding a packet from the attached network. I agree this is confusing. Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message