Key Takeaways

  • TCP/IP is the foundational protocol suite of the Internet.
  • Understanding layers helps troubleshoot problems systematically.
  • IP addressing and subnetting are essential skills.
  • TCP provides reliable, ordered delivery; UDP is faster but unreliable.
  • Ports identify applications on a host.
  • Command-line tools are essential for network troubleshooting.

1. Introduction to TCP/IP

TCP/IP (Transmission Control Protocol/Internet Protocol) is the suite of communication protocols that power the Internet. It defines how data is packaged, addressed, transmitted, and received. Understanding TCP/IP is fundamental for network administrators, security professionals, and developers alike.

The model is often compared to the theoretical OSI model, but TCP/IP is the practical implementation used globally.

2. Network Layers

2.1 TCP/IP vs OSI Model

OSI LayerTCP/IP LayerProtocols/Examples
7. ApplicationApplicationHTTP, HTTPS, FTP, SMTP, DNS
6. PresentationSSL/TLS, JPEG, ASCII
5. SessionNetBIOS, RPC
4. TransportTransportTCP, UDP
3. NetworkInternetIP, ICMP, ARP
2. Data LinkNetwork AccessEthernet, WiFi (MAC addresses)
1. PhysicalCables, radio waves
Encapsulation

Data is wrapped in headers as it passes down layers. Application data → TCP segment → IP packet → Ethernet frame. Each layer adds its own header with relevant addressing and control information.

3. IP Addressing & Subnetting

3.1 IPv4 Addresses

# IPv4 address structure
192.168.1.100 = 32 bits (4 octets)

# Private IP ranges (RFC 1918)
10.0.0.0 - 10.255.255.255    (/8)
172.16.0.0 - 172.31.255.255  (/12)
192.168.0.0 - 192.168.255.255 (/16)

# Special addresses
127.0.0.1  = Localhost (loopback)
0.0.0.0    = All interfaces / default route
255.255.255.255 = Broadcast

3.2 Subnetting

# Subnet mask and CIDR notation
255.255.255.0 = /24 = 256 addresses (254 usable)
255.255.255.128 = /25 = 128 addresses (126 usable)
255.255.255.192 = /26 = 64 addresses (62 usable)

# Example: 192.168.1.0/24
Network: 192.168.1.0
First host: 192.168.1.1
Last host: 192.168.1.254
Broadcast: 192.168.1.255

3.3 IPv6

# IPv6 address structure
2001:0db8:85a3:0000:0000:8a2e:0370:7334 = 128 bits

# Shortened form
2001:db8:85a3::8a2e:370:7334

# Special addresses
::1 = Localhost
fe80::/10 = Link-local addresses

4. TCP vs UDP

FeatureTCPUDP
ConnectionConnection-oriented (3-way handshake)Connectionless
ReliabilityGuaranteed delivery, retransmissionNo guarantee
OrderingOrdered deliveryNo ordering
SpeedSlower (overhead)Faster
Use CasesHTTP, HTTPS, SSH, FTPDNS, VoIP, gaming, streaming

4.1 TCP 3-Way Handshake

# TCP connection establishment
Client → Server: SYN (seq=x)
Server → Client: SYN-ACK (seq=y, ack=x+1)
Client → Server: ACK (ack=y+1)

# Connection closed with FIN handshake

5. Ports & Protocols

5.1 Common Ports

PortProtocolService
20, 21TCPFTP
22TCPSSH
23TCPTelnet
25TCPSMTP
53TCP/UDPDNS
80TCPHTTP
443TCPHTTPS
3389TCPRDP

6. Routing Fundamentals

# View routing table (Windows)
route print
netstat -rn

# View routing table (Linux)
ip route
route -n

# Default route example
0.0.0.0/0 via 192.168.1.1 (gateway)
NAT (Network Address Translation)

NAT allows multiple devices on a private network to share a single public IP. The router translates private IPs to the public IP for outbound traffic and reverses for responses. This is why your home devices have 192.168.x.x addresses but appear as one IP on the internet.

7. Troubleshooting

7.1 Essential Commands

# Test connectivity
ping hostname/IP

# Trace route
tracert hostname  (Windows)
traceroute hostname  (Linux)

# DNS lookup
nslookup hostname
dig hostname

# Show connections and listening ports
netstat -an
ss -tuln  (Linux)

# Show network configuration
ipconfig /all  (Windows)
ip addr show  (Linux)

7.2 Troubleshooting Methodology

  1. Check physical connectivity
  2. Verify IP configuration (correct IP, subnet, gateway)
  3. Ping localhost (127.0.0.1) - test TCP/IP stack
  4. Ping gateway - test local connectivity
  5. Ping external IP - test routing
  6. Ping hostname - test DNS
Wireshark

For deep packet analysis, Wireshark is essential. Capture traffic to see exactly what's happening on the wire—protocol issues, malformed packets, connection problems, and security issues become visible.

8. Frequently Asked Questions

What's the difference between IP and MAC addresses?
IP addresses are logical, used for routing across networks (Layer 3). MAC addresses are physical, burned into network cards, used for local network communication (Layer 2). ARP maps IP to MAC for local delivery.
Why is IPv6 adoption slow?
NAT extended IPv4's life by allowing many devices to share public IPs. Upgrading requires changes to infrastructure, applications, and training. The transition is happening but gradually—most networks run dual-stack (both IPv4 and IPv6).

Conclusion

TCP/IP knowledge is foundational for IT and security professionals. Understanding how data flows through layers, how addressing works, and how to troubleshoot systematically are skills that apply across networking, system administration, and security. Master these fundamentals and you'll have a solid base for advanced networking and security topics.

Continue Learning:
DNS Guide Network Monitoring