Dave Taylor
2003-01-27 16:25:16 UTC
I'm working on some shell scripts for a new book I'm writing for O'Reilly &
Associates, and am stalled out on a script that analyzes netstat output.
It's a two part script: the first is run every 10 minutes from cron and logs
current net activity, then the second will ostensibly analyze the output to
highlight anything odd or curious happening. What is tripping me up is that
I really don't understand netstat output well enough and am hoping someone
on this list can illuminate it for me. I'm happy to share the resultant
script(s) back on the list if there's interest.
1. What are the different tcp devices shown?
$ netstat -d -I en0
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs
Coll Drop
en0 1500 <Link#5> 00:30:65:3d:e8:10 11538 638 9629 0
0 0
en0 1500 fe80:5::230 fe80:5::230:65ff: 11538 - 9629 -
- -
en0 1500 192.168.1 192.168.1.105 11538 - 9629 -
- -
en0 1500 (16)00:00:ff:be:76 11538 638 9629 0
0 0
I can see that there are input errors here, but on what devices? I assume
that only the device associated with my real IP is non-LAN traffic: am I
wrong?
2. What's the meaning of the various lines of output of ...
lines I think are important are highlighted in red
OSX $ netstat -s -p tcp
tcp:
26784 packets sent
20573 data packets (2822503 bytes)
7 data packets (4861 bytes) retransmitted
0 resends initiated by MTU discovery
3013 ack-only packets (1421 delayed)
0 URG only packets
0 window probe packets
1719 window update packets
1472 control packets
29101 packets received
12376 acks (for 2823103 bytes)
460 duplicate acks
0 acks for unsent data
26368 packets (8456463 bytes) received in-sequence
10 completely duplicate packets (3217 bytes)
0 old duplicate packets
0 packets with some dup. data (0 bytes duped)
123 out-of-order packets (77469 bytes)
0 packets (0 bytes) of data after window
0 window probes
22 window update packets
0 packets received after close
0 discarded for bad checksums
0 discarded for bad header offset fields
0 discarded because packet too short
711 connection requests
72 connection accepts
1 bad connection attempt
0 listen queue overflows
770 connections established (including accepts)
975 connections closed (including 155 drops)
9 connections updated cached RTT on close
9 connections updated cached RTT variance on close
4 connections updated cached ssthresh on close
6 embryonic connections dropped
12362 segments updated rtt (of 12349 attempts)
23 retransmit timeouts
0 connections dropped by rexmit timeout
0 persist timeouts
0 connections dropped by persist timeout
14 keepalive timeouts
0 keepalive probes sent
0 connections dropped by keepalive
653 correct ACK header predictions
15812 correct data packet header predictions
What I'm trying to do is to have the script show when you're seeing problems
(too many collisions, too many bad connection requests, etc) on your system,
but I'm, um, operating a bit in the dark. Let me ask this another way too,
perhaps: if you wanted to track your network performance, what would you
track, how would you do it, and how would you interpret the results? (for
example, 711 connection requests versus 72 connection accepts suggests that
there are a lot of incoming requests rejected by my firewall, yes?)
Thanks!!!
Dave Taylor
ps: I'm also looking for both some xferlog files that include anon ftp
transactions for analysis. Anyone have something they can share?
Associates, and am stalled out on a script that analyzes netstat output.
It's a two part script: the first is run every 10 minutes from cron and logs
current net activity, then the second will ostensibly analyze the output to
highlight anything odd or curious happening. What is tripping me up is that
I really don't understand netstat output well enough and am hoping someone
on this list can illuminate it for me. I'm happy to share the resultant
script(s) back on the list if there's interest.
1. What are the different tcp devices shown?
$ netstat -d -I en0
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs
Coll Drop
en0 1500 <Link#5> 00:30:65:3d:e8:10 11538 638 9629 0
0 0
en0 1500 fe80:5::230 fe80:5::230:65ff: 11538 - 9629 -
- -
en0 1500 192.168.1 192.168.1.105 11538 - 9629 -
- -
en0 1500 (16)00:00:ff:be:76 11538 638 9629 0
0 0
I can see that there are input errors here, but on what devices? I assume
that only the device associated with my real IP is non-LAN traffic: am I
wrong?
2. What's the meaning of the various lines of output of ...
lines I think are important are highlighted in red
OSX $ netstat -s -p tcp
tcp:
26784 packets sent
20573 data packets (2822503 bytes)
7 data packets (4861 bytes) retransmitted
0 resends initiated by MTU discovery
3013 ack-only packets (1421 delayed)
0 URG only packets
0 window probe packets
1719 window update packets
1472 control packets
29101 packets received
12376 acks (for 2823103 bytes)
460 duplicate acks
0 acks for unsent data
26368 packets (8456463 bytes) received in-sequence
10 completely duplicate packets (3217 bytes)
0 old duplicate packets
0 packets with some dup. data (0 bytes duped)
123 out-of-order packets (77469 bytes)
0 packets (0 bytes) of data after window
0 window probes
22 window update packets
0 packets received after close
0 discarded for bad checksums
0 discarded for bad header offset fields
0 discarded because packet too short
711 connection requests
72 connection accepts
1 bad connection attempt
0 listen queue overflows
770 connections established (including accepts)
975 connections closed (including 155 drops)
9 connections updated cached RTT on close
9 connections updated cached RTT variance on close
4 connections updated cached ssthresh on close
6 embryonic connections dropped
12362 segments updated rtt (of 12349 attempts)
23 retransmit timeouts
0 connections dropped by rexmit timeout
0 persist timeouts
0 connections dropped by persist timeout
14 keepalive timeouts
0 keepalive probes sent
0 connections dropped by keepalive
653 correct ACK header predictions
15812 correct data packet header predictions
What I'm trying to do is to have the script show when you're seeing problems
(too many collisions, too many bad connection requests, etc) on your system,
but I'm, um, operating a bit in the dark. Let me ask this another way too,
perhaps: if you wanted to track your network performance, what would you
track, how would you do it, and how would you interpret the results? (for
example, 711 connection requests versus 72 connection accepts suggests that
there are a lot of incoming requests rejected by my firewall, yes?)
Thanks!!!
Dave Taylor
ps: I'm also looking for both some xferlog files that include anon ftp
transactions for analysis. Anyone have something they can share?