Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #27697 > unrolled thread

netstat and ss

Started byruben safir <ruben@mrbrklyn.com>
First post2019-07-20 00:01 -0400
Last post2019-07-21 09:45 +0200
Articles 5 — 2 participants

Back to article view | Back to comp.os.linux.misc


Contents

  netstat and ss ruben safir <ruben@mrbrklyn.com> - 2019-07-20 00:01 -0400
    Re: netstat and ss Pascal Hambourg <pascal@plouf.fr.eu.org> - 2019-07-20 10:10 +0200
      Re: netstat and ss ruben safir <ruben@mrbrklyn.com> - 2019-07-20 19:23 -0400
        Re: netstat and ss ruben safir <ruben@mrbrklyn.com> - 2019-07-20 19:24 -0400
          Re: netstat and ss Pascal Hambourg <pascal@plouf.fr.eu.org> - 2019-07-21 09:45 +0200

#27697 — netstat and ss

Fromruben safir <ruben@mrbrklyn.com>
Date2019-07-20 00:01 -0400
Subjectnetstat and ss
Message-ID<qgu3pe$8pe$2@reader2.panix.com>
I always used netstat and reading the  man page I see it is now saying that it is being replaced by ss.  ss seems to behave weirdly though. I am running apache and it is not showing up as listening:

Code: [Select]

[www3 ~]# ss -aptls4n
Total: 171
TCP:   17 (estab 8, closed 1, orphaned 0, timewait 0)

Transport Total     IP        IPv6
RAW       0         0         0       
UDP       24        16        8       
TCP       16        13        3       
INET      40        29        11      
FRAG      0         0         0       

State         Recv-Q        Send-Q               Local Address:Port               Peer Address:Port                                                                                                                          
LISTEN        0             0                        127.0.0.1:953                     0.0.0.0:*           users:(("named",pid=2824,fd=22))                                                                                  
LISTEN        0             0                          0.0.0.0:25                      0.0.0.0:*           users:(("smtpd",pid=27093,fd=6),("smtpd",pid=27051,fd=6),("smtpd",pid=27049,fd=6),("master",pid=2731,fd=13))      
LISTEN        0             0                        10.0.0.37:2222                    0.0.0.0:*           users:(("sshd",pid=2958,fd=3))                                                                                    
LISTEN        0             0                        10.0.0.37:53                      0.0.0.0:*           users:(("named",pid=2824,fd=25))                                                                                  
LISTEN        0             0                      96.57.23.83:53                      0.0.0.0:*           users:(("named",pid=2824,fd=24))                                                                                  
LISTEN        0             0                        127.0.0.1:53                      0.0.0.0:*           users:(("named",pid=2824,fd=23))                                                                                  
[www3 ~]#



with ip6 it shows up. 

Code: [Select]

[www3 ~]# ss -aptlsn6
Total: 171
TCP:   17 (estab 7, closed 1, orphaned 1, timewait 0)

Transport Total     IP        IPv6
RAW       0         0         0       
UDP       24        16        8       
TCP       16        13        3       
INET      40        29        11      
FRAG      0         0         0       

State                         Recv-Q                        Send-Q                                                Local Address:Port                                                 Peer Address:Port                                                                                                                                                                                                                                                     
LISTEN                        0                             0                                                                 *:80                                                              *:*                            users:(("/usr/local/apac",pid=27020,fd=4),("/usr/local/apac",pid=26994,fd=4),("/usr/local/apac",pid=26990,fd=4),("/usr/local/apac",pid=26867,fd=4),("/usr/local/apac",pid=26525,fd=4),("/usr/local/apac",pid=26507,fd=4),("/usr/local/apac",pid=26504,fd=4),("/usr/local/apac",pid=26204,fd=4),("/usr/local/apac",pid=25920,fd=4),("/usr/local/apac",pid=23430,fd=4),("/usr/local/apac",pid=13542,fd=4))
LISTEN                        0                             0                                                                 *:53                                                              *:*                            users:(("named",pid=2824,fd=21))                                                                                                                                                                                            
[www3 ~]#


if shows up with netstat

Code: [Select]

[www3 ~]# ss -aptlsn6
Total: 171
TCP:   17 (estab 7, closed 1, orphaned 1, timewait 0)

