Skip to content

Network

Andrei Montchik edited this page Apr 29, 2024 · 14 revisions

Docs

Util

iftop

The console app to visualize network bandwidth. Documentation

  • Install:
    1. sudo apt update; sudo apt install iftop
  • Run: sudo iftop
    • press p to display ports
    • press n to disable/enable DNS resolution
    • press t to toggle between transmitted only / received only and bi-directional traffic
    • columns on the right are 2, 10 and 40 sec averages, press 1, 2 or 3 to sort by them

Collection of networking tools.

netstat

  • Install: apt-get install net-tools
  • List of network interfaces: netstat -i
  • Review routing table: netstat -nr
  • Review multicast groups: netstat -g
  • Find out which apps are using the specific port: sudo netstat -tuanp | grep 8003or ss -tuanp | grep 8003 or lsof -i -P -n | grep LISTEN

Sends and receives data between two computers/netwioks via TCP or UDP.

  • Install: apt-get install netcat
  • Check connectivity: netcat -vz <ip or hostname> port

Captures network traffic.

  • List of available interfaces: tcpdump -D
  • Capture 5 packets from all NICs from the specific host and port and print the ASCII content of a packet: tcpdump -i any -nn -c 5 -A host <hostname> and port <port>
  • Capture packets on the mutlicast enabled core NIC and UDP port :tcpdump -i core -vv udp port <udp port>

ethtool

Check for dropped packets.

  • Run /sbin/ethtool -S s1p1 | grep drop
    • rx_noskb_drops - number of packets dropped when there are no further socket buffers to use.
    • port_rx_nodesc_drops - number of packets dropped when there are no further descriptors in the rx ring buffer to receive them.
    • port_rx_dp_di_dropped_packets - number of packets dropped because filters indicate the packets should be dropped. This can happen when packets don’t match any filter or the matched filter indicates the packet should be dropped.
  • The Ethernet bonding driver level: cat /proc/net/bonding/core

Tuning

Increase UDP r/w buffers size

  • Check:
sysctl net.core.rmem_default; \
sysctl net.core.rmem_max; \
sysctl net.core.wmem_default; \
sysctl net.core.wmem_max;
  • Update:
sudo sysctl -w net.core.rmem_default=134217728 \
sudo sysctl -w net.core.rmem_max=134217728; \
sudo sysctl -w net.core.wmem_default=134217728; \
sudo sysctl -w net.core.wmem_max=134217728;
  • Reload the sysctl service to pick up the change: sudo sysctl -p

CLI

  • Show list of all NICs: ip a
  • Show current connection status of NICs: nmcli device status
  • Show local IP: hostname -I
  • Show public IP from external source: https://ifconfig.me/
  • Turn WIFI on/off: sudo nmcli radio wifi [on|off]

Clone this wiki locally