On 01/05/11 06:04, goinsane wrote: > Hi, > > is there a way to catch interface statistics as bytes xfered of logical > interfaces? I found the physical ones in kstat. But netstat -ai display also > logical interfaces (running in a zone in this case). I've tried to find out > where netstat gets those values from, but I've still no glue. It uses kstat > and does several actions with it, but how it gets the values?
The answer is essentially "no." Logical interfaces are just Solaris's way of representing configured IP addresses on an interface, the same as "alias" addresses on other OSes. Actual packet input and output (including routing) occurs using the IP layer physical interfaces, and that's where the accounting is done. A bit of thought about the situation shows why it'd be ugly to implement what you're suggesting. Consider a system with 10.0.0.1/24 configured on bge0 and 172.16.0.1/24 on bge0:1, and suppose we have a default route (0/0) pointing to 10.0.0.1 on bge0. If an application binds local address 172.16.0.1 and sends a packet to 192.168.0.1, what happens? The system will look up 192.168.0.1, and find that it matches the default route, so it'll send the packet towards 10.0.0.1 via bge0. But the source address is on bge0:1. Which one "counts" for output? Or should the system count this packet twice? Now consider the return flight. A reply packet comes in from 192.168.0.1 to 172.16.0.1. Should that count as going to bge0:1? Or as coming in on bge0? Or both? If what you're looking for is accounting data, there are other mechanisms to get that; see acctadm(1M). If you're looking for traffic analysis, I'd suggest wireshark. If you're looking for something else, then you should probably provide more details on the problem you're trying to solve. -- James Carlson 42.703N 71.076W <[email protected]> _______________________________________________ networking-discuss mailing list [email protected]