Transport Total     IP        IPv6
RAW       0         0         0       
UDP       24        16        8       
TCP       16        13        3       
INET      40        29        11      
FRAG      0         0         0       

State                         Recv-Q                        Send-Q                                                Local Address:Port                                                 Peer Address:Port                                                                                                                                                                                                                                                     
LISTEN                        0                             0                                                                 *:80                                                              *:*                            users:(("/usr/local/apac",pid=27020,fd=4),("/usr/local/apac",pid=26994,fd=4),("/usr/local/apac",pid=26990,fd=4),("/usr/local/apac",pid=26867,fd=4),("/usr/local/apac",pid=26525,fd=4),("/usr/local/apac",pid=26507,fd=4),("/usr/local/apac",pid=26504,fd=4),("/usr/local/apac",pid=26204,fd=4),("/usr/local/apac",pid=25920,fd=4),("/usr/local/apac",pid=23430,fd=4),("/usr/local/apac",pid=13542,fd=4))
LISTEN                        0                             0                                                                 *:53                                                              *:*                            users:(("named",pid=2824,fd=21))                                                                                                                                                                                            
[www3 ~]# netstat -tapvWenof
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode      PID/Program name     Timer
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      0          19935      2824/named           off (0.00/0/0)
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      0          19760      2731/master          off (0.00/0/0)
tcp        0      0 10.0.0.37:2222          0.0.0.0:*               LISTEN      0          15332      2958/sshd            off (0.00/0/0)
tcp        0      0 10.0.0.37:53            0.0.0.0:*               LISTEN      0          19933      2824/named           off (0.00/0/0)
tcp        0      0 96.57.23.83:53          0.0.0.0:*               LISTEN      0          19928      2824/named           off (0.00/0/0)
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      0          19923      2824/named           off (0.00/0/0)
tcp        0      0 96.57.23.83:25          37.49.225.24:5875       ESTABLISHED 73         3053913    27051/smtpd          keepalive (6902.57/0/0)
tcp        0      0 96.57.23.83:25          37.49.225.24:7251       ESTABLISHED 73         3055657    27049/smtpd          keepalive (6910.32/0/0)
tcp        0      0 96.57.23.83:25          37.49.225.24:8407       ESTABLISHED 73         3054927    27093/smtpd          keepalive (6954.37/0/0)
tcp        0    220 10.0.0.37:2222          10.0.0.62:33312         ESTABLISHED 0          3049257    26836/sshd: root@pt  on (0.21/0/0)
tcp        0      0 10.0.0.37:2222          10.0.0.62:60328         ESTABLISHED 0          2893509    13149/sshd: root@pt  keepalive (514.74/0/0)
tcp        0      0 10.0.0.37:2222          10.0.0.62:50142         ESTABLISHED 0          25466      3298/sshd: ruben [p  keepalive (3177.14/0/0)
tcp        0      0 10.0.0.37:2222          10.0.0.62:50446         ESTABLISHED 0          53953      15315/sshd: root@pt  keepalive (6740.66/0/0)
tcp6       0      0 :::80                   :::*                    LISTEN      0          142886     13542/httpd          off (0.00/0/0)
tcp6       0      0 :::53                   :::*                    LISTEN      0          19916      2824/named           off (0.00/0/0)
tcp6       0      0 96.57.23.83:80          103.231.63.185:25496    SYN_RECV    0          0          -                    on (8.50/4/0)
tcp6       0      0 96.57.23.83:80          103.231.63.92:41069     SYN_RECV    0          0          -                    on (0.26/1/0)
tcp6       0      0 96.57.23.83:80          103.231.60.209:44528    SYN_RECV    0          0          -                    on (5.54/3/0)
tcp6       0      0 96.57.23.83:80          46.229.168.142:3844     TIME_WAIT   0          0          -                    timewait (54.47/0/0)
tcp6       0      0 96.57.23.83:80          103.231.60.23:34593     SYN_RECV    0          0          -                    on (20.02/5/0)
tcp6       0      0 96.57.23.83:80          103.231.61.46:61719     SYN_RECV    0          0          -                    on (1.46/4/0)
tcp6       0      0 96.57.23.83:80          103.231.60.116:13910    SYN_RECV    0          0          -                    on (0.00/5/0)
tcp6       0      0 96.57.23.83:80          103.231.62.162:40483    SYN_RECV    0          0          -                    on (27.06/5/0)
tcp6       0      0 96.57.23.83:80          103.231.61.139:33626    SYN_RECV    0          0          -                    on (13.62/5/0)
tcp6       0      0 96.57.23.83:80          103.231.62.255:20547    SYN_RECV    0          0          -                    on (6.58/5/0)
netstat: feature `AF BLUETOOTH' not supported.
Please recompile `net-tools' with newer kernel source or full configuration.

[toc] | [next] | [standalone]


#27699

FromPascal Hambourg <pascal@plouf.fr.eu.org>
Date2019-07-20 10:10 +0200
Message-ID<5d32cc92$0$20340$426a34cc@news.free.fr>
In reply to#27697
Le 20/07/2019 à 06:01, ruben safir a écrit :
> I always used netstat and reading the  man page I see it is now saying that it is being replaced by ss.  ss seems to behave weirdly though. I am running apache and it is not showing up as listening:
> 
> [www3 ~]# ss -aptls4n
[...]
> with ip6 it shows up.
> 
> [www3 ~]# ss -aptlsn6
> State                         Recv-Q                        Send-Q                                                Local Address:Port                                                 Peer Address:Port
> LISTEN                        0                             0                                                                 *:80                                                              *:*                            users:(("/usr/local

Well, apache does not use an IPv4 socket, only an IPv6 socket.

> if shows up with netstat
[...]
> [www3 ~]# netstat -tapvWenof
[...]
> tcp6       0      0 96.57.23.83:80          103.231.63.185:25496    SYN_RECV    0          0          -                    on (8.50/4/0)

You did not restrict netstat to IPv4 or IPv6 sockets only, so it shows 
both types of sockets.

[toc] | [prev] | [next] | [standalone]


#27700

Fromruben safir <ruben@mrbrklyn.com>
Date2019-07-20 19:23 -0400
Message-ID<qh07t9$6c$1@reader2.panix.com>
In reply to#27699
On 7/20/19 4:10 AM, Pascal Hambourg wrote:
> 
> Well, apache does not use an IPv4 socket, only an IPv6 socket.
> 
>> if shows up with netstat
> [...]
>> [www3 ~]# netstat -tapvWenof
> [...]
>> tcp6       0      0 96.57.23.83:80          103.231.63.185:25496   
>> SYN_RECV    0          0          -                    on (8.50/4/0)
> 
> You did not restrict netstat to IPv4 or IPv6 sockets only, so it shows
> both types of sockets.


The kernel has two socket layers now, one for ip4 and another for ip6?

[toc] | [prev] | [next] | [standalone]


#27701

Fromruben safir <ruben@mrbrklyn.com>
Date2019-07-20 19:24 -0400
Message-ID<qh07v1$6c$2@reader2.panix.com>
In reply to#27700
On 7/20/19 7:23 PM, ruben safir wrote:
>> You did not restrict netstat to IPv4 or IPv6 sockets only, so it shows
>> both types of sockets.
> 
> The kernel has two socket layers now, one for ip4 and another for ip6?
> 


I would consider ti a bug anyway.  You want to see all your CP sockets,
not a subset of them, by default.

[toc] | [prev] | [next] | [standalone]


#27706

FromPascal Hambourg <pascal@plouf.fr.eu.org>
Date2019-07-21 09:45 +0200
Message-ID<qh157n$20ht$1@saria.nerim.net>
In reply to#27701
Le 21/07/2019 à 01:24, ruben safir a écrit :
> On 7/20/19 7:23 PM, ruben safir wrote:
>>> You did not restrict netstat to IPv4 or IPv6 sockets only, so it shows
>>> both types of sockets.
>>
>> The kernel has two socket layers now, one for ip4 and another for ip6?

The kernel has always worked this way.

> I would consider ti a bug anyway.  You want to see all your CP sockets,
> not a subset of them, by default.

A bug ? *You* explicitly requested ss to show *only* either IPv4 or IPv6 
sockets in your commands :

ss -aptls4n
ss -aptls6n

Do not add -4 or -6 and you will see both types of sockets.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.os.linux.misc


csiph-web