Other Parts of This Series:
DevOps Networking Practical (Photo Credit: Unsplash)
Story:
Rasel now wanted to explore and practice the learned theoretical data communication and networking concepts hands-on. He wanted to practically capture as much information as possible about host-to-host packet transfer of each layer of the OSI model using Linux commands. From the high level, Rasel started from the below point:
- How to see the source IP and destination IP resolution using DHCP and DNS in the application layer?
- How to check this translation and NAT/PAT table?
- How to check the TCP segment and UDP datagram?
- How to check the routing table that is working at the network layer?
- How to check the MAC address table that is working at the data link layer?
- How to check the ARP table, the mapping of IP addresses and MAC addresses, and also the bridge between layer 2 and layer 3?
Understanding and practicing those networking commands will help to troubleshoot networking/connection problems effectively.
Application Layer: DHCP Negotiation and DNS Resolution
DHCP Negotiation Process
Command:
| |
Explanation:
- -v shows verbose output of DHCP negotiation.
Sample Output:
What it shows:
- DHCPDISCOVER broadcast a request for a DHCP server IP
- DHCPOFFER shows the DHCP server IP which will offer an IP address
- DHCPREQUEST accept and request to assign the offered IP address
- DHCPACK acknowledge request and contains your assigned IP, subnet mask, gateway, DNS server
- get a bound IP and valid until renewal time
DNS Resolution
Command:
Explanation:
- google.com is the domain that IP will be resolve.
Sample Output (dig):
| |
What it shows:
- You asked DNS: “What’s google.com’s IP?”
- DNS replied: 172.217.24.14
- Application-layer DNS protocol used UDP port 53
Application/Presentation/Session Layer: Check Application Connection
Check Host Availability
Command:
Explanation:
- google.com domain or 217.160.0.201 IP that availability check.
Sample Output:
| |
What it shows:
- Its pinging the 217.160.0.201 which is google.com
- Send ICMP echo request
- Get ICMP echo response
- Also shows ttl, icmp sequence number and round trip time
Check Application Status and Port Connection
Command:
Explanation:
- 80 is the port where check application running and connection status.
Sample Output (ss):
| |
What it shows:
- Its confirming port 80 is listening
Transport Layer: Analyze TCP Segment and UDP Datagram
Capture Segment/Datagram Details
Command:
Explanation:
- 80 is the port and etho is the interface where we check the inbound segment data.
Sample Output:
| |
What it shows:
- Hop information means src and dst IP
- Flags [S] – SYN packet (start of 3-way handshake)
- seq – Sequence number
- win – Window size (flow control)
Network Layer: IP and Routing
IP Address Checking
Command:
Explanation:
- Show the IP address both ethernet and wireless connection IP.
Sample Output (ip addr):
| |
What it shows:
- IP addresses with subnet mask in CIDR notation
- Also shows the interfaces
- Mac address and broadcast/gateway address
Routing and Path Checking
Command:
Explanation:
- Show the route table and tracing of path or route.
Sample Output (route):
What it shows:
- Routing entry with gateway, masking and interface
Sample Output (traceroute):
What it shows:
- Hop in route to google.com with roundtrip time it takes
Transport and Network Layer: NAT/PAT Check
Command:
| |
Explanation:
- Show the flow entries of address translation. But you must need to run this on NAT device like router/firewall.
Sample Output (ss):
What it shows:
- Your private IP 192.168.0.10 maps to public IP 203.0.113.55
- sport/dport: source and destination ports — PAT
- NAT replaces internal IP/port with public IP/port
Data Link Layer: MAC Address
Check Mac Address
Command:
Explanation:
- Show the mac address of network interface and mac address table.
Sample Output (ip link):
| |
What it shows:
- link/ether shows the mac address
Sample Output (bridge):
What it shows:
- mac address table entry
ARP Table: Bridging Layer 2 & 3
Command:
Explanation:
- Show the ip to mac mapping entry list.
Sample Output (ss):
What it shows:
- Shows IP-to-MAC mapping
- Used when sending IP packets on Ethernet
Summary:
- Check DNS IP of a Domain
- Inspect DHCP Negotiation
| |
- Capture HTTP Request
| |
- Check if Application is Listening on a Port
| |
- Diagnose Routing Issues (Hops to Destination)
| |
- Verify NAT Translation
| |
- View ARP Table (IP ↔ MAC Mapping)
- Check Network IP, Route, Interface Status and MAC Address