Networking Basics


Networking Basics

Maria
Welcome to networking basics for cybersecurity. The central idea is simple: a network is a collection of connected devices that share information. Devices can be laptops, phones, servers, printers, cameras, smart appliances, or almost anything with a chip and a connection. Cables and Wi-Fi are the roads, devices are the houses, and data is the package traveling between them.

Michael
And networking matters in cybersecurity because attackers usually enter through a network. They may exploit a protocol, an open port, or a misconfigured service. Data breaches, ransomware, phishing, and man-in-the-middle attacks all operate on top of networks, so understanding the network means understanding the battlefield.

Maria
Three terms form the foundation: IP address, port, and protocol. An IP address is like the address of a device; it tells the network where data should go. A port is like a particular door on that device, identifying which service or application should receive the data. A protocol is the agreed set of rules that determines how devices start, carry out, and finish communication.

Michael
For example, HTTP defines rules for loading web pages, DNS defines rules for looking up domain names, and TCP defines rules for reliable delivery. So the quick formula is: IP address means which device, port means which service, and protocol means how the conversation happens.

Maria
Networks also come in different sizes. A LAN, or local area network, covers a small area such as a home, school lab, or office. LANs are usually fast because devices are close, and they are often private. But if an attacker gets inside a LAN, they may be able to see or reach other devices, which is why segmentation—dividing a network into isolated zones—is important.

Michael
A WAN, or wide area network, covers a large geographic area. The internet is the largest WAN, while a company might use a private WAN to connect offices in different cities. Because WAN traffic passes through ISPs, routers, and data centers, encryption is especially important. Other terms include MAN for a metropolitan-area network, PAN for a personal network such as Bluetooth, and WLAN for a wireless LAN.

Maria
A VPN is not exactly a separate network type. It is a technology that creates a private, encrypted tunnel through a public network such as the internet. Now let’s look at the hardware. A router connects different networks and directs traffic between them by reading destination IP addresses. Your home router connects your LAN to the internet.

Michael
A switch connects devices within the same network. Unlike an old hub, which broadcasts every message to every device, a switch sends traffic to the specific intended device. However, MAC flooding can overwhelm a switch and force it to behave more like a hub, allowing an attacker to capture traffic that should not be visible to them.

Maria
A firewall monitors and controls incoming and outgoing traffic according to rules. It can allow or block traffic based on IP address, port, protocol, or more complex behavior. That makes it one of the first lines of defense. A wireless access point creates a Wi-Fi network, while a network interface card, or NIC, handles network communication through Ethernet or Wi-Fi and has a unique MAC address.

Michael
Wireless networks need special attention because signals travel through the air and can be captured by devices within range. Wi-Fi encryption such as WPA2 or WPA3 helps protect that traffic. Routers are also major security targets: if an attacker compromises a router, they can influence everything flowing through it, and weak router passwords are a common vulnerability.

Maria
Large files are not sent as one giant block. They are divided into small pieces called packets. Packets contain data plus information such as the source IP, destination IP, instructions for reassembly, and error-checking information. The packets may take different routes and are reassembled at the destination. This process is packet switching, the basic way the modern internet moves data.

Michael
Packet switching also creates a security concern. Tools such as Wireshark can capture and inspect packets as they travel. If the contents are not encrypted, an attacker may be able to read them. Capturing traffic in this way is called packet sniffing or a packet-capture attack.

Maria
There are two broad interaction models. In a client-server model, a client requests something and a server responds. Your browser is a client, while a web server provides the page. Centralized servers are valuable targets because they may hold data for many clients. In a peer-to-peer model, every device can act as both client and server; BitTorrent is an example.

Michael
Peer-to-peer networks are harder to control and monitor. Malware can also use peer-to-peer communication to spread from device to device without relying on one central command server. Two other important performance terms are bandwidth and latency. Bandwidth is the maximum amount of data a connection can transfer per unit of time, measured in bits per second. Latency is the time data takes to travel from source to destination, measured in milliseconds.

