3.5 Controlling the Traffic: Firewalls and Filtering
🌐AP Networking Unit 3 Review
3.5 Controlling the Traffic: Firewalls and Filtering
🌐 AP Networking
3.1
Planning a Network: Choosing the Right Devices and Connections
3.2
Creating a Network: Switching and Topologies
3.3
Making It Work: Connecting, Configuring, and Verifying Access
3.4
Building the Boundaries: Identifying Segmentation Security
3.5
Controlling the Traffic: Firewalls and Filtering
3.6
Restored Connections: Documenting, Diagnosing, and Fixing a Segmented LAN
continue practicing 3.5
Multiple choice
Networks aren't just about moving data from point A to point B. They're also about deciding what gets to move and who gets to connect in the first place. That's where traffic control comes in. Switches can be told which devices to trust, firewalls can split a network into zones with different rules, and access control lists give you line-by-line control over what gets through. These tools work together to keep attackers out and sensitive data in.
MAC Filtering and Switch Port Security
Every network device has a MAC address, a unique identifier burned into its network interface. MAC filtering uses those addresses to decide who's allowed on the network. Only approved MAC addresses get through. Every other address is refused.
On a switch, you can go a step further and lock down individual ports. A specific physical port can be configured to accept just one MAC address, or a limited group of them. If someone unplugs an approved laptop and plugs in their own device, the switch sees a MAC address that isn't on the approved list and blocks it. That's a physical layer of defense: even if an attacker has cable access, they can't just plug in and join the network.
Capping both the number and the range of MAC addresses tied to a port is what makes this work. It stops unauthorized devices from physically connecting.
MAC Flooding and the Fail-Open Problem
MAC filtering also helps stop a specific attack called MAC flooding. Here's what happens during a flood:
A switch keeps a table called the CAM table (Content Addressable Memory table). It maps MAC addresses to switch ports so the switch knows where to send frames. In a MAC flooding attack, an attacker blasts the switch with a huge number of distinct, fake MAC addresses. The CAM table fills up and runs out of memory.
When the table is overwhelmed, many switches enter a fail-open state. Instead of sending frames to the specific port where the destination device lives, the switch starts broadcasting all network traffic out to all nodes, like a hub. That's a disaster for two reasons:
- The network gets congested because every device is receiving every frame.
- An attacker on the network can now intercept data meant for other devices, including things like passwords or private messages.
By limiting which MAC addresses a port will accept in the first place, MAC filtering prevents an attacker from injecting the flood of fake addresses needed to pull this off.
Choosing the Right Firewall
A firewall divides a network into regions with different levels of access and blocks unauthorized movement between them. Picking the right firewall depends on a few questions:
- How much traffic inspection do you need? Simple filtering, or deep packet inspection that looks inside the actual data?
- What are you protecting? A whole organization, one zone, or a single device?
- How exposed is the network? Does it face the internet, hold sensitive data, or have untrusted users?
Firewalls come in different types based on how they filter and where they sit.
Stateless vs. Stateful vs. Next-Generation
A stateless firewall screens traffic using fixed rules based on things like IP addresses, ports, or protocols. It doesn't track or record connections. Each packet is judged on its own. Because it's simple and fast, a stateless firewall fits network segments that are simple or low-risk.
A stateful firewall goes further. It monitors active connections and can follow and log suspicious traffic. If a packet tries to sneak in pretending to be part of an existing conversation, a stateful firewall notices. It's ideal for zones that need connection awareness and logging.
A next-generation firewall (NGFW) adds advanced capabilities like intrusion prevention and application-based filtering. Instead of just checking ports, it can tell the difference between, say, regular web browsing and someone trying to tunnel a sketchy app through port 443. NGFWs suit high-risk zones or any situation that calls for detailed traffic inspection.
Where the Firewall Sits
Beyond how it filters, where a firewall lives on the network matters just as much.
A perimeter firewall guards the border between your internal network and the outside world. It's the first line of defense against outside threats. It handles high traffic volumes and enforces broad security policies on all incoming and outgoing flows. Think of it as the main gate of a building.
An internal firewall sits inside the network to separate sensitive devices or departments. Its job is to stop lateral movement, which is when an attacker who already got in tries to hop from one area to another. For example, you might put an internal firewall between the general office network and the HR servers so a random infected laptop can't reach payroll data.
Internal firewalls can also be used to create a screened subnet, also called a demilitarized zone (DMZ). A screened subnet is a lower-security zone that hosts public-facing services like a company's website. It sits between internal resources and public networks. That way, if the public web server gets hacked, the attacker is stuck in the DMZ and can't easily reach the sensitive internal network.
A host-based firewall is software running on an individual device. It gives that one endpoint extra security and lets you customize settings just for that machine. These typically protect laptops that travel between networks (like going from the office Wi-Fi to a coffee shop) or devices that need their own tailored security rules.
Quick way to match a scenario to a firewall:
- Small, low-risk segment where you just want to block certain ports: stateless
- Zone that needs to track connections and log suspicious activity: stateful
- High-risk area needing deep inspection or app-level filtering: NGFW
- Edge of the network facing the internet: perimeter
- Between departments to stop lateral movement: internal
- A single laptop that moves around: host-based
Configuring Firewall Rules with ACLs
Firewalls work off of rules that permit or deny traffic, both inbound and outbound. A full list of these rules is called an access control list (ACL).
Here's the critical thing about ACLs: they're evaluated sequentially from top to bottom. For any given packet, only the first rule whose criteria match gets carried out. After a match, the firewall stops checking. That means rule order isn't just organization, it's logic.
What's in an ACL Entry
A typical ACL entry includes:
- Direction on an interface: inbound or outbound
- Filtering criterion: an IP address, a logical port, a service, or an application
- Action: permit or deny
Different firewalls can filter on different criteria, but these three parts show up pretty much everywhere.
Ports You'll See a Lot
Some services and their ports come up constantly in ACLs. The secure ones you usually want to permit:
- HTTPS on port 443: encrypted web traffic
- DNS on port 53: resolves domain names into IP addresses
- SSH on port 22: encrypted remote command-line access
- SFTP on port 22: secure file transfer that runs over SSH
And the vulnerable, unencrypted ones you usually want to block whenever possible:
- HTTP on port 80: web traffic sent in plaintext
- Telnet on port 23: remote CLI access with no encryption
- FTP on port 21: file transfer with no encryption
Good ACL design means shutting unused or vulnerable ports while prioritizing the services you actually need. That shrinks the attack surface.
A Sample Rule Set
Here's an ACL that keeps needed services open and closes vulnerable ones:
</>CodeRule 101: PERMIT inbound TCP port 443 from any source (HTTPS) Rule 102: PERMIT inbound TCP port 22 from any source (SSH) Rule 103: DENY inbound TCP port 80 from any source (HTTP) Rule 104: DENY inbound TCP port 23 from any source (Telnet) Rule 105: PERMIT inbound UDP port 53 from any source (DNS)
Secure web, secure remote access, and DNS get through. Unencrypted web and Telnet are shut down.
Why Rule Order Matters
Because rules run in sequence, swapping two rules can completely change what traffic is allowed. Look at this short ACL:
</>CodeRule 101: PERMIT inbound TCP port 22 from any source Rule 102: DENY inbound TCP from any source
As written, SSH is allowed because rule 101 matches first for port 22 traffic. Everything else gets caught by rule 102 and blocked. That's probably what you want.
Now flip them:
</>CodeRule 101: DENY inbound TCP from any source Rule 102: PERMIT inbound TCP port 22 from any source
Every inbound TCP packet, including SSH, hits rule 101 first and gets denied. Rule 102 is never reached. SSH is completely blocked, which almost certainly wasn't the goal.
The takeaway: more specific rules go above broad, general ones. If you let a catch-all deny sit at the top, nothing below it will ever matter.
Testing Your Rules
After setting up an ACL, you need to confirm two things: intended access still works, and unauthorized access is blocked. A common quick test is using ping to try to reach other network segments and checking that access to the resources you need is still there. If a permitted user can't get to their files, a rule is probably ordered wrong or too restrictive. If an unauthorized device can get in, something is missing or too permissive.
Firewall configuration is an iterative process. Build the rules, test them, watch the logs, and adjust. The goal is a rule set that's tight enough to block threats but loose enough that the people and services you actually need can still do their jobs.
Practice Questions for 3.5
1 of 10
A technician configures an outbound access control list (ACL) for a small office to allow web browsing while blocking unauthorized services. The ACL permits Transmission Control Protocol (TCP) port 80 and TCP port 443, followed by a rule denying all other traffic. Employees report they can access websites by IP address but cannot load them using domain names. Which adjustment will resolve this availability issue without exposing vulnerable services?
A.
Insert a specific rule before the final deny rule to permit outbound UDP traffic on port 22 for name resolution.
B.
Insert a specific rule before the final deny rule to permit outbound TCP traffic on port 23 for name resolution.
C.
Insert a specific rule before the final deny rule to permit outbound TCP traffic on port 21 for name resolution.
D.
Insert a specific rule before the final deny rule to permit outbound UDP traffic on port 53 for name resolution.
Vocabulary
The following words are mentioned explicitly in the AP® course framework for this topic.Term | Definition |
|---|---|
access control list (ACL) | A list of firewall rules that determines which network traffic is permitted or denied, evaluated in order. |
broadcast | A transmission sent from one device to all nodes on a network segment. |
CAM table | A switch's memory table that maps MAC addresses to physical switch ports so frames can be forwarded to the correct destination. |
deny action | The firewall action that blocks matching network traffic from passing through. |
DNS | Domain Name System, which converts human-readable domain names (such as google.com) into IP addresses. |
fail-open state | A condition in which a switch, after its CAM table overflows, broadcasts all traffic to every node on the network. |
filtering criterion | The attribute a firewall rule checks when filtering traffic, such as IP address, logical port, service, or application. |
firewall | A security device or software that restricts which network traffic is permitted to enter or leave a network, based on rules that check details such as IP addresses, ports, and protocols. |
firewall rule | A single entry in a firewall's rule set that specifies a traffic direction, filtering criterion, and action (permit or deny). |
FTP | File Transfer Protocol, a vulnerable protocol on port 21 that transfers files without encryption. |
HTTP | Hypertext Transfer Protocol, a vulnerable protocol on port 80 that sends web communication without encryption. |
HTTPS | Hypertext Transfer Protocol Secure, the encrypted version of HTTP used to load webpages. |
inbound traffic | Network traffic arriving on an interface from outside the network. |
MAC address | A unique hardware identifier assigned to a network interface, used to identify devices on a local network. |
MAC address filtering | A control that permits only approved devices, identified by their MAC addresses, to connect to the network. |
MAC flooding | An attack in which a switch receives a large number of distinct MAC addresses, overflowing its CAM table until its memory is exhausted. |
outbound traffic | Network traffic that leaves a local network and travels toward external networks. |
permit action | The firewall action that allows matching network traffic to pass through. |
ping | A network utility that sends test packets to a host and reports response times and packet loss to measure connectivity and performance. |
port | A numbered logical endpoint used by network services and protocols to direct traffic to the correct application on a device. |
rule sequencing | The principle that firewall rules are evaluated in order from top to bottom, and only the first matching rule is applied to given traffic. |
rule specificity | The principle that more specific rules should be placed before broad, general rules in an ACL. |
SFTP | Secure File Transfer Protocol, a protocol on port 22 that transfers files securely over SSH. |
SSH | Secure Shell, a protocol on port 22 that provides protected command-line (CLI) access to a remote device. |
switch port | A physical connection point on a network switch to which a device is plugged; it can be configured to accept only specific MAC addresses. |
Telnet | A vulnerable protocol on port 23 that provides unencrypted remote command-line (CLI) access. |
traffic interception | The capture of data as it travels across a network, allowing an attacker to read or copy it. |
unused port | A port that no needed service uses and that should be closed or shut down to reduce the chance of malicious traffic. |
See Fiveable more often in Google
Mark Fiveable as a preferred source and Google is more likely to show you our guides in Top Stories, with a "preferred" badge in AI Mode and AI Overviews.