ലിനക്സ് നെറ്റ്uവർക്ക് മാനേജ്മെന്റിനുള്ള 20 നെറ്റ്സ്റ്റാറ്റ് കമാൻഡുകൾ


നെറ്റ്uസ്റ്റാറ്റ് (നെറ്റ്uവർക്ക് സ്ഥിതിവിവരക്കണക്കുകൾ) ഇൻകമിംഗ്, ഔട്ട്uഗോയിംഗ് നെറ്റ്uവർക്ക് കണക്ഷനുകൾ നിരീക്ഷിക്കുന്നതിനും റൂട്ടിംഗ് ടേബിളുകൾ, ഇന്റർഫേസ് സ്ഥിതിവിവരക്കണക്കുകൾ മുതലായവ കാണുന്നതിനുമുള്ള ഒരു കമാൻഡ്-ലൈൻ ഉപകരണമാണ്.

[നിങ്ങൾക്ക് ഇതും ഇഷ്ടപ്പെടാം: സിസാഡ്മിനിനായുള്ള 22 ലിനക്സ് നെറ്റ്uവർക്കിംഗ് കമാൻഡുകൾ ]

netstat എല്ലാ Unix പോലുള്ള ഓപ്പറേറ്റിംഗ് സിസ്റ്റങ്ങളിലും ലഭ്യമാണ് കൂടാതെ Windows OS-ലും ലഭ്യമാണ്. നെറ്റ്uവർക്ക് ട്രബിൾഷൂട്ടിംഗിനും പ്രകടന അളക്കലിനും ഇത് വളരെ ഉപയോഗപ്രദമാണ്.

നെറ്റ്uസ്റ്റാറ്റ് ഏറ്റവും അടിസ്ഥാന നെറ്റ്uവർക്ക് സേവന ഡീബഗ്ഗിംഗ് ടൂളുകളിൽ ഒന്നാണ്, പോർട്ടുകളിൽ കേൾക്കുന്നത് നിങ്ങളോട് പറയുന്നു.

ലിനക്സ് നെറ്റ്uവർക്ക് അഡ്മിനിസ്ട്രേറ്റർമാർക്കും സിസ്റ്റം അഡ്മിനിസ്ട്രേറ്റർമാർക്കും അവരുടെ നെറ്റ്uവർക്ക് സംബന്ധമായ പ്രശ്നങ്ങൾ നിരീക്ഷിക്കാനും ട്രബിൾഷൂട്ട് ചെയ്യാനും നെറ്റ്uവർക്ക് ട്രാഫിക് പ്രകടനം നിർണ്ണയിക്കാനും നെറ്റ്uസ്റ്റാറ്റ് ടൂൾ വളരെ പ്രധാനപ്പെട്ടതും വളരെ ഉപയോഗപ്രദവുമാണ്.

ഈ ലേഖനം netstat കമാൻഡിന്റെ ഉപയോഗങ്ങൾ അവയുടെ ഉദാഹരണങ്ങൾക്കൊപ്പം കാണിക്കുന്നു, അത് ദൈനംദിന പ്രവർത്തനത്തിൽ ഉപയോഗപ്രദമാകും.

[ നിങ്ങൾക്ക് ഇതും ഇഷ്ടപ്പെടാം: ലിനക്സ് ഫൈൻഡ് കമാൻഡിന്റെ 35 പ്രായോഗിക ഉദാഹരണങ്ങൾ ]

netstat -a ഓപ്ഷൻ ഉപയോഗിച്ച് എല്ലാ പോർട്ടുകളും (ടിസിപിയും യുഡിപിയും) ലിസ്റ്റുചെയ്യുന്നു.

# netstat -a | more

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 *:sunrpc                    *:*                         LISTEN
tcp        0     52 192.168.0.2:ssh             192.168.0.1:egs             ESTABLISHED
tcp        1      0 192.168.0.2:59292           www.gov.com:http            CLOSE_WAIT
tcp        0      0 localhost:smtp              *:*                         LISTEN
tcp        0      0 *:59482                     *:*                         LISTEN
udp        0      0 *:35036                     *:*
udp        0      0 *:npmp-local                *:*

Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ACC ]     STREAM     LISTENING     16972  /tmp/orbit-root/linc-76b-0-6fa08790553d6
unix  2      [ ACC ]     STREAM     LISTENING     17149  /tmp/orbit-root/linc-794-0-7058d584166d2
unix  2      [ ACC ]     STREAM     LISTENING     17161  /tmp/orbit-root/linc-792-0-546fe905321cc
unix  2      [ ACC ]     STREAM     LISTENING     15938  /tmp/orbit-root/linc-74b-0-415135cb6aeab

