カテゴリ:

Ciscoルータを利用中、Linuxでよく使うnetstatはないんだっけと思うことがよくあります。そんな時にshow tcpコマンドは近い感じです。

R1#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            12.12.12.1      YES manual up                    up
Loopback0                  17.17.1.1       YES NVRAM  up                    up

R2#sh ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            12.12.12.2      YES manual up                    up
Loopback0                  17.17.2.2       YES NVRAM  up                    up

R1とR2があり、R1からR2に対してtelnet接続を行います。

R1#telnet 12.12.12.2
Trying 12.12.12.2 ... Open

User Access Verification

Password:
R2>

接続が完了したら、show tcp briefコマンドを実行してみます。netstat -tみたいな感じですね。

R2#show tcp brief
TCB       Local Address               Foreign Address             (state)
6738A76C  12.12.12.2.23               12.12.12.1.27603            ESTAB

ここに表示されるTCB(Transmission Control Block)を指定すると詳細の表示となります。

R2#show tcp tcb 6738A76C
Connection state is ESTAB, I/O status: 1, unread input bytes: 0
Connection is ECN Disabled, Mininum incoming TTL 0, Outgoing TTL 255
Local host: 12.12.12.2, Local port: 23
Foreign host: 12.12.12.1, Foreign port: 27603
Connection tableid (VRF): 0

Enqueued packets for retransmit: 0, input: 0  mis-ordered: 0 (0 bytes)

Event Timers (current time is 0x1DFDC0):
Timer          Starts    Wakeups            Next
Retrans            75          0             0x0
TimeWait            0          0             0x0
AckHold            76          4             0x0
SendWnd             0          0             0x0
KeepAlive           0          0             0x0
GiveUp              0          0             0x0
PmtuAger            0          0             0x0
DeadWait            0          0             0x0
Linger              0          0             0x0
ProcessQ            0          0             0x0

iss:  732715540  snduna:  732720033  sndnxt:  732720033     sndwnd:   3023
irs:  636591890  rcvnxt:  636592009  rcvwnd:       4010  delrcvwnd:    118

SRTT: 300 ms, RTTO: 303 ms, RTV: 3 ms, KRTT: 0 ms
minRTT: 12 ms, maxRTT: 300 ms, ACK hold: 200 ms
Status Flags: passive open, active open
Option Flags: 0x400000
IP Precedence value : 6

Datagrams (max data segment is 1460 bytes):
Rcvd: 135 (out of order: 0), with data: 80, total data bytes: 118
Sent: 103 (retransmit: 0, fastretransmit: 0, partialack: 0, Second Congestion: 0), with data: 98, total data bytes: 4492
Packets received in fast path: 0, fast processed: 0, slow path: 0
Packets send in fast path: 0
fast lock acquisition failures: 0, slow path: 0

show tcp statisticsというコマンドもあります。

R2#show tcp statistics
Rcvd: 217 Total, 0 no port
      0 checksum error, 0 bad offset, 0 too short
      133 packets (246 bytes) in sequence
      0 dup packets (0 bytes)
      0 partially dup packets (0 bytes)
      0 out-of-order packets (0 bytes)
      0 packets (0 bytes) with data after window
      0 packets after close
      0 window probe packets, 2 window update packets
      3 dup ack packets, 0 ack packets with unsend data
      112 ack packets (4973 bytes)
Sent: 166 Total, 0 urgent packets
      7 control packets (including 0 retransmitted)
      142 data packets (4966 bytes)
      0 data packets (0 bytes) retransmitted
      0 data packets (0 bytes) fastretransmitted
      17 ack only packets (14 delayed)
      0 window probe packets, 0 window update packets
0 Connections initiated, 4 connections accepted, 4 connections established
3 Connections closed (including 0 dropped, 0 embryonic dropped)
0 Total rxmt timeout, 0 connections dropped in rxmt timeout
0 Keepalive timeout, 0 keepalive probe, 0 Connections dropped in keepalive