debug net
OSI (Open Systems Interconnection) model
| Layer | Name | Data Unit | The Job | Example / Tool |
|---|---|---|---|---|
| 7 | Application | Data | Interaction with the user | HTTP, Minecraft |
| 6 | Presentation | Data | Encryption, compression, and formatting | SSL/TLS, JPEG, GIF |
| 5 | Session | Data | Managing the connection | NetBIOS, Sockets |
| 4 | Transport | Segment | End-to-end delivery & error checking | TCP, UDP, Port 25565 |
| 3 | Network | Packet | Routing and logical addressing | IP, ICMP, Routers |
| 2 | Data Link | Frame | Physical addressing (node-to-node) | MAC Address, Switches, ARP |
| 1 | Physical | Bit | Raw transmission of 0s and 1s | Cables, 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]