Skip to main content

debug net

OSI (Open Systems Interconnection) model

LayerNameData UnitThe JobExample / Tool
7ApplicationDataInteraction with the userHTTP, Minecraft
6PresentationDataEncryption, compression, and formattingSSL/TLS, JPEG, GIF
5SessionDataManaging the connectionNetBIOS, Sockets
4TransportSegmentEnd-to-end delivery & error checkingTCP, UDP, Port 25565
3NetworkPacketRouting and logical addressingIP, ICMP, Routers
2Data LinkFramePhysical addressing (node-to-node)MAC Address, Switches, ARP
1PhysicalBitRaw transmission of 0s and 1sCables, Wi-Fi, Fiber Optics

Debug ARP (Address Resolution Protocol)

ARP is unique because it technically operates at Layer 2 (Data Link) but sits right between Layer 2 and Layer 3. It does not use IP, TCP, or UDP. Instead, it broadcasts directly over the Ethernet/Wi-Fi frames.

tip

It's really useful for a lot of things but. I use it a lot of times to see which IP/s my host use to connect to internet.

# View your current ARP table
arp -a
arp -e
arp -n # don't resolve names
arp --help

# Delete an entry to force a new lookup (replace with an actual IP on your network)
sudo arp -d 192.168.1.50

# Watch the resolution happen in real-time (requires tcpdump)
sudo tcpdump -i any arp

Debug ICMP (Internet Control Message Protocol)

# Standard ping to your local loopback (testing your own network stack)
ping 127.0.0.1 -c 4

# Ping another machine on your network
ping 192.168.1.50

# Debug: If ping fails but ARP works, a firewall (like ufw) is likely dropping ICMP packets.

Debug TCP (Transmission Control Protocol)

tip

E.g. if you have a minecraft server and want to check that the connection is working

nc -zv [Your-Server-IP] [port]

# Debug local
# -z = scan for listening daemons; -v = verbose
nc -zv localhost 11434

# check minecraft server
nc -zv [minecraft-server-ip] 25565

Debug UDP (User Datagram Protocol)

# -u flag for UDP
nc -zuv [Your-Server-IP] [port]