/proc/net/tcp
shows information about active TCP connections.
The output can look something like this.
$ cat /proc/net/tcp
sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode
0: 0100007F:0019 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 20580 1 ffff925f74dcdf00 100 0 0 10 0
1: 0100007F:00C7 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 20008 1 ffff925f74dccf80 100 0 0 10 0
2: 00000000:0CEA 00000000:0000 0A 00000000:00000000 00:00000000 00000000 27 0 20932 1 ffff925f74dce6c0 100 0 0 10 0
3: 00000000:0016 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 19434 1 ffff925f74dcc000 100 0 0 10 0
4: 0143060A:0016 8912020A:C3E6 01 00000000:00000000 02:00098F13 00000000 0 0 540616574 4 ffff925e7a7d5f00 20 8 29 10 -1
sl
is just the number of the Entry.local_address
is the local IPv4 address and the Port separated by a colon. It is written in hex.remote_address
is the remote IPv4 address and the Port separated by a colon. It is written in hex.st
is the state of the connection.0A
means listening on the socket.01
shows a established connection.
Convert Hex IP to Decimal
The IP Addresses are written in hex. You may want to convert them to decimal.
$ printf '%d.%d.%d.%d\n' $(echo <hex-ip> | sed 's/../0x& /g')
1.67.6.10
This will give you the Decimal-Address in reversed order. so 1.67.6.10
should be 10.6.67.1
.