A regional railway opens an online lost-property service. Passengers can report a missing bag, station employees can review claims, and a small internal database stores contact details and descriptions of recovered items. On launch morning, passengers can open the website but cannot submit a claim. Someone proposes a quick repair: remove the firewall restrictions around the service until everything works. That might restore the form. It would also remove the very boundaries that keep an internet-facing website from becoming an open path into the railway's internal records.
The better question is what conversation the application actually needs. A firewall is a policy enforcement point for network traffic. It decides which communication may cross a particular boundary, based on the information and capabilities available to that firewall. It might be a network device between environments, a service in a cloud platform, or software running on an individual computer. Its location and features affect what it can observe. The general purpose is to permit necessary communication while constraining traffic that has no approved reason to cross.
Start with the passenger's request. A person on a phone reaches the public website over the internet. The website accepts a lost-item form and sends the information to an internal application component. That component checks and writes records in a database. A separate employee interface allows authorized station staff to search the reports. Those are distinct conversations even though the passenger experiences them as one service. They have different sources, destinations, privileges, and consequences if an attacker gains access.
To revisit the policy design after listening, the Certified in Cybersecurity study guide from Bare Metal Cyber provides more context about least privilege across network boundaries. Picture the public claim form and the protected database as different destinations. They serve the same business process, but they do not justify the same access.
The firewall policy should reflect that shape. Anyone may need to reach the public-facing web service, but the public should not connect directly to the internal database. The application component should be able to perform only the database operations it legitimately requires, through the intended service path. Staff should reach the employee interface through approved identity and network controls. Drawing these distinctions in words is enough to see why an instruction such as allow everything cannot be a thoughtful security requirement.
A basic traffic decision begins with source and destination. The source is the device or network initiating a communication, and the destination is the address or service it is trying to reach. A policy might distinguish internet users from station offices, application servers from databases, or management workstations from ordinary employee devices. Addresses can identify individual devices or larger groups, depending on how the network is organized. A rule that permits traffic from the public web component to one approved database is very different from a rule that permits every outside device to contact every internal system.
The next distinction is the kind of communication. Transmission Control Protocol, or TCP, and User Datagram Protocol, or UDP, are common transport protocols. They have different behavior. TCP supports a managed, reliable conversation, while UDP offers message delivery without that built-in connection and ordering model. Firewalls need to know which protocol the application uses because a rule permitting one does not necessarily permit the other. The choice is not about declaring one protocol safe and the other dangerous. It is about matching the actual application requirement.
Ports help systems distinguish services. Think of an address as identifying a building and the port as helping identify which service at that building should receive the message. It is only an analogy, but it explains why an application can be reachable by address while the needed service remains unavailable. Encrypted web applications commonly use port four hundred forty-three. A database uses a different service endpoint, often one that should never be exposed to public callers. Opening a port is not the same as deciding that everyone may use the data behind it. Application authorization must still enforce which identities can perform which actions.
A port number is also not proof of the application using it. A defender cannot assume that traffic is safe just because it uses the number commonly associated with secure web communication. The security properties depend on what software is listening, how the connection is protected, and whether the request is appropriate. Some firewalls can recognize application behavior or inspect permitted traffic more deeply, subject to their technical design and the privacy and encryption boundaries involved. Others decide mainly from addresses, protocols, and ports. The team should know which kind of enforcement it actually has rather than assume every firewall understands the contents of every connection.
The railway's investigation finds a subtle problem. The public website accepts the visitor's connection and displays the form correctly. Submission fails only when the web component tries to write to the database. That indicates the passenger-facing path is at least partly working. Opening additional public access would not directly solve the blocked internal flow. The team checks which application component is making the request, which database service should receive it, and whether the intended network policy permits that direction. The defect is a missing allowance between two trusted components, not a need to expose the database to the world.
Firewalls also have to consider the return direction of communication. Suppose an employee opens an approved supplier website. The employee's computer initiates the conversation using a temporary local port, and the server replies to that existing exchange. A stateful firewall can track the connection and recognize response traffic as belonging to the session that was already permitted. It does not normally need an unrestricted inbound rule for every possible temporary client port just so ordinary replies can return. This is one benefit of maintaining connection state rather than assessing every packet without context.
That does not mean stateful inspection approves the business transaction. A stateful firewall might correctly recognize replies from a malicious site that an employee intentionally contacted. The device can follow its connection policy while the user still faces a phishing page or harmful download. This is why safe application behavior, identity controls, protected endpoints, and appropriate web protections remain necessary. Connection state answers a narrower question: does this packet fit a conversation the policy already allows?
Outbound traffic deserves as much thought as inbound traffic. Teams often concentrate on who can enter the organization and forget that compromised systems can communicate outward. The lost-property application may need to send a confirmation message through an approved notification provider. It does not need unlimited access to unrelated destinations. A reasonable outbound policy can restrict sensitive systems to their real dependencies and make unusual communication easier to spot. Care is needed, because overly narrow rules that ignore legitimate updates, naming, or monitoring services can break operations. The goal is documented, bounded access that supports the service.
A technician suggests allowing the application servers to connect anywhere because the provider occasionally changes its network addresses. That suggestion identifies a real operational challenge, but broad permanent permission is still a poor default. The team can work with documented provider requirements, supported destination controls, managed update processes, or carefully scoped alternatives appropriate to its firewall capabilities. It can also assign responsibility for reviewing those dependencies. A security policy that works only until the next routine vendor change is fragile; one that opens the whole internet for convenience is unnecessarily permissive.
There is another principle beneath these choices: a firewall rule should have an owner and a reason. If nobody can explain why a database needs a particular connection, the rule cannot be evaluated properly during a review. A temporary exception is especially likely to survive long after its purpose disappears. Change records should describe the service, required direction, affected systems, authorizing party, expected effect, and a way to confirm the result. That gives future operators something stronger than a mysterious permit entry labeled temporary.
For practice after this lesson, Bare Metal Cyber Academy's original Certified in Cybersecurity questions can reinforce the difference between a narrow network allowance and an application-level permission. Try explaining why a passenger needs to reach a web form but should never be granted direct database access. It is a practical example of how network policy and identity policy cooperate without doing the same job.
Return to the railway. The team proposes allowing the public web component to communicate with the designated application service, and that application service to reach the particular database endpoint it uses. It keeps the employee interface behind its existing organizational access boundary. It also checks whether the public service requires a secure connection and whether the records remain protected at the application layer. A firewall can help keep unrelated systems out of reach, but a compromised application can still misuse its legitimately allowed database connection. Narrow network access reduces opportunities for movement without eliminating application vulnerabilities.
An attacker might target the web component precisely because it has an approved path to internal data. That raises an important limitation of network segmentation. A boundary can reduce the number of paths between systems, yet an allowed path still deserves strong software security, restricted service identities, logging, and review. Security architecture should assume a control can fail. The existence of a firewall does not remove the need for patching, input validation, data-handling rules, or effective incident response.
The railway also maintains a separate network for station operations. Ticketing machines, schedule displays, and administrative laptops have different purposes. A rule letting internet users reach the lost-property website should not quietly permit those same users to reach station management equipment. Firewall zones can help express these trust boundaries. A zone is a way to group systems with related security expectations so policy can regulate traffic between them. The actual rules still determine what crosses from one zone to another. A zone name alone is not a protective control.
A host-based firewall adds another useful layer. Even when the network boundary permits traffic to the application server, the server's own firewall can restrict which local services accept connections. That can limit exposure if a network rule becomes overly broad or a device moves to a different network. Host and network firewalls support different enforcement points, and their policies need coordination. A host that silently blocks a required service might create an outage, while a host that permits everything may squander the protection of its local boundary.
Cloud environments use the same reasoning, although controls may have different names and responsibility boundaries. A cloud provider may operate the underlying networking equipment while the customer configures virtual network rules around applications and data. The customer cannot assume the provider has automatically approved the correct business connections. Nor should it believe a private-looking cloud address or a provider-managed firewall proves the application is securely authorized. The responsible party and exact capabilities depend on the chosen service.
Another overlooked detail is Internet Protocol version six. A railway may have well-reviewed rules for IPv4 traffic while a service also accepts IPv6 connections. Those are separate reachable paths. A secure design needs consistent intent across the address families the environment uses. Administrators should not assume that a rule written for one family automatically covers the other. That is especially important when an application or cloud platform enables another family as part of a routine upgrade.
Logging helps determine whether policy behaved as intended. A useful firewall record can show that a specific connection was allowed or denied, with relevant source, destination, time, and policy context. But an isolated deny event is not automatically evidence of an attack. A deny might reveal a missing business dependency, a misconfigured application, a vulnerability scanner, or unwanted traffic. Context determines the response. Logging should be protected, retained according to policy, and connected to investigation processes rather than gathered without a plan to use it.
Change verification is practical rather than ceremonial. After updating the policy, the railway submits a real lost-property claim through the public website, confirms it appears for an authorized employee, and verifies that an ordinary internet user still cannot contact the database directly. The team also watches for unintended denials or unexpected access. If a problem appears, it has a documented rollback or correction path. An approval signature proves someone authorized the change; observed behavior demonstrates whether the change worked as expected.
The example also illustrates why default-deny is a sound policy starting point. When a boundary blocks connections that have not been explicitly justified, teams are encouraged to understand and record the traffic that applications truly require. That principle must be paired with a workable process for identifying dependencies and approving legitimate changes. Otherwise people may create undocumented bypasses to keep services running. The best policy is restrictive enough to limit exposure and operationally mature enough that staff can maintain it.
The lost-property website eventually accepts claims. The repair was a narrowly authorized application-to-database rule, not an open invitation into the railway's network. Passengers still reach the public service, station workers still authenticate to their own interface, and internal records remain behind a controlled boundary. A meaningful firewall decision starts with an actual business conversation, follows its source and destination, and permits the least communication needed for that conversation to succeed. When a service breaks, understanding the path is safer than widening every opening until the errors disappear.