Main Menu

Search

Showing posts with label Linux Networking. Show all posts
Showing posts with label Linux Networking. Show all posts

LINUX: Netstat Command To Check the TCP Details - PacketLoss, Retransmits, Dropped, Aborted Connections Etc. For Troubleshooting

"netstat -s" command can be used for checking the TCP network details to check packetloss, retransmits, dropped, aborted connections etc. for troubleshooting.

Below is sample output.

#netstat -s | egrep -i "timeout|retransmit|segments|lost|TcpRetransSegs|drop"

    20 fragments dropped after timeout
    22297220 segments received
    22212157 segments sent out
    4461 segments retransmitted
    0 bad segments received
    Detected reordering 4 times using reno fast retransmit
    TCPLostRetransmit: 1281
    5 timeouts in loss state
    32 fast retransmits
    19 retransmits in slow start
    TCPTimeouts: 2531
    221 connections aborted due to timeout
    TcpTimeoutRehash: 1705



Keywords:

troubleshoot troubleshooting network networking issue issues problem problems debug debugging check checking bottleneck performance stall stalled packets transmit transmission 

LINUX: Conntrack Commands Cheatsheet (Conntrack to Track Network Connections)

Check the Dropped Packets in Conntrack

conntrack -s

Check the current connections count in conntrack

conntrack -c





Keywords

conntrack connection track tracking network networking linux how to debug debugging troubleshoot troubleshooting check checking connection 

LINUX: DMESG Command To Check the Disk IO Timeout Errors On Hard Drive / Attached Storage Devices

Below command can be used to Check the Disk IO Timeout Errors On Hard Drive / Attached Storage Devices

dmesg -T | egrep -i 'sda|blk_update|I/O error|timed out|reset|pvscsi'


In above command replace sda with the device name you want to check the Disk IO timeout errors. 

Note: You can check the devices using "lsblk" command.



Keywords:

timeout time out timing out io ioerror error input output network issue issues disconnect disconnected disconnecting latency slow slowness speed slowly device devices harddrive drive drives attached attaching lun luns iscsi


ILOM: Command To Identify the Host MAC Address To Use To Configure Management Network On the Host OS (Linux / Hardware)

Below ILOM command can be used to identify the host primary mac address which can be used to configured management network on the Linux Host OS.

show -o table -format nowrap /System host_primary_mac_address

Below is sample output of above command.

Target             | Property              | Value                             
-------------------+-----------------------+-----------------------------------
/System            | host_primary_mac_address | AA:XX:XX:YY:ZZ:ZZ

LINUX: How To Reload Firewalld Settings?

LINUX: How To Reload Firewalld Settings?

Below command can be used

sudo firewall-cmd --reload

LINUX: Dig Commands To Ping DNS Servers For Troubleshooting

LINUX: Dig Commands To Ping DNS Servers For Troubleshooting 


For testing DNS server connectivity over tcp protocol, below dig command can be used.


dig -x XX.XX.XX.XX +tcp


For testing DNS server connectivity over non tcp protocols like UDP protocol, below dig command can be used.


dig -x XX.XX.XX.XX +notcp

LINUX: Firewalld Rules XML Files Location On Linux

Firewalls rules XML files can be found in below locations.  

/etc/firewalld /etc/firewalld/zones 

LINUX: Location Where System Unit Files For Enabled Services Exists On Linux

LINUX: Location Where System Unit Files For Enabled Services Exists On Linux


System Unit Files For Enabled Services Exists are inside /etc/systemd/system/


Below is example snippet of files in  /etc/systemd/system/ directory.


ls -lrt /etc/systemd/system/

total 40

drwxr-xr-x. 2 root root   44 Jun 13  2023 system-update.target.wants

drwxr-xr-x. 2 root root   36 Jun 13  2023 systemd-remount-fs.service.wants

drwxr-xr-x. 2 root root   32 Jun 13  2023 getty.target.wants

drwxr-xr-x. 2 root root   87 Jun 13  2023 default.target.wants

drwxr-xr-x. 2 root root   35 Jun 13  2023 local-fs.target.wants

drwxr-xr-x. 2 root root   95 Jun 13  2023 sockets.target.wants

drwxr-xr-x. 2 root root   52 Jun 13  2023 remote-fs.target.wants

lrwxrwxrwx. 1 root root   41 Jun 13  2023 dbus-org.fedoraproject.FirewallD1.service -> /usr/lib/systemd/system/firewalld.service

lrwxrwxrwx. 1 root root   37 Jun 13  2023 default.target -> /lib/systemd/system/multi-user.target

