Viewing Traffic Statistics on an Interface

Problem

You want to check how much traffic is passing through an interface.

Solution

The show interfaces extensive command shows detailed statistics about the traffic on an interface:

	aviva@router1# show interfaces extensive fe-0/0/0

 

Discussion

When you need to get traffic statistics about an interface, use either the show interfaces extensive command for maximal information or the show interfaces detail for a slightly abridged view. The extensive version displays quite a bit of information. Again, the specifics of the output vary depending on the interface type. Here is the relevant output for a Fast Ethernet interface:

	aviva@router1> show interfaces extensive fe-0/0/0
	…
	Traffic statistics:
	 Input bytes : 302512 672 bps
	 Output bytes : 0 0 bps
	 Input packets : 2081 0 pps
	 Output packets : 0 0 pps
	 Input errors:
	 Errors: 0, Drops: 0, Framing errors: 0, Runts: 0, Policed discards: 0,
	 L3 incompletes: 1682, L2 channel errors: 0, L2 mismatch timeouts: 0,
	 FIFO errors: 0, Resource errors: 0
	 Output errors:
	 Carrier transitions: 1, Errors: 0, Drops: 0, Collisions: 0, Aged packets: 0,
	 FIFO errors: 0, HS link CRC errors: 0, MTU errors: 0, Resource errors: 0
	 Queue counters: Queued packets Transmitted packets Dropped packets
	 0 best-effort 0 0 0
	 1 expedited-fo 0 0 0
	 2 assured-forw 0 0 0
	 3 network-cont 0 0 0
	 Active alarms : None
	 Active defects : None
	 MAC statistics: Receive Transmit
	 Total octets 466604 0
	 Total packets 3763 0
	 Unicast packets 0 0
	 Broadcast packets 1686 0
	 Multicast packets 2077 0
	 CRC/Align errors 0 0
	 FIFO errors 0 0
	 MAC control frames 0 0
	 MAC pause frames 0 0
	 Oversized frames 0
	 Jabber frames 0
	 Fragment frames 0
	 VLAN tagged frames 0
	 Code violations 0
	 Filter statistics:
	 Input packet count 3763
	 Input packet rejects 0
	 Input DA rejects 1682
	 Input SA rejects 0
	 Output packet count 0
	 Output packet pad count 0
	 Output packet error count 0
	 CAM destination filters: 5, CAM source filters: 0

The traffic statistics show input and output counters in both bytes and packets. You then see errors and counters specific for this Fast Ethernet interface.

The show interfaces extensive command takes a snapshot in time of the traffic statistics. To watch the traffic in real time, use the monitor interface command. This can be very useful when you are watching traffic flow through the interfaces or are tracking down a traffic flow issue. This command is just the FreeBSD iftop utility. Again, what you see depends on the type of interface. Here's the sample for the same Fast Ethernet interface:

	aviva@router1> monitor interface fe-0/0/0
	router1 Seconds: 134 Time: 16:35:302
	 Delay: 2/0/9
	Interface: fe-0/0/0, Enabled, Link is Up
	Encapsulation: Ethernet, Speed: 100mbps
	Traffic statistics: Current delta
	 Input bytes: 304124 (672 bps) [892]
	 Output bytes: 0 (0 bps) [0]
	 Input packets: 2092 (0 pps) [6]
	 Output packets: 0 (0 pps) [0]
	Error statistics:
	 Input errors: 0 [0]
	 Input drops: 0 [0]
	 Input framing errors: 0 [0]
	 Policed discards: 0 [0]
	 L3 incompletes: 1691 [5]
	 L2 channel errors: 0 [0]
	 L2 mismatch timeouts: 0 [0]
	 Carrier transitions: 1 [0]
	 Output errors: 0 [0]
	 Output drops: 0 [0]
	 Aged packets: 0 [0]
	Active alarms : None
	Active defects: None
	Input MAC/Filter statistics:
	 Unicast packets 0 [0]
	 Broadcast packets 1695 [5]
	 Multicast packets 2088 [6]
	 Oversized frames 0 [0]
	 Packet reject count 0 [0]
	 DA rejects 1691 [5]
	 SA rejects 0 [0]
	Output MAC/Filter Statistics:
	 Unicast packets 0 [0]
	 Broadcast packets 0 [0]
	 Multicast packets 0 [0]
	 Packet pad count 0 [0]
	 Packet error count 0 [0]
	Next='n', Quit='q' or ESC, Freeze='f', Thaw='t', Clear='c', Interface='i'

The output updates every second, so you can see we've been watching for 134 seconds and the current time is 16:35. The second line shows the delay, which is how many milliseconds it took to display the statistics. The first number, here 2, is the time difference for the currently displayed statistics. The second number, here 0, is the shortest time difference since the monitoring started, and the third number, here 9, is the longest time difference since monitoring started.

The next two lines briefly describe the interface. The traffic and error statistics and the active alarm and defects sections parallel the fields in the show interfaces extensive command output. The input and output MAC/filter statistics show some of the information that's in the MAC and filter statistics sections of the show command output.

The bottom line contains commands you can issue. You can scroll through all the router's interfaces (Next='n')they appear in the same order as in the show interfaces terse commandor you can name a specific interface to display (Interface='i'):

	New interface:
	Next='n', Quit='q' or ESC, Freeze='f', Thaw='t', Clear='c', Interface='i'

The remaining commands freeze (f) and unfreeze (t) the display, zero the statistics (c), and return to the CLI (q).

See Also

FreeBSD, http://www.freebsd.org/ports/net-mgmt.html


Router Configuration and File Management

Basic Router Security and Access Control

IPSec

SNMP

Logging

NTP

Router Interfaces

IP Routing

Routing Policy and Firewall Filters

RIP

IS-IS

OSPF

BGP

MPLS

VPNs

IP Multicast



JUNOS Cookbook
Junos Cookbook (Cookbooks (OReilly))
ISBN: 0596100140
EAN: 2147483647
Year: 2007
Pages: 290
Authors: Aviva Garrett

Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net