 |
|
Oracle Tips by Burleson |
Using netstat for Linux
Netstat is a generic UNIX and Linux utility that displays the
contents of various network-related structures in various formats.
These formats are determined by the options passed to the netstat
command.
Netstat is very good at telling you what is happening on the
network at the current time, but netstat does not give a good
trending capability or periodic snapshot functionality. Most network
administrators purchase a specialized third-party tool for long-term
network monitoring. Let's look at some of the network information
that netstat provides about the current state of the network.
# netstat
Proto Recv-Q Send-Q Local Address Foreign Address
State
tcp 0 0 donsrv1.rov:netbios-ssn
intranet.janet.com:1351 ESTABLISHED
tcp 0 0 donsrv1.janet.com:1120 sting.janet.com:ssh
TIME_WAIT
tcp 0 40 donsrv1.janet.com:ssh hpop3-
146.gloryroa:1096 ESTABLISHED
tcp 0 0 donsrv1.rov:netbios-ssn 192.168.1.105:1025
ESTABLISHED
tcp 0 0 donsrv1.janet.com:6010 donsrv1.janet.com:1104
CLOSE_WAIT
tcp 0 0 donsrv1.janet.com:6010 donsrv1.janet.com:1103
CLOSE_WAIT
tcp 0 0 donsrv1.janet.com:1023 grumpy.janet.com:ssh
ESTABLISHED
tcp 0 0 donsrv1.janet.com:ssh exodus-rtr-
2.arsdi:2195 ESTABLISHED
tcp 0 0 donsrv1.rov:netbios-ssn 192.168.1.107:1025
ESTABLISHED
tcp 0 0 donsrv1.rov:netbios-ssn 192.168.1.126:1030
ESTABLISHED
Active LINUX domain sockets (w/o servers)
Proto RefCnt Flags Type State I-Node
Path
linux 1 [ ] STREAM CONNECTED 741
@0000002a
linux 1 [ ] STREAM CONNECTED 745
@0000002b
linux 0 [ ] STREAM CONNECTED 182
@0000001a
linux 1 [ ] STREAM CONNECTED 763
@00000030
linux 8 [ ] DGRAM 397
/dev/log
linux 0 [ ] DGRAM 234471
linux 0 [ ] DGRAM 234252
linux 0 [ ] DGRAM 843
linux 1 [ ] STREAM CONNECTED 764
/tmp/.X11-unix/X0
linux 1 [ ] STREAM CONNECTED 746
/tmp/.font-unix/fs-1
linux 1 [ ] STREAM CONNECTED 748
/tmp/.X11-unix/X0
linux 0 [ ] DGRAM 654
linux 0 [ ] DGRAM 589
linux 0 [ ] DGRAM 560
linux 0 [ ] DGRAM 419
[oracle@donsrv1 oracle]$ netstat -sp tcp
Ip:
15753092 total packets received
1 with invalid headers
0 forwarded
0 incoming packets discarded
99397 incoming packets delivered
20325485 requests sent out
Icmp:
1041 ICMP messages received
37 input ICMP message failed.
ICMP input histogram:
destination unreachable: 972
timeout in transit: 31
echo requests: 27
echo replies: 11
490 ICMP messages sent
0 ICMP messages failed
ICMP output histogram:
destination unreachable: 463
echo replies: 27
Tcp:
131 active connections openings
0 passive connection openings
14 failed connection attempts
0 connection resets received
6 connections established
15652680 segments received
20276668 segments send out
6933 segments retransmited
2 bad segments received.
25 resets sent
Udp:
97289 packets received
11 packets to unknown port received.
3 packet receive errors
48279 packets sent
TcpExt:
9 packets pruned from receive queue because of socket
buffer overrun
linux 0 [ ] DGRAM
407
Hopefully, this brief description of the netstat utility will give
you an appreciation for the scope and complexity of network tuning.
In practice, an experienced Linux network administrator will have
specialized utilities such as Linux sniffers, that will monitor and
tune
network traffic.
The above book excerpt is from:
Easy Linux
Commands
Working Examples of Linux Command Syntax
ISBN:
0-9759135-0-6
Terry Clark
http://www.rampant-books.com/book_2005_1_linux_commands.htm |