How to identify the open ports on a router

There are a couple of ways of going about it. Let’s list the commands by the OS type.

  • IOS
  • IOS XE
  • IOS XR
  • JUNOS

P#show control-plane host open-ports
Active internet connections (servers and established)
Prot               Local Address             Foreign Address                  Service    State
 tcp                        *:23                         *:0                   Telnet   LISTEN
 tcp                       *:646               3.3.3.3:48989                      LDP ESTABLIS
 tcp                     *:62108                 1.1.1.1:646         IOS host service ESTABLIS
 udp                      *:3503                         *:0                LSPV Echo   LISTEN

P#
ro-b-pe01#sh tcp brief
TCB       Local Address               Foreign Address             (state)
7FF7ED7DCE20  10.10.255.3.18579          10.10.255.1.179             ESTAB
7FF7ED758AC8  10.10.255.3.34820          10.10.255.2.646             ESTAB
7FF7ED78E530  10.10.255.3.179            10.10.255.2.38666           ESTAB
7FF7ED757848  10.10.255.3.14828          10.10.255.1.646             ESTAB

ro-b-pe01#sh ip sockets
Proto        Remote      Port      Local       Port  In Out  Stat TTY OutputIF
 17       --listen--          10.10.255.3       646   0   0 2000001   0
 17       --listen--          10.10.255.3      3503   0   0 2000001   0
ro-b-pe01#
RP/0/0/CPU0:ro-isp-rr01#sh tcp brief
Wed Aug 23 00:03:16.786 UTC
   PCB     VRF-ID     Recv-Q Send-Q Local Address          Foreign Address        State
0x1215a64c 0x60000000      0      0  :::179                 :::0                   LISTEN
0x12156e94 0x00000000      0      0  :::179                 :::0                   LISTEN
0x1214c990 0x60000000      0      0  :::0                   :::0                   CLOSED
0x121490cc 0x00000000      0      0  :::0                   :::0                   CLOSED
0x1216304c 0x60000000      0      0  10.10.255.10:36385     10.10.255.1:179        ESTAB
0x1215efe0 0x60000000      0      0  10.10.255.10:29906     10.10.255.2:646        ESTAB
0x121643c8 0x60000000      0      0  10.10.255.10:16369     10.10.255.2:179        ESTAB
0x1215aca8 0x60000000      0      0  10.10.255.10:26965     10.10.255.1:646        ESTAB
0x1216ff18 0x60000000      0      0  10.10.255.10:19318     10.40.255.2:179        ESTAB
0x1213cc98 0x60000000      0      0  0.0.0.0:646            0.0.0.0:0              LISTEN
0x1213c3d4 0x00000000      0      0  0.0.0.0:646            0.0.0.0:0              LISTEN
0x12156acc 0x60000000      0      0  0.0.0.0:179            0.0.0.0:0              LISTEN
0x1215205c 0x00000000      0      0  0.0.0.0:179            0.0.0.0:0              LISTEN
0x1214db04 0x00000000      0      0  0.0.0.0:0              0.0.0.0:0              CLOSED

RP/0/0/CPU0:ro-isp-rr01#sh udp brief
Wed Aug 23 00:03:21.996 UTC
   PCB     VRF-ID     Recv-Q Send-Q  Local Address          Foreign Address
0x12087e50 0x00000000      0      0  :::0                   :::0
0x12080424 0x00000000      0      0  :::0                   :::0
0x12084dd0 0x60000000      0      0  0.0.0.0:646            0.0.0.0:0
0x120849f0 0x00000000      0      0  0.0.0.0:646            0.0.0.0:0
0x120842d4 0x00000000      0      0  0.0.0.0:0              0.0.0.0:0
0x12080128 0x00000000      0      0  0.0.0.0:0              0.0.0.0:0
0x1207fb60 0x00000000      0      0  0.0.0.0:0              0.0.0.0:0
0x1207c464 0x00000000      0      0  0.0.0.0:0              0.0.0.0:0
RP/0/0/CPU0:ro-isp-rr01#

Add your content here…