Maria
A useful analogy is that bandwidth is the number of lanes on a highway, while latency is how long the trip takes. A connection can have high bandwidth but still have significant latency if the destination is far away. In cybersecurity, unusual bandwidth use or sudden latency changes can signal an attack. A denial-of-service attack, for example, can consume so much bandwidth that legitimate users cannot get through.

Michael
Now we need a framework for organizing all of this: the OSI model. It was created by the International Organization for Standardization in the 1980s to address compatibility problems between systems made by different companies. The OSI model is conceptual, with seven layers, and each layer has a specific job while communicating with the layers above and below it.

Maria
Layer one is the physical layer. It transmits raw bits as electrical signals, light pulses, or radio waves through copper, fiber, or Wi-Fi. Physical attacks include cutting or tapping cables and jamming wireless signals. Layer two is the data link layer. It organizes bits into frames, uses MAC addresses for local delivery, and performs error detection. Switches operate here, and ARP spoofing can trick devices into sending local traffic to an attacker.

Michael
Layer three is the network layer, where IP addressing and routing happen. Routers use this layer to choose paths between networks, and IP spoofing can forge a packet’s source address. Layer four is the transport layer, where TCP and UDP operate. It handles segmentation, flow control, error recovery, and port numbers. Port scanning and SYN-flood attacks are associated with this layer.

Maria
Layer five is the session layer, which manages the life cycle of communication sessions, including starting, maintaining, synchronizing, and ending them. Session hijacking occurs when an attacker steals an active session token and impersonates a logged-in user. Layer six is the presentation layer. It handles translation between formats, encryption and decryption, and compression. Weak or outdated encryption here can expose data.

Michael
Layer seven is the application layer—the layer closest to the protocols users interact with. HTTP, HTTPS, FTP, DNS, SMTP, and SSH live here. Many common attacks, including SQL injection, cross-site scripting, phishing, and malware command-and-control communication, occur at this exposed layer. A memory aid from bottom to top is: Please Do Not Throw Sausage Pizza Away—physical, data link, network, transport, session, presentation, application.

Maria
Encapsulation explains how these layers cooperate. On the sending side, the application creates data, the transport layer adds a TCP or UDP header with port information, the network layer adds IP addresses, and the data link layer adds a local MAC frame. The physical layer converts the result into bits. On the receiving side, each layer removes and interprets its own information. Going down is encapsulation; coming back up is decapsulation.

Michael
Attackers can abuse encapsulation through tunneling. For example, malware may hide information inside DNS packets to move data out of a network that permits DNS traffic. That technique is called DNS tunneling. Now compare the OSI model with the TCP/IP model, which is the practical model used by the internet and developed during the ARPANET project.

Maria
The classic TCP/IP model has four layers. The network-access layer combines the OSI physical and data-link layers and covers cables, Wi-Fi, framing, and MAC addresses. The internet layer corresponds mainly to OSI layer three and handles IP routing, including IPv4 and IPv6. It also includes ICMP, used by tools such as ping, and ARP, which maps IP addresses to local MAC addresses.

Michael
The TCP/IP transport layer handles end-to-end delivery and ports. Its two main protocols are TCP and UDP. The TCP/IP application layer combines the OSI application, presentation, and session responsibilities. Protocols here include HTTP, HTTPS, DNS, SMTP, IMAP, POP3, FTP, SFTP, SSH, DHCP, and Telnet. Knowing which protocols are secure matters: FTP and Telnet send information in plain text, while DNS and email systems can also be manipulated or abused.

Maria
OSI is useful as a mental framework for troubleshooting and classifying problems, while TCP/IP describes what actually runs the internet. Security certifications and real cybersecurity jobs expect familiarity with both models.

Michael
An IP address identifies a device and indicates its location on a network. IPv4 uses four decimal numbers from zero to 255, giving a 32-bit address and roughly 4.3 billion possibilities. Because the world has more devices than that, IPv4 addresses became scarce, and technologies such as NAT have helped extend their use.

Maria
IPv6 uses 128-bit addresses written as groups of hexadecimal values, providing an unimaginably large address space. Many networks use both versions in a dual-stack arrangement. From a security perspective, firewalls and monitoring tools must cover IPv6 as well as IPv4, because an overlooked IPv6 path can become a blind spot.

