network - bunnyamin/bunnix GitHub Wiki

Network

ARP

Command Example
Send request $ arping -I enp4s0 -c 3 192.168.1.1
Find duplicate IP $ arping -D -I <NETWORK DEVICE> -c 3 192.168.2.1
IP neighbor $ ip n

Device

Command Example
List USB devices (verbose) $ lsusb -v
List PCI devices with kernel driver $ lspci -k
List network interfaces $ ls -la /sys/class/net/ -> eno1 -> ../../devices/pci0000:0
List network interfaces (systemd, networkd) $ networkctl list
List wireless interfaces $ iw dev
MAC address for interface $ cat /sys/class/net/eno1/address

Gateway

IP

Port

Command Example
List processes (p) listing (l) on numerical (n) ports for TCP (t) and UDP (u) ss -ltunp

Debug

For the return values in the examples, given:

Test Example
What is the current host's FQDN? $ hostname -f -> nd1.localdomain
What is the current host's IP? $ hostname -i -> 192.168.0.101 192.168.1.101 192.168.2.101
What is the corresponding hostname and IP? $ getent hosts 192.168.0.101 -> 192.168.0.101 nd1.localdomain server servernd1 or getent hosts nd1.localdomain -> 192.168.0.101.
What is the corresponding IP to hostname? $ getent ahosts client1 -> 192.168.1.102 STREAM client1.localdomain ...
Is the IP reachable? $ ping -c 3 192.168.0.101 -> ... 3 packets transmitted, 3 received, 0% packet loss, time 2023ms
Is the IP reachable through the DNS? $ ping -c 3 server.domain -> ... 3 packets transmitted, 3 received, 0% packet loss, time 2017ms
Error Cause Remedy
Code 1 "Unspecific Reason" "We don’t know what’s wrong"
Nov 29 01:16:37 <hostname> kernel: <WIRELESS DEVICE>: authenticate with <MAC ADDRESS>
Nov 29 01:16:37 <hostname> kernel: <WIRELESS DEVICE>: send auth to <MAC ADDRESS> (try 1/3)
Nov 29 01:16:37 <hostname> kernel: <WIRELESS DEVICE>: authenticated
Nov 29 01:16:37 <hostname> kernel: <WIRELESS DEVICE>: associate with <MAC ADDRESS> (try 1/3)
Nov 29 01:16:37 <hostname> kernel: <WIRELESS DEVICE>: RX AssocResp from <MAC ADDRESS> (capab=0x431 status=0 aid=4)
Nov 29 01:16:37 <hostname> kernel: <WIRELESS DEVICE>: associated
Nov 29 01:16:38 <hostname> kernel: <WIRELESS DEVICE>: Limiting TX power to 20 (20 - 0) dBm as advertised by <MAC ADDRESS>
Nov 29 01:16:38 <hostname> kernel: <WIRELESS DEVICE>: deauthenticating from <MAC ADDRESS> by local choice (Reason: 1=UNSPECIFIED)
unknown pinging? Cannot confirm whether the connection worked or the ping caused the connection to work. The ip addr did not show an assigned IPv4 address for <WIRELESS DEVICE>. However, an attempt to test the connection with ping -c 3 8.8.8.8 resulted in success.
RTNETLINK answers operation not possible due to RF-kill rfkill unblock all

Ping

Test Example
Connect three times (-c3) and return failed responses (-O) while ignoring successful ones (-q). $ ping -Oqc3 example.org
Error Cause Remedy
Destination Host Unreachable No Internet connection because of strict firewall rules.
Destination Host Unreachable No Internet connection because of wrong Gateway.
Name or service not known Unknown
System Error An invalid syntax in /etc/nsswitch.conf

Traffic

  • tcpdump -i <NETWORK INTERFACE>eth0 -nn -s<INTEGER>0 -v -A port <PORT>80
    • Do not resolve hostname (-n) and port name (-nn).
    • Decode package as Ascii (-A).
    • Truncate the "snap" length of the package "snaplen" (-s), where 0 represents the default value of 262144 bytes.
    • Filter packages that are not TCP (tcp or proto 6).
    • Filter packages that are not UDP (udp or proto 17).
    • The host parameter captures all incoming and outcoming traffic to host. The parameters src and dst captures traffic to and from the host respectively.

Wireless

⚠️ **GitHub.com Fallback** ⚠️