Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Oct 2001 13:56:45 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
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>
In-Reply-To: <3BBA0D10.3FA53C30@usww.com>; from unix@usww.com on Tue, Oct 02, 2001 at 02:53:04PM -0400
References:  <3BBA0D10.3FA53C30@usww.com>

next in thread | previous in thread | raw e-mail | index | archive | help
[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  <Link#1>    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  <Link#2>    00:50:bf:16:15:50        0     0          0        0     0          0     0
> rl2*  1500  <Link#3>    00:50:bf:16:15:5f        0     0          0        0     0          0     0
> rl3*  1500  <Link#4>    00:48:54:1e:b7:81        0     0          0        0     0          0     0
> rl4*  1500  <Link#5>    00:50:ba:42:7f:be        0     0          0        0     0          0     0
> lp0*  1500  <Link#6>                             0     0          0        0     0          0     0
> lo0   16384 <Link#7>                             4     0        187        4     0        187     0
> lo0   16384 127           127.0.0.1              4     -        187        4     -        187     -
> ppp0* 1500  <Link#8>                             0     0          0        0     0          0     0
> sl0*  552   <Link#9>                             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<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> 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: <DST,GATEWAY,IFP,IFA>
 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: <DST,GATEWAY,IFP,IFA>
 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011004135645.E48758>