Michael
Public IP addresses are globally unique and reachable from the internet. Private IP addresses are used inside local networks. Common private ranges are 10.0.0.0 through 10.255.255.255, 172.16.0.0 through 172.31.255.255, and 192.168.0.0 through 192.168.255.255. Your router uses NAT, or network address translation, to let many private devices share one public address.

Maria
With NAT, your router replaces a device’s private source address with the router’s public address, records the translation, and converts the response back to the correct private device. NAT is not a complete security solution, but it hides internal addressing and adds a layer of obscurity. It also complicates investigations because one public IP may represent hundreds of internal devices, so investigators need NAT logs.

Michael
Static IP addresses are manually assigned and generally remain unchanged, which is useful for servers. Dynamic addresses are assigned automatically by DHCP and may change. DHCP starvation floods a network with fake requests until addresses are exhausted. An attacker can then introduce a rogue DHCP server that gives devices false network settings and routes their traffic through the attacker.

Maria
Some addresses have special meanings. The loopback address, usually 127.0.0.1, refers to the device itself. The default gateway is normally the router’s local address and receives traffic destined outside the local network. A broadcast address sends traffic to every device on a network, and attacks such as Smurf attacks have abused broadcasts to overwhelm a victim.

Michael
MAC addresses identify network interfaces at the data-link layer and are used for local communication. Unlike an IP address, a MAC address generally changes as traffic crosses networks, while the IP address remains the logical source or destination. MAC spoofing can let an attacker impersonate another device, bypass restrictions, or hide their identity.

Maria
Subnetting divides a larger network into smaller networks for organization, performance, and security. A subnet mask identifies which part of an IP address represents the network and which part represents the device. For example, 192.168.1.0 with a 255.255.255.0 mask is written in CIDR notation as 192.168.1.0/24 and provides 254 usable device addresses.

Michael
Common CIDR sizes include /8 for a very large network, /16 for a large network, /24 for a small network, and /30 for a point-to-point network. In cybersecurity, subnets can separate web servers, databases, and employee devices. If one zone is compromised, segmentation reduces the blast radius.

Maria
A port is a numbered communication endpoint from 0 through 65,535. Well-known ports run from 0 through 1,023 and support standard services. Registered ports run from 1,024 through 49,151 and are assigned to particular applications. Dynamic or ephemeral ports run from 49,152 through 65,535 and are temporary, such as the client-side port used when a browser connects to a web server.

Michael
Important ports include FTP 20 and 21, SSH 22, Telnet 23, SMTP 25, DNS 53, DHCP 67 and 68, HTTP 80, POP3 110, IMAP 143, HTTPS 443, MySQL 3306, RDP 3389, and alternate HTTP 8080. Attackers commonly scan for open ports because an open port indicates a running service that may have vulnerabilities. Closing unnecessary ports reduces the attack surface.

Maria
DNS translates names such as google.com into IP addresses. A device first checks its local DNS cache. If there is no answer, it asks a resolver, which may be provided by an ISP or a service such as 8.8.8.8. The resolver can consult root servers, top-level-domain servers, and authoritative servers before returning the address, which is then cached for later use.

Michael
DNS spoofing can return a false IP address and redirect someone to a fake site. DNS tunneling hides data inside DNS requests to move information out of a network. HTTP carries web requests but is unencrypted, so intercepted usernames, passwords, cookies, and other data may be readable. HTTPS wraps HTTP in TLS, encrypting the traffic and using a digital certificate to help verify the server.

Maria
Email uses several protocols. SMTP sends messages, commonly through ports 25, 587, or 465. IMAP reads messages while keeping them on the server and synchronizing them across devices, using ports 143 or 993 for secure connections. POP3 downloads messages to a device and commonly removes them from the server, using ports 110 or 995 for secure connections.

Michael
Email is a major attack vector, and SMTP was designed when the internet was more trusting. Protections such as SPF, DKIM, and DMARC help verify that messages come from the domains they claim to represent. SSH provides encrypted remote command-line access on port 22, unlike Telnet, which sends commands and passwords in plain text.