netstat -at ഉപയോഗിച്ച് TCP (ട്രാൻസ്മിഷൻ കൺട്രോൾ പ്രോട്ടോക്കോൾ) പോർട്ട് കണക്ഷനുകൾ മാത്രം ലിസ്റ്റുചെയ്യുന്നു.

# netstat -at

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 *:ssh                       *:*                         LISTEN
tcp        0      0 localhost:ipp               *:*                         LISTEN
tcp        0      0 localhost:smtp              *:*                         LISTEN
tcp        0     52 192.168.0.2:ssh             192.168.0.1:egs             ESTABLISHED
tcp        1      0 192.168.0.2:59292           www.gov.com:http            CLOSE_WAIT

netstat -au ഉപയോഗിക്കുന്ന UDP (User Datagram Protocol ) പോർട്ട് കണക്ഷനുകൾ മാത്രം ലിസ്റ്റുചെയ്യുന്നു.

# netstat -au

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
udp        0      0 *:35036                     *:*
udp        0      0 *:npmp-local                *:*
udp        0      0 *:mdns                      *:*

netstat -l ഉപയോഗിച്ചുള്ള എല്ലാ സജീവ ലിസണിംഗ് പോർട്ട് കണക്ഷനുകളും ലിസ്റ്റുചെയ്യുന്നു.

# netstat -l

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 *:sunrpc                    *:*                         LISTEN
tcp        0      0 *:58642                     *:*                         LISTEN
tcp        0      0 *:ssh                       *:*                         LISTEN
udp        0      0 *:35036                     *:*
udp        0      0 *:npmp-local                *:*

Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ACC ]     STREAM     LISTENING     16972  /tmp/orbit-root/linc-76b-0-6fa08790553d6
unix  2      [ ACC ]     STREAM     LISTENING     17149  /tmp/orbit-root/linc-794-0-7058d584166d2
unix  2      [ ACC ]     STREAM     LISTENING     17161  /tmp/orbit-root/linc-792-0-546fe905321cc
unix  2      [ ACC ]     STREAM     LISTENING     15938  /tmp/orbit-root/linc-74b-0-415135cb6aeab

netstat -lt എന്ന ഓപ്uഷൻ ഉപയോഗിച്ച് എല്ലാ സജീവ ലിസണിംഗ് TCP പോർട്ടുകളും ലിസ്റ്റുചെയ്യുന്നു.

# netstat -lt

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 *:dctp                      *:*                         LISTEN
tcp        0      0 *:mysql                     *:*                         LISTEN
tcp        0      0 *:sunrpc                    *:*                         LISTEN
tcp        0      0 *:munin                     *:*                         LISTEN
tcp        0      0 *:ftp                       *:*                         LISTEN
tcp        0      0 localhost.localdomain:ipp   *:*                         LISTEN
tcp        0      0 localhost.localdomain:smtp  *:*                         LISTEN
tcp        0      0 *:http                      *:*                         LISTEN
tcp        0      0 *:ssh                       *:*                         LISTEN
tcp        0      0 *:https                     *:*                         LISTEN

netstat -lu എന്ന ഓപ്ഷൻ ഉപയോഗിച്ച് എല്ലാ സജീവ ലിസണിംഗ് യുഡിപി പോർട്ടുകളും ലിസ്റ്റ് ചെയ്യുന്നു.

# netstat -lu

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
udp        0      0 *:39578                     *:*
udp        0      0 *:meregister                *:*
udp        0      0 *:vpps-qua                  *:*
udp        0      0 *:openvpn                   *:*
udp        0      0 *:mdns                      *:*
udp        0      0 *:sunrpc                    *:*
udp        0      0 *:ipp                       *:*
udp        0      0 *:60222                     *:*
udp        0      0 *:mdns                      *:*