lrwxrwxrwx. 1 root root    9 Jun 13  2023 uptrack-late.service -> /dev/null

drwxr-xr-x. 2 root root 4096 Jun 13  2023 sysinit.target.wants

drwxr-xr-x. 2 root root   35 Jun 13  2023 network-online.target.wants

lrwxrwxrwx. 1 root root    9 Jun 13  2023 NetworkManager.service -> /dev/null

lrwxrwxrwx. 1 root root    9 Jun 13  2023 NetworkManager-wait-online.service -> /dev/null

-rw-r--r--. 1 root root  244 Jun 13  2023 iscsi-boot-volume.service

drwxr-xr-x. 2 root root 4096 Jun 13  2023 cloud-init.target.wants

-rw-r--r--. 1 root root  231 Jun 28  2023 kubelet.service

-rw-r--r--. 1 root root  301 Jun 28  2023 kubectl-proxy.service

drwxr-xr-x. 2 root root 4096 Aug  1  2023 basic.target.wants

-rw-r--r--. 1 root root  363 Oct 10 21:04 ocid.service

drwxr-xr-x. 2 root root   62 Jan  6 04:18 timers.target.wants

drwxr-xr-x. 2 root root   26 Jan  6 06:09 olcne-agent.service.d

drwxr-xr-x. 2 root root   29 Jan 16 17:51 kubelet.service.d

drwxr-xr-x. 2 root root   35 Jan 16 17:51 kubectl-proxy.service.d

-rw-r--r--. 1 root root 1374 Jan 19 23:41 oracle-cloud-agent.service

-rw-r--r--. 1 root root  915 Jan 19 23:42 oracle-cloud-agent-updater.service

drwxr-xr-x. 2 root root 4096 Feb 26 21:22 multi-user.target.wants

drwxr-xr-x. 2 root root   57 Feb 26 21:22 wlp-agent-osqueryd.service.d


LINUX: Command To Delete ARP Cache

LINUX: Command To Delete ARP Cache 

Below command can be used.


sudo ip -s -s neigh flush all

LINUX: How To Debug/Troubleshoot Connection Issues Between Hosts On Specific Port? (tcpdump, netcat)

Following action plan can be implemented to debug the connection issues from one host to other host over specific port.

1) On the Destination VM, run netcat command as follows to start listening on port which has issues, for example lets assume port 2430. You can change this port to whatever port you choose.
 
nc -lv 2430
 
2) Now open Duplicate session to Destination VM and run tcpdump command as follows. Leave the window open with tcpdump running on port 2430. Change the port number as needed if you are not using 2430. Also change the interface name bondX to interface name corresponding to the Destination VM. below command will save tcpdump pcap capture file under /tmp directory with the hostname of the machine.
 
tcpdump -i bondX -nn port 2430 -w /tmp/`hostname -s`.pcap
 
3) Now open Session to Source VM and run below tcpdump command. Leave the window open.
 
tcpdump -i bondX -nn port 2430 -w /tmp/`hostname -s`.pcap
 
Change bondX in above command to bond number of Source VM from where communication is happening. Change port 2430 as needed if you are using different port. Above command will save tcpdump pcap capture file under /tmp directory with the hostname of the machine.
 
4) Now open duplicate session to Source VM and run below command to connect to Destination VM. Change the IP and port number as needed.
 
nc -w 2 <Destination VM IP> 2430
 
w flag in above command means that connection will timeout after waiting 2 seconds.
 
In a working scenario you should be seeing TCP Sent and acknowledgement packages between source and destination as follows from tcpdump captures
 
reading from file elorl02cn02.pcap, link-type EN10MB (Ethernet)
18:05:22.095588 IP host1.50899 > host2.venus: Flags [S], seq 1755432405, win 42340, options [mss 1460,sackOK,TS val 3911386704 ecr 0,nop,wscale 12], length 0
18:05:22.095606 IP host2.venus > host1.50899: Flags [R.], seq 0, ack 1755432406, win 0, length 0

 


Products to which Article Applies

All Linux Operating Systems 

Search Keywords: tcpdump tcp dump network capture pcap pcaps captures debug debugging troubleshoot troubleshooting issue issues networking packet packets tcp tcpip ip communication communications communicating trace traces netcat telnet connection connect connecting problem problems how to listen listening

Article Author: Tarun Boyella

 

LINUX: How To Open Firewall To Specific Port Using "firewalld" Command?

Below comnand can be used.

sudo firewall-cmd --add-port=<port>/tcp --permanent

Replace the port with the port number to which you want to open firewall. You can replace the tcp protocol as well with the protocol to which you want to open the firewall.