Maria
SSH is heavily targeted by automated bots that scan for port 22 and try many credentials. Recommended protections include disabling password login, using key-based authentication, changing the default port, and blocking repeated failed attempts with tools such as Fail2ban. For file transfer, ordinary FTP is insecure because it sends credentials and data in plain text. SFTP runs over SSH, while FTPS adds TLS encryption to FTP.

Michael
TCP and UDP exist because communication needs differ. TCP is connection-based, reliable, and ordered. It begins with a three-way handshake: SYN, SYN-ACK, and ACK. TCP acknowledges received data, retransmits missing pieces, preserves order, and uses flow control. It is appropriate for web browsing, email, file transfers, databases, and secure remote access.

Maria
TCP connections also close through a structured exchange. A SYN flood abuses the handshake by sending many connection requests without completing them, forcing a server to hold large numbers of half-open connections. SYN cookies and rate limiting are defenses. Port scanners may send a SYN and then cancel quickly; this is known as a stealth scan.

Michael
UDP is connectionless and lightweight. It does not wait for acknowledgments or retransmit lost data, so it is faster but provides no delivery guarantee or ordering. It works well for DNS, streaming, voice calls, online games, DHCP, SNMP, and TFTP, where speed can matter more than perfect delivery.

Maria
Some applications build reliability above UDP. QUIC, used with HTTP/3, runs over UDP but adds mechanisms for ordering, error handling, and recovering lost packets. UDP also makes source-address spoofing easier because there is no handshake. Attackers can exploit this in reflection and amplification attacks, such as DNS or NTP amplification, where a small forged request causes much larger responses to be sent to the victim.

Michael
So the essential comparison is: TCP establishes a connection, guarantees delivery, preserves order, handles errors, and has more overhead. UDP sends immediately, makes no guarantees, uses a smaller header, and is faster. Choose TCP when data must arrive correctly; choose UDP when speed matters more than perfection.

Maria
Let’s trace the complete journey when someone enters an HTTPS URL. First, the browser needs an IP address, so it sends a DNS query, typically using UDP on port 53, to a configured resolver. The resolver returns an address. If DNS has been poisoned, the browser may be directed to a malicious site, which is why protections such as DNSSEC and DNS over HTTPS matter.

Michael
Next, the device checks whether the destination is local. If not, it sends the packet to its default gateway. Routers read the IP header and forward the packet through a sequence of networks. IP spoofing can disguise a source address, and routing attacks such as BGP hijacking can redirect traffic on a large scale.

Maria
Because the destination is using HTTPS on port 443, TCP performs its three-way handshake. Then TLS negotiates encryption, verifies the server’s certificate, and exchanges keys. After that, the browser sends an encrypted HTTP request such as a GET request, carried inside TCP segments and IP packets.

Michael
The server processes the request and returns a response, perhaps with a 200 status, content type, and HTML. TCP reassembles the response and requests missing pieces if necessary. The browser then parses the HTML and requests additional resources such as CSS, JavaScript, and images, producing more DNS lookups and network requests.

Maria
Every stage has a possible attack surface. DNS can be poisoned, routing can be hijacked, TCP can be flooded, HTTPS can be downgraded, headers can reveal information, applications can be exploited, servers can be misconfigured, and physical links can be tapped. That is why effective cybersecurity uses defense in depth: multiple layers of protection rather than one defense.

Michael
The practical next step is to observe networking directly. Wireshark can show DNS queries, TCP handshakes, packets, and encrypted traffic. Scanning a network with Nmap can reveal open ports and services, while ping and traceroute help show whether devices are reachable and how traffic travels. Experiments should be performed on systems and networks you own or are authorized to test, such as a virtual machine or home lab.

Maria
That brings the whole foundation together: networks connect devices, IP addresses identify destinations, ports identify services, and protocols define communication. The OSI model helps us think in layers, TCP/IP explains the practical internet, subnetting organizes and isolates networks, and TCP and UDP balance reliability against speed.

Michael
Most importantly, every cybersecurity attack or defense depends on networking. Once you can follow a request from DNS resolution through routing, ports, transport protocols, encryption, server processing, and the response, the internet becomes much less mysterious—and the security decisions at every step become easier to understand.

Ask anything
We've read this whole study set, so questions about it get the best answers.