netstat -lx ഉപയോഗിച്ച് സജീവമായ എല്ലാ UNIX ലിസണിംഗ് പോർട്ടുകളും ലിസ്റ്റുചെയ്യുന്നു.

# netstat -lx

Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ACC ]     STREAM     LISTENING     4171   @ISCSIADM_ABSTRACT_NAMESPACE
unix  2      [ ACC ]     STREAM     LISTENING     5767   /var/run/cups/cups.sock
unix  2      [ ACC ]     STREAM     LISTENING     7082   @/tmp/fam-root-
unix  2      [ ACC ]     STREAM     LISTENING     6157   /dev/gpmctl
unix  2      [ ACC ]     STREAM     LISTENING     6215   @/var/run/hald/dbus-IcefTIUkHm
unix  2      [ ACC ]     STREAM     LISTENING     6038   /tmp/.font-unix/fs7100
unix  2      [ ACC ]     STREAM     LISTENING     6175   /var/run/avahi-daemon/socket
unix  2      [ ACC ]     STREAM     LISTENING     4157   @ISCSID_UIP_ABSTRACT_NAMESPACE
unix  2      [ ACC ]     STREAM     LISTENING     60835836 /var/lib/mysql/mysql.sock
unix  2      [ ACC ]     STREAM     LISTENING     4645   /var/run/audispd_events
unix  2      [ ACC ]     STREAM     LISTENING     5136   /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     6216   @/var/run/hald/dbus-wsUBI30V2I
unix  2      [ ACC ]     STREAM     LISTENING     5517   /var/run/acpid.socket
unix  2      [ ACC ]     STREAM     LISTENING     5531   /var/run/pcscd.comm

പ്രോട്ടോക്കോൾ പ്രകാരം സ്ഥിതിവിവരക്കണക്കുകൾ പ്രദർശിപ്പിക്കുന്നു. സ്ഥിരസ്ഥിതിയായി, TCP, UDP, ICMP, IP പ്രോട്ടോക്കോളുകൾക്കായുള്ള സ്ഥിതിവിവരക്കണക്കുകൾ കാണിക്കുന്നു. ഒരു കൂട്ടം പ്രോട്ടോക്കോളുകൾ വ്യക്തമാക്കാൻ -s പാരാമീറ്റർ ഉപയോഗിക്കാം.

# netstat -s

Ip:
    2461 total packets received
    0 forwarded
    0 incoming packets discarded
    2431 incoming packets delivered
    2049 requests sent out
Icmp:
    0 ICMP messages received
    0 input ICMP message failed.
    ICMP input histogram:
    1 ICMP messages sent
    0 ICMP messages failed
    ICMP output histogram:
        destination unreachable: 1
Tcp:
    159 active connections openings
    1 passive connection openings
    4 failed connection attempts
    0 connection resets received
    1 connections established
    2191 segments received
    1745 segments send out
    24 segments retransmited
    0 bad segments received.
    4 resets sent
Udp:
    243 packets received
    1 packets to unknown port received.
    0 packet receive errors
    281 packets sent

netstat -st ഓപ്ഷൻ ഉപയോഗിച്ച് TCP പ്രോട്ടോക്കോളിന്റെ മാത്രം സ്ഥിതിവിവരക്കണക്കുകൾ കാണിക്കുന്നു.

# netstat -st

Tcp:
    2805201 active connections openings
    1597466 passive connection openings
    1522484 failed connection attempts
    37806 connection resets received
    1 connections established
    57718706 segments received
    64280042 segments send out
    3135688 segments retransmited
    74 bad segments received.
    17580 resets sent
# netstat -su

Udp:
    1774823 packets received
    901848 packets to unknown port received.
    0 packet receive errors
    2968722 packets sent

സേവനത്തിന്റെ പേര് അവരുടെ PID നമ്പറിനൊപ്പം പ്രദർശിപ്പിക്കുന്നത്, netstat -tp ഓപ്ഷൻ ഉപയോഗിച്ച് PID/Program Name പ്രദർശിപ്പിക്കും.

# netstat -tp

Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 192.168.0.2:ssh             192.168.0.1:egs             ESTABLISHED 2179/sshd
tcp        1      0 192.168.0.2:59292           www.gov.com:http            CLOSE_WAIT  1939/clock-applet