You will see success in output as follows when above command is executed successfully.

sudo firewall-cmd --add-port=8091/tcp --permanent
success

You check if the firewall port is opened you can execute below command.

sudo firewall-cmd --list-all

 


Products to which Article Applies

All Linux Operating Systems

Search Keywords: firewall how to add adding open opening port ports specific particular command commands permission permissions give giving

Article Author: Tarun Boyella

 

LINUX: "nc" Command To Test Listening On Specific Port To Check if Port Is Unused

Following is command to use.

nc -l <port number>

If the port is unused, you will see no output when running the command and you will not return to prompt unless you do Ctrl C. When the command is running, you can try to telnet from other machine to the machine where you have above nc command running on the port specified in nc command. You will get connected prompt.

If the port is not available and is used by another program following message is displayed when runnign nc command.

 # nc -l 22
Ncat: bind to :::22: Address already in use. QUITTING.

 


Products to which Article Applies

All Linux Operating System 

Search Keywords: Linux check checking port status state used unused available not netcat net cat utility program command commands validate validating

Article Author: Tarun Boyella

 

LINUX: ARP COMMAND TO CHECK THE NETWORK IP, MAC/HW ADDRESS AND INFINIBAND BONDS & IB BOND TYPES (WHETHER EOIB OR IPOIB)

Following is command to use.

arp -an 

Following is sample output of above command.

 # arp -an 
? (10.XX.XX.182) at 00:10:e0:21:78:8c [ether] on eth0 
? (192.XX.20.9) at 80:00:b7:7d:fe:80:00:00:00 [infiniband] on bond1 
? (192.XX.20.8) at 80:01:18:a3:fe:80:00:00:00 [infiniband] on bond1 
? (10.XX.XX.183) at 00:14:4f:f9:a7:c5 [ether] on bond0 
? (10.XX.XX.146) at 00:10:e0:70:3f:8e [ether] on eth0 
? (192.XX.21.5) at 80:00:00:4b:fe:80:00:00:00 [infiniband] on bond2 
? (192.XX.23.3) at 80:00:05:4f:fe:80:00:00:00 [infiniband] on bond4 
? (10.XX.XX.177) at 00:00:0c:07:ac:24 [ether] on bond0 
? (192.XX.23.1) at 80:00:05:4f:fe:80:00:00:00 [infiniband] on bond4 
? (10.XX.XX.166) at 00:10:e0:0f:5b:54 [ether] on eth0 
? (192.XX.23.4) at 80:00:05:4f:fe:80:00:00:00 [infiniband] on bond4 
? (192.XX.23.2) at 80:00:05:4f:fe:80:00:00:00 [infiniband] on bond4 
? (10.XX.XX.183) at 00:10:e0:22:11:f5 [ether] on eth0 

 


Products to which Article Applies

All Linux Operating Systems

Search Keywords: route routing how to table checking addresses ips bond bonding ethernet infiniband network networking

Article Author: Tarun Boyella

 

LINUX: HOW TO CHECK CONNECTIONS IN TCP ACCEPT QUEUE?

Accept Queue size can be checked using below command. 
 
$ ss -plnt sport = :6443|cat 
 
To check accept queue size on specific port below command can be used. 
 
$ ss -plnt sport = :6443|cat 
State   Recv-Q Send-Q  Local Address:Port  Peer Address:Port 
LISTEN  0      1024                *:6443             *:* 

 
 
The column Recv-Q shows the number of sockets in the Accept Queue, and Send-Q shows the backlog parameter. 
 
Command to Check if TCP Accept Queue is Overflowing. 
 
ss -n state syn-recv sport = :80 | wc -l 
 
 

Products to which Article Applies

All Linux Operating Systems

Search Keywords: linux networking network tcp tcpip tcp/ip ip connection connections networking queue syn accept command commands check how to transmit transmission packet packets

Article Author: Tarun Boyella

LINUX: HOW TO CHECK CONNECTIONS IN TCP SYN QUEUE?

Below commands can be used to check the connections in SYN queue. 

ss -n state syn-recv | wc –l 
 
If you want to check connections on specific port below command can be used. 
 
ss -n state syn-recv sport = :80 | wc –l
 
Other commands that can be used to check SYN queue. 

netstat -tuna | grep SYN_RECV 
 
 

Products to which Article Applies

All Linux Operating Systems

Search Keywords: linux networking network tcp tcpip tcp/ip ip connection connections networking queue syn accept command commands check how to transmit transmission packet packets

Article Author: Tarun Boyella