root@ro-is-rr02> show system connections
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address                Foreign Address                (state)
tcp4       0      0  10.40.255.2.179              10.10.255.10.19318             ESTABLISHED
tcp4       0      0  10.40.255.2.59941            10.10.255.2.646                ESTABLISHED
tcp4       0      0  128.0.0.4.9000               128.0.0.4.63467                ESTABLISHED
tcp4       0      0  128.0.0.4.63467              128.0.0.4.9000                 ESTABLISHED
tcp46      0      0  *.179                        *.*                            LISTEN
tcp4       0      0  *.179                        *.*                            LISTEN
tcp4       0      0  127.0.0.1.61256              127.0.0.1.2606                 ESTABLISHED
tcp4       0      0  *.32003                      *.*                            LISTEN
tcp4       0      0  *.646                        *.*                            LISTEN
tcp4       0      0  *.51627                      *.*                            LISTEN
tcp4       0      0  *.6152                       *.*                            LISTEN
tcp4       0      0  *.23                         *.*                            LISTEN
tcp4       0      0  *.514                        *.*                            LISTEN
										  
udp46      0      0  *.514                        *.*
udp4       0      0  *.514                        *.*
udp4       0      0  *.*                          *.*
udp4       0      0  *.*                          *.*

For more information, when someone uses the ‘show tcp brief’ command, they can use the ‘show tcp tcb tcb_number’ command.

ro-b-rr01#sh tcp brief
TCB       Local Address               Foreign Address             (state)
65AF595C  10.10.255.1.29901           10.10.255.4.179              ESTAB
65B131C4  10.10.255.1.646             10.10.255.10.61379           ESTAB
65B124A8  10.10.255.1.179             10.10.255.10.32547           ESTAB
65AF41B8  10.10.255.1.646             10.10.255.4.47222            ESTAB
681AB1E8  10.10.255.1.646             10.10.255.2.53071            ESTAB

ro-b-rr01#sh tcp tcb 65AF595C
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: 10.10.255.1, Local port: 29901
Foreign host: 10.10.255.4, Foreign port: 179
Connection tableid (VRF): 0

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

Event Timers (current time is 0x753F8):
Timer          Starts    Wakeups            Next
Retrans             8          0             0x0
TimeWait            0          0             0x0
AckHold             8          7             0x0
SendWnd             0          0             0x0
KeepAlive           0          0             0x0
GiveUp              0          0             0x0
PmtuAger            1          0         0xBEB68
DeadWait            0          0             0x0
Linger              0          0             0x0

iss: 1153422846  snduna: 1153423167  sndnxt: 1153423167     sndwnd:  16064
irs: 2640728826  rcvnxt: 2640729166  rcvwnd:      16045  delrcvwnd:    339

SRTT: 197 ms, RTTO: 984 ms, RTV: 787 ms, KRTT: 0 ms
minRTT: 4 ms, maxRTT: 300 ms, ACK hold: 200 ms
Status Flags: none
Option Flags: higher precendence, nagle, path mtu capable

Datagrams (max data segment is 1436 bytes):
Rcvd: 17 (out of order: 0), with data: 9, total data bytes: 339
Sent: 17 (retransmit: 0 fastretransmit: 0),with data: 8, total data bytes: 320

ro-b-rr01#

Same deal for IOS XR. The command slightly differs: ‘show udp detail pcb pcb_number’. Same logic for TCP.

RP/0/0/CPU0:ro-isp-rr01#show udp brief
Thu Aug 24 21:10:09.307 UTC
   PCB     VRF-ID     Recv-Q Send-Q  Local Address          Foreign Address
0x1207cc14 0x00000000      0      0  :::0                   :::0
0x12078578 0x00000000      0      0  :::0                   :::0
0x1207ba54 0x60000000      0      0  0.0.0.0:646            0.0.0.0:0
0x1207bf70 0x00000000      0      0  0.0.0.0:646            0.0.0.0:0
0x12077a14 0x00000000      0      0  0.0.0.0:0              0.0.0.0:0
0x1207463c 0x00000000      0      0  0.0.0.0:0              0.0.0.0:0
0x12077844 0x00000000      0      0  0.0.0.0:0              0.0.0.0:0
0x12074064 0x00000000      0      0  0.0.0.0:0              0.0.0.0:0

RP/0/0/CPU0:ro-isp-rr01#show udp detail pcb 0x1207ba54
Thu Aug 24 21:10:25.516 UTC

===============================================
PCB is 0x1207ba54, Family: 2, VRF: 0x60000000
 Local host: 0.0.0.0:646 (Local App PID: 663796)
 Foreign host: 0.0.0.0:0

Current send queue size: 0
Current receive queue size: 0
RP/0/0/CPU0:ro-isp-rr01#

Leave a Comment