-ac സ്വിച്ച് ഉപയോഗിച്ച് പ്രോമിസ്uക്യൂസ് മോഡ് പ്രദർശിപ്പിക്കുന്നു, തിരഞ്ഞെടുത്ത വിവരങ്ങൾ നെറ്റ്uസ്റ്റാറ്റ് പ്രിന്റ് ചെയ്യുക അല്ലെങ്കിൽ ഓരോ അഞ്ച് സെക്കൻഡിലും സ്uക്രീൻ പുതുക്കുക. ഡിഫോൾട്ട് സ്uക്രീൻ ഓരോ സെക്കൻഡിലും പുതുക്കുന്നു.

# netstat -ac 5 | grep tcp

tcp        0      0 *:sunrpc                    *:*                         LISTEN
tcp        0      0 *:58642                     *:*                         LISTEN
tcp        0      0 *:ssh                       *:*                         LISTEN
tcp        0      0 localhost:ipp               *:*                         LISTEN
tcp        0      0 localhost:smtp              *:*                         LISTEN
tcp        1      0 192.168.0.2:59447           www.gov.com:http            CLOSE_WAIT
tcp        0     52 192.168.0.2:ssh             192.168.0.1:egs             ESTABLISHED
tcp        0      0 *:sunrpc                    *:*                         LISTEN
tcp        0      0 *:ssh                       *:*                         LISTEN
tcp        0      0 localhost:ipp               *:*                         LISTEN
tcp        0      0 localhost:smtp              *:*                         LISTEN
tcp        0      0 *:59482                     *:*                         LISTEN

നെറ്റ്സ്റ്റാറ്റും റൂട്ട് കമാൻഡും ഉപയോഗിച്ച് കേർണൽ ഐപി റൂട്ടിംഗ് ടേബിൾ പ്രദർശിപ്പിക്കുക.

# netstat -r

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.0.0     *               255.255.255.0   U         0 0          0 eth0
link-local      *               255.255.0.0     U         0 0          0 eth0
default         192.168.0.1     0.0.0.0         UG        0 0          0 eth0

MTU വലുപ്പമുള്ള പാക്കറ്റുകൾ കൈമാറുന്നതും സ്വീകരിക്കുന്നതും ഉൾപ്പെടെയുള്ള നെറ്റ്uവർക്ക് ഇന്റർഫേസ് പാക്കറ്റ് ഇടപാടുകൾ കാണിക്കുന്നു.

# netstat -i

Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500   0     4459      0      0      0     4057      0      0      0 BMRU
lo        16436   0        8      0      0      0        8      0      0      0 LRU

ifconfig കമാൻഡിന് സമാനമായ കേർണൽ ഇന്റർഫേസ് പട്ടിക കാണിക്കുന്നു.

# netstat -ie

Kernel Interface table
eth0      Link encap:Ethernet  HWaddr 00:0C:29:B4:DA:21
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feb4:da21/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4486 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4077 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2720253 (2.5 MiB)  TX bytes:1161745 (1.1 MiB)
          Interrupt:18 Base address:0x2000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:480 (480.0 b)  TX bytes:480 (480.0 b)

IPv4, IPv6 എന്നിവയ്uക്കായി മൾട്ടികാസ്റ്റ് ഗ്രൂപ്പ് അംഗത്വ വിവരങ്ങൾ പ്രദർശിപ്പിക്കുന്നു.

# netstat -g

IPv6/IPv4 Group Memberships
Interface       RefCnt Group
--------------- ------ ---------------------
lo              1      all-systems.mcast.net
eth0            1      224.0.0.251
eth0            1      all-systems.mcast.net
lo              1      ff02::1
eth0            1      ff02::202
eth0            1      ff02::1:ffb4:da21
eth0            1      ff02::1

ഓരോ കുറച്ച് സെക്കൻഡിലും നെറ്റ്സ്റ്റാറ്റ് വിവരങ്ങൾ ലഭിക്കുന്നതിന്, ഇനിപ്പറയുന്ന കമാൻഡ് ഉപയോഗിക്കുക, ഇത് നെറ്റ്സ്റ്റാറ്റ് വിവരങ്ങൾ തുടർച്ചയായി പ്രിന്റ് ചെയ്യും, ഓരോ കുറച്ച് സെക്കൻഡിലും പറയുക.

