Skip to main content
Network Security
CHAPTER 02

Networking Fundamentals for Security

Updated: May 15, 2026
25 min read

# CHAPTER 2

Networking Fundamentals for Security

1. Introduction

To defend a network, you must first understand how it operates. A security professional cannot configure a firewall if they do not understand how an IP address works, or what a "Port" is. The internet is a complex orchestration of protocols, routers, and switches working seamlessly together. In this chapter, we will demystify the core components of network communication, focusing on the TCP/IP model, IP addressing, the role of DNS, and the difference between routing and switching.

2. Learning Objectives

By the end of this chapter, you will be able to:
  • Understand the difference between MAC addresses and IP addresses.
  • Differentiate between Private (LAN) and Public (WAN) IP addresses.
  • Define the role of the Domain Name System (DNS).
  • Identify common network Ports and Protocols (TCP/UDP, HTTP/HTTPS).
  • Understand the functional difference between a Switch and a Router.

3. Beginner-Friendly Explanation

Imagine sending a physical package through the postal service.
  • MAC Address: Your physical house. It never changes.
  • IP Address: Your mailing address (123 Main St, NY). It tells the post office where the house is located in the world.
  • Router: The local post office. It looks at the address on the package and figures out the best highway to send it on.
  • Switch: The mailroom inside an office building. It delivers packages to specific desks within the same building.
  • Port: The specific person the package is for. (e.g., "Deliver to John in Accounting").

4. IP Addresses: Public vs. Private

An IP address (e.g., 192.168.1.5) is a unique numerical identifier for a device on a network.
  • Public IPs: Assigned by your Internet Service Provider (ISP). They are globally unique and accessible from anywhere on the internet.
  • Private IPs: Used *inside* your home or office (Local Area Network). They usually start with 192.168.x.x or 10.x.x.x. The public internet cannot see or send data directly to a private IP address.

5. Routing vs. Switching

  • Switch: Connects devices together on the *same* network (LAN). When your laptop talks to your wireless printer, the traffic goes through a switch.
  • Router: Connects *different* networks together. A router connects your home LAN to the public internet (WAN). Firewalls are typically installed on routers because they are the gateway between the safe inside and the dangerous outside.

6. Ports and Protocols

Computers communicate using Protocols (rules) over logical Ports (doors). There are 65,535 ports. Crucial Ports for Security Professionals:
  • Port 21 (FTP): Unencrypted file transfer (Insecure).
  • Port 22 (SSH): Secure, encrypted remote login.
  • Port 53 (DNS): Translates domain names to IP addresses.
  • Port 80 (HTTP): Unencrypted web traffic (Insecure).
  • Port 443 (HTTPS): Encrypted web traffic (Secure).
  • Port 3389 (RDP): Windows Remote Desktop. (A massive target for hackers).

7. Mini Project: Analyze Local Network Configuration

Let's use the command line to inspect your own network configuration.

Step-by-Step Walkthrough:

  1. 1. Open your terminal or command prompt.
  1. 2. Windows: Type ipconfig and press Enter.
Linux/Mac: Type ifconfig or ip a and press Enter.
  1. 3. Look for your IPv4 Address. This is your Private IP (e.g., 192.168.1.x).
  1. 4. Look for the Default Gateway. This is the IP address of your router!
  1. 5. Ping your router: Type ping 192.168.1.1 (replace with your gateway IP). This sends a tiny packet to your router to see if it is alive and responding.

8. Real-World Scenarios

A junior system administrator installs a new Windows Server and connects it to the network. They forget to review the active ports. Port 3389 (Remote Desktop) is left open to the public internet. Within minutes, automated malicious scanners detect the open port and begin a brute-force password attack. Understanding that Port 3389 is highly sensitive and should *never* be exposed to the public internet without a VPN is foundational network security knowledge.

9. Best Practices

  • Disable Unused Ports: The core philosophy of network hardening is Attack Surface Reduction. If a server is only supposed to be a web server, use a local firewall to explicitly block every single port except Port 80 and 443.
You may use tools like ping or traceroute to map your own home network or to check connectivity to public servers (like google.com). However, utilizing "Port Scanners" (like Nmap) to scan the ports of a network you do not own is generally considered hostile activity and is illegal in many jurisdictions.

11. Exercises

  1. 1. Explain the difference between a MAC address and an IP address. Which one operates at Layer 2 of the OSI model, and which operates at Layer 3?
  1. 2. Why is it dangerous to send sensitive data over Port 80? What port should be used instead?

12. FAQs

Q: What is the difference between TCP and UDP? A: Both are protocols for sending data. TCP (Transmission Control Protocol) guarantees delivery. If a packet is lost, it resends it (used for loading web pages and downloading files). UDP (User Datagram Protocol) is fast but does not guarantee delivery. It just throws packets at the destination (used for live video streaming and gaming, where a dropped frame is better than a delayed frame).

13. Interview Questions

  • Q: Describe the function of the Domain Name System (DNS). How can an attacker manipulate DNS to compromise network security?
  • Q: Contrast the operational purpose of a Network Switch with that of a Network Router. Where does a perimeter firewall traditionally sit in this topology?

14. Summary

In Chapter 2, we built the technical foundation required for network defense. We differentiated between local switching and global routing, and understood how Private IP addresses hide behind Public IP addresses. We mapped the critical logical Ports that govern how traffic enters and exits a server, emphasizing that knowing *which* ports should be open is the first step in determining *how* to secure them.

15. Next Chapter Recommendation

Now that we know how data moves and which ports it uses, we need a digital security guard to enforce the rules. Proceed to Chapter 3: Understanding Firewalls.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·