LINUX: HOW TCP CONNECTIONS WORK IN LINUX?

 
In Linux world there are two queues for TCP connections - SYN and ACCEPT queue.

In nutshell this is how the TCP connections work in Linux:
 
SYN QUEUE
 
There is SYN queue which stores all incoming syn connections (SYN RECV). Connections in SYN queue are then transmitted to peer to get SYN ACK Receive. Once SYN ACK comes back for connection, the a connection is fully established. Once connection is fully established, the connection is moved to ACCEPT Queue. 
 
Below commands can be used to check the connections in SYN queue. 

ss -n state syn-recv | wc –l 
 
If you want to check connections on specific port below command can be used. 
 
ss -n state syn-recv sport = :80 | wc –l
 
Other commands that can be used to check SYN queue. 

netstat -tuna | grep SYN_RECV 
 
Each slot in SYN Queue uses some memory. Usually each socket entry in SYN queue takes 256 bytes of memory. 
 
SYN queue backlog size can be set using  net.ipv4.tcp_max_syn_backlog TCP flag. 

ACCEPT QUEUE

ACCEPT queue contains the fully established TCP connections ready to be used by Application. When Application accepts the connections, connections are moved out of Accept queue. 
 
Accept Queue size can be checked using below command. 
 
$ ss -plnt sport = :6443|cat 
 
To check accept queue size on specific port below command can be used. 
 
$ ss -plnt sport = :6443|cat 
State   Recv-Q Send-Q  Local Address:Port  Peer Address:Port 
LISTEN  0      1024                *:6443             *:* 

 
 
The column Recv-Q shows the number of sockets in the Accept Queue, and Send-Q shows the backlog parameter. 
 
Command to Check if TCP Accept Queue is Overflowing. 
 
ss -n state syn-recv sport = :80 | wc -l 
 
Accept Queue Size can be tuned using flag net.core.somaxconn  
 
Both SYN queue and ACCEPT queue are in kernel space. Once the established connection from Accept queue is picked up by Application, the Connection moves out of Accept queue and kernel space and goes into userspace.

 

Products to which Article Applies

All Linux Operating Systems

Search Keywords: TCP Connection Connections TCPIP TCP/IP IP SYN ACCEPT Backlog network communication queue socket receive send transmit transmission packet listen listener tune tuning command commands

Article Author: Tarun Boyella

LINUX - RDS-STRESS COMMAND TESTS TO TEST RDS CONNECTIONS BETWEEN TWO HOSTS OVER A SPECIFIC PORT 

Following are steps for running RDS stress test between Linux hosts

On the host which you want to act as server run below command. 
 
# rds-stress -v -p 5050 
 
With above command on host acting as server we are starting rds-stress with verbose option and on port 5050. You will see below line where it says it is waiting for connections. 
 
        waiting for incoming connection on 0.0.0.0:5050 
 
On the client from which you want to connect to the client run rds-stress command as follows to connect to server over port 5050. 
 
rds-stress -r 172.XX.0.49 -s 172.XX.0.1 -p 5050 
 
In this case the IP for -r will be the local IP on the client from which you want to do rds-stress test. IP for -s will be the server ip which is listening for rds-stress test connections. 
 
With rds-stress test running you will be seeing outputs as follows: 
 
On client you will see below traces
 
rds-stress -r 172.XX.0.49 -s 172.XX.0.1 -p 5050 
connecting to 172.XX.0.1:5050 
negotiated options, tasks will start in 2 seconds 
Starting up.... 
tsks   tx/s   rx/s  tx+rx K/s    mbi K/s    mbo K/s tx us/c   rtt us cpu % 
   1  13843  13851   29394.33       0.00       0.00    3.40    62.54 -1.00 
   1  14074  14081   29884.17       0.00       0.00    3.40    61.40 -1.00 
   1  13910  13918   29536.50       0.00       0.00    3.39    62.18 -1.00 
   1  14022  14029   29773.49       0.00       0.00    3.41    61.62 -1.00 
   1  14204  14208   30156.57       0.00       0.00    3.34    60.87 -1.00 
 
On server you will be below traces when the test is running.
 
# rds-stress -v -p 5050 

waiting for incoming connection on 0.0.0.0:5050 
accepted connection from 172.XX.0.49:41806 on 172.XX.0.1:5050 
negotiated options, tasks will start in 2 seconds 
Starting up.... 
tsks   tx/s   rx/s  tx+rx K/s    mbi K/s    mbo K/s tx us/c   rtt us cpu % 
   1  13862  13855   29390.80       0.00       0.00    3.79    59.80 -1.00 
   1  14093  14086   29880.22       0.00       0.00    3.71    58.82 -1.00 
   1  13932  13923   29536.01       0.00       0.00    3.87    59.51 -1.00 
   1  14042  14035   29776.73       0.00       0.00    3.71    59.01 -1.00 
   1  14223  14219   30158.89       0.00       0.00    3.63    58.29 -1.00 