# netstat -c

Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 linux-console.net:http   sg2nlhg007.shr.prod.s:36944 TIME_WAIT
tcp        0      0 linux-console.net:http   sg2nlhg010.shr.prod.s:42110 TIME_WAIT
tcp        0    132 linux-console.net:ssh    115.113.134.3.static-:64662 ESTABLISHED
tcp        0      0 linux-console.net:http   crawl-66-249-71-240.g:41166 TIME_WAIT
tcp        0      0 localhost.localdomain:54823 localhost.localdomain:smtp  TIME_WAIT
tcp        0      0 localhost.localdomain:54822 localhost.localdomain:smtp  TIME_WAIT
tcp        0      0 linux-console.net:http   sg2nlhg010.shr.prod.s:42091 TIME_WAIT
tcp        0      0 linux-console.net:http   sg2nlhg007.shr.prod.s:36998 TIME_WAIT

ചില ഉപയോഗപ്രദമായ വിവരങ്ങളുള്ള കോൺഫിഗർ ചെയ്യാത്ത വിലാസ കുടുംബങ്ങളെ കണ്ടെത്തുന്നു.

# netstat --verbose

netstat: no support for `AF IPX' on this system.
netstat: no support for `AF AX25' on this system.
netstat: no support for `AF X25' on this system.
netstat: no support for `AF NETROM' on this system.

ഒരു പോർട്ടിൽ എത്ര ശ്രവണ പ്രോഗ്രാമുകൾ പ്രവർത്തിക്കുന്നുവെന്ന് കണ്ടെത്തുക.

# netstat -ap | grep http

tcp        0      0 *:http                      *:*                         LISTEN      9056/httpd
tcp        0      0 *:https                     *:*                         LISTEN      9056/httpd
tcp        0      0 linux-console.net:http   sg2nlhg008.shr.prod.s:35248 TIME_WAIT   -
tcp        0      0 linux-console.net:http   sg2nlhg007.shr.prod.s:57783 TIME_WAIT   -
tcp        0      0 linux-console.net:http   sg2nlhg007.shr.prod.s:57769 TIME_WAIT   -
tcp        0      0 linux-console.net:http   sg2nlhg008.shr.prod.s:35270 TIME_WAIT   -
tcp        0      0 linux-console.net:http   sg2nlhg009.shr.prod.s:41637 TIME_WAIT   -
tcp        0      0 linux-console.net:http   sg2nlhg009.shr.prod.s:41614 TIME_WAIT   -
unix  2      [ ]         STREAM     CONNECTED     88586726 10394/httpd
# netstat --statistics --raw

Ip:
    62175683 total packets received
    52970 with invalid addresses
    0 forwarded
Icmp:
    875519 ICMP messages received
        destination unreachable: 901671
        echo request: 8
        echo replies: 16253
IcmpMsg:
        InType0: 83
IpExt:
    InMcastPkts: 117

അത്രയേയുള്ളൂ, നിങ്ങൾ netstat കമാൻഡിനെക്കുറിച്ചുള്ള കൂടുതൽ വിവരങ്ങളും ഓപ്ഷനുകളും തിരയുകയാണെങ്കിൽ, എല്ലാ വിവരങ്ങളും അറിയാൻ netstat മാനുവൽ ഡോക്uസ് കാണുക അല്ലെങ്കിൽ man netstat കമാൻഡ് ഉപയോഗിക്കുക.

ഞങ്ങൾക്ക് ലിസ്റ്റിൽ എന്തെങ്കിലും നഷ്uടമായിട്ടുണ്ടെങ്കിൽ, ചുവടെയുള്ള ഞങ്ങളുടെ അഭിപ്രായ വിഭാഗം ഉപയോഗിച്ച് ഞങ്ങളെ അറിയിക്കുക. അതിനാൽ, നിങ്ങളുടെ അഭിപ്രായങ്ങളെ അടിസ്ഥാനമാക്കി ഞങ്ങൾക്ക് ഈ ലിസ്റ്റ് അപ്ഡേറ്റ് ചെയ്യുന്നത് തുടരാം.