Linux下的ping命令支援中間顯示簡短統計資料
使用Linux的ping命令時,在ping的過程中,如果想看簡要統計資料,可以按Ctrl+| (不是I鍵,是豎線鍵)
http://www.think-lamp.com/2009/03/the-hidden-power-of-ping/
ipg: InterPacket Gap (measured in seconds)
64 bytes from yo-in-f99.google.com (64.233.169.99): icmp_seq=29 ttl=245 (truncated) --- www.l.google.com ping statistics --- 30 packets transmitted, 30received, 0% packet loss, time 540ms rtt min/avg/max/mdev = 7.560/7.996/8.609/0.257 ms, ipg/ewma 18.632/7.945 ms
The Inter-packet gap (or the inter-frame gap) is an idle time period appended to the end of every frame by the ethernet adapter. This idle time gives the network media a chance to stabilize, and other network components time to process the frame. On specifying
the i0 or the -f switch in ping we can get the output resulting ping statistics which gives the current ipg of the system.
The minimum interframe gap is 96 bit times (the time it takes to transmit 96 bits of raw data on the medium), which is
9.6 μs for 10 Mbit/s Ethernet,
960 ns for 100 Mbit/s (fast) Ethernet,
96 ns for 1 Gbit/s (gigabit) Ethernet, and
9.6 ns for 10 Gbit/s (10 gigabit) Ethernet.
This is the minimum gap as specified in Ethernet protocol and required for a non-colliding transmission. There are ways to reduce it for a faster UDP transmissions, but can cause heavy collisions if other devices ( client and server ) aren’t able to handle
the high rate of transmission.
In ideal situations for a 10 Mbps line and 9.6 μs of IFG the loss is 14.28%
ewma: Exponential Weighted Moving Average (measured in seconds)
Estimated packet rate is used to identify abnormal activities and attacks. The ethernet adapter estimates the arrival of the next packet based on the information of previous packet. If the packet time is more it will go to sleep (saving power).
Although I want to I cannot talk a lot about EWMA as it is beyond the scope of this article, but on aproduction
system A quick look at the rtt and ewma will tell you if something is wrong. rtt ~ ewma for regular case.
During operations, the effective idletime is measured using an exponential weighted moving average (EWMA), which considers recent packets to be exponentially more important than past ones. The Unix loadaverage is calculated in the same way.
The calculated idle time is subtracted from the EWMA measured one, the resulting number is called ‘avgidle’. A perfectly loaded link has an avgidle of zero: packets arrive exactly at the calculated interval.