--------------------------------------------- 
   1  14015  14008   29748.53       0.00       0.00    3.75    59.14 -1.00  (average) 
 
 

Products to which Article Applies

All Linux OS’s using Infiniband Networks

Search Keywords: rds rds-stress IB

Article Author: Tarun Boyella

LINUX - RDS-INFO –N COMMAND TO CHECK IB RDS INFINIBAND CONNECTIONS BETWEEN LINUX HOSTS  

Following is the command to check IB RDS Infimiband Connections between Linux Hosts
 
# rds-info -n 
 
Below is sample output of above command which shows local address and remote address for rds tests 
 
RDS Connections: 
      LocalAddr      RemoteAddr  Tos           NextTX           NextRX Flgs 
    172.XX.0.49      172.XX.0.1    0           883166           883166 ---- 
 
 
 

Products to which Article Applies

All Linux OS’s using Infiniband

Search Keywords:  rds ads-info ib infiniband

Article Author: Tarun Boyella

LINUX - MODINFO IB_IPOIB COMMAND TO GET IPOIB DRIVER INFORMATION - VERSION, KERNEL, PARAMETERS  

Following is the command to use.

# modinfo ib_ipoib  

  

Below is sample output of above command. 

  

filename:       /lib/modules/4.1.12-112.14.13.el7uek.x86_64/kernel/drivers/infiniband/ulp/ipoib/ib_ipoib.ko 

version:        1.0.0 

license:        Dual BSD/GPL 

description:    IP-over-InfiniBand net driver 

author:         Roland Dreier 

alias:          rtnl-link-ipoib 

srcversion:     45CCF898598FE9AA5A593D0 

depends:        ib_core,ib_cm,ib_sa 

intree:         Y 

vermagic:       4.1.12-112.14.13.el7uek.x86_64 SMP mod_unload modversions  

signer:         Oracle CA Server 

sig_key:        C9:49:B9:57:9A:0C:D0:FB:66:BD:7F:37:9B:37:8D:8E:F7:E5:8E:3E 

sig_hashalgo:   sha512 

parm:           max_nonsrq_conn_qp:Max number of connected-mode QPs per interface (applied only if shared receive queue is not available) (int) 

parm:           mcast_debug_level:Enable multicast debug tracing if > 0 (int) 

parm:           module_unload_allowed:Allow this module to be unloaded or not (default 1 for YES) (int) 

parm:           send_queue_size:Number of descriptors in send queue (int) 

parm:           recv_queue_size:Number of descriptors in receive queue (int) 

parm:           cm_max_bad_conns:Continue data transfer with other nodes upto certain no of bad connections (Default 8 indicates, data transfer will continue with 4 bad connections) (int) 

parm:           debug_level:Enable debug tracing if > 0 (int) 

parm:           cm_ibcrc_as_csum:Indicates whether to utilize IB-CRC as CSUM in connected mode,(default: 1) (int) 

 

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

Products to which Article Applies

All Linux OS’s

Article Author: Tarun Boyella

LINUX - ETHTOOL –S COMMAND TO CHECK RX TX PACKETS , DROPS , ERRORS INFORMATION ON PARTICULAR NETWORK BOND INTERFACE

Following is th command to use 

# ethtool -S eth0

 

Below is above command sample output. 

 

NIC statistics: 

     rx_packets: 165485 

     tx_packets: 8 

     rx_bytes: 9929152 

     tx_bytes: 712 

     rx_errors: 0 

     tx_errors: 0 

     rx_dropped: 0 

     tx_dropped: 0 

     multicast: 8 

     collisions: 0 

     rx_length_errors: 0 

     rx_over_errors: 0 

     rx_crc_errors: 0 

     rx_frame_errors: 0 

     rx_fifo_errors: 0 

     rx_missed_errors: 0 

     tx_aborted_errors: 0 

     tx_carrier_errors: 0 

     tx_fifo_errors: 0 

     tx_heartbeat_errors: 0 

     tx_window_errors: 0 

     gro_held: 0 

     gro_merged: 0 

     gro_normal: 0 

     gro_drop: 0 

     lro_aggregated: 0 

     lro_flushed: 0 

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

Products to which Article Applies

All Linux OS’s

Article Author: Tarun Boyella