Chapter 15: Amazon VPC — Subnets, Route Tables, NACL, NAT Gateway and Bastion Host
15.7 Network ACL: inbound and outbound rules, rule numbers and blocking an IP
A security guard stands at the entrance of the wing. He has a list of rules – he reads them in order and applies the first rule that matches. And this guard is forgetful: a person who went in is checked again when coming out. That is stateless. Note – technically, the NACL checks applicable packets at the subnet boundary. AWS documents infrastructure traffic exceptions.
Wing च्या entrance वर एक security guard उभा आहे. त्याच्याकडे rules ची list आहे – तो क्रमाने वाचतो, आणि जो पहिला rule लागू होतो, तेच करतो. आणि हा guard विसरभोळा आहे: आत गेलेल्या माणसाला बाहेर येताना पुन्हा check करतो. हेच stateless. लक्ष द्या – technically NACL subnet boundary वर लागू होणारे packets check करतो. काही AWS infrastructure traffic अपवाद आहेत.
Wing के entrance पर एक security guard खड़ा है. उसके पास rules की list है – वह क्रम से पढ़ता है, और जो पहला rule लागू होता है, वही करता है. और यह guard भुलक्कड़ है: अंदर गए आदमी को बाहर आते समय फिर से check करता है. यही stateless है. ध्यान दो – technically NACL subnet boundary पर लागू packets को check करता है। कुछ AWS infrastructure traffic इसके अपवाद हैं।
A network ACL (NACL) is a firewall at the subnet level. It has inbound and outbound rules, and each rule either allows or denies traffic.
- Every subnet is associated with exactly one network ACL; one network ACL can serve many subnets.
- The original default network ACL has broad inbound and outbound allow rules for the applicable address families. It can be modified.
- A custom network ACL denies all inbound and outbound traffic until you add rules.
- Each rule has a number from 1 to 32766. Rules are evaluated from the lowest number upwards, and the first matching rule wins; higher rules are not checked.
- The last rule, shown as
*, denies anything that matched no numbered rule. You cannot delete it. - Network ACLs are stateless: a reply is checked again as new traffic, so return traffic needs its own rule.
- Rules are checked when traffic enters or leaves the subnet, not between instances inside the same subnet.
- Quota: 20 inbound and 20 outbound rules per network ACL by default (adjustable up to 40 each).
The network ACL checks rules from the lowest number. The request from 203.0.113.25 matches rule 90 Deny and is dropped at the subnet edge. The request from 198.51.100.7 skips rule 90, matches rule 100 Allow at this subnet boundary. The service also needs the remaining path and controls. Both addresses are documentation examples.
Network ACL rules सगळ्यात लहान number पासून check करतो. 203.0.113.25 वरून आलेली request rule 90 Deny ला match होते आणि subnet च्या edge वरच drop होते. 198.51.100.7 वरून आलेली request rule 90 सोडून rule 100 Allow ला match होते आणि subnet ACL ती परवानगी देतो. Nginx पर्यंत जाण्यासाठी बाकीचे controls पण लागू होतात. दोन्ही addresses documentation examples आहेत.
Network ACL rules को सबसे छोटे number से check करता है. 203.0.113.25 से आई request rule 90 Deny से match होती है और subnet के edge पर ही drop हो जाती है. 198.51.100.7 से आई request rule 90 छोड़कर rule 100 Allow से match होती है और subnet ACL उसे अनुमति देता है। Nginx तक पहुँचने के लिए बाकी controls भी लागू होते हैं। दोनों addresses documentation examples हैं.
Why ephemeral ports 1024–65535 are needed
When a browser opens http://<WEB_PUBLIC_IP>, it connects from a random high source port (for example 52814) to port 80. The server's reply goes back to port 52814. That random port is an ephemeral port. Client operating systems choose their ephemeral port range and the setting can vary by host. A NAT gateway can use 1024–65535. This lab uses that wider range where it needs to accommodate those clients. Restrict source or destination CIDRs and use the range required for each flow:
- outbound, for replies to visitors who connected to your servers,
- inbound, for replies to connections your servers started (for example
yumdownloading updates).
Forget this, and the request arrives but the reply is dropped. A security group normally permits replies to allowed tracked connections without a separate return-port rule. Its tracking behavior and rules for new connections are separate.
Example: a custom network ACL for the public subnet
Inbound rules:
| Rule # | Type | Protocol | Port range | Source | Allow / Deny |
|---|---|---|---|---|---|
| 90 | All traffic | All | All | 203.0.113.25/32 (documentation example of a denied source) |
Deny |
| 100 | HTTP | TCP | 80 | 0.0.0.0/0 |
Allow |
| 110 | HTTPS | TCP | 443 | 0.0.0.0/0 |
Allow |
| 120 | SSH | TCP | 22 | 198.51.100.7/32 (documentation example of your IP) |
Allow |
| 130 | Custom TCP | TCP | 1024–65535 | 0.0.0.0/0 |
Allow |
| * | All traffic | All | All | 0.0.0.0/0 |
Deny |
Outbound rules:
| Rule # | Type | Protocol | Port range | Destination | Allow / Deny |
|---|---|---|---|---|---|
| 100 | HTTP | TCP | 80 | 0.0.0.0/0 |
Allow |
| 110 | HTTPS | TCP | 443 | 0.0.0.0/0 |
Allow |
| 120 | Custom TCP | TCP | 1024–65535 | 0.0.0.0/0 |
Allow |
| 130 | SSH | TCP | 22 | 10.0.0.0/16 |
Allow |
| 140 | Custom TCP | TCP | 9000 | 10.0.2.0/24 |
Allow |
| * | All traffic | All | All | 0.0.0.0/0 |
Deny |
Rule 90 is checked before rule 100, so the blocked address is dropped even though rule 100 allows port 80 for everyone. In this deliberately broad sample, outbound rule 130 allows the approved SSH destination range. Traffic to the app on port 9000 already matches rule 120 before the narrower rule 140. A narrowly scoped design needs to account for the actual return traffic and app destination separately. The addresses 203.0.113.0/24 and 198.51.100.0/24 are reserved for documentation, so they are safe examples; use real addresses in your own rules.
How do I block one IP address or a whole range?
A subnet ACL supports an explicit deny on eligible traffic when the intended source is visible at that boundary. Check the actual ACL association and every subnet it serves. Other enforcement layers, such as a supported web policy, can fit HTTP-specific requirements. For an approved subnet rule, place the deny before the matching allow.
- VPC → Subnets → select
web-public-1a→ Network ACL tab → click the ACL ID. - Inbound rules → Edit inbound rules → Add new rule.
- Rule number
90, Type All traffic, Source203.0.113.25/32, Allow/Deny Deny. - For a whole range, add another rule, for example Rule number
80, Source203.0.113.0/24, Deny. - Save changes. The change applies to every subnet using this ACL after a short time.
For an approved isolated sandbox change, see the create-network-acl-entry reference. Verify the actual ACL ID, direction, unused number, protocol and approved address range before editing.
/32 means exactly one address; /24 covers 256 IPv4 addresses. The rule applies where its other fields also match. A deny rule with a number higher than the allow rule (for example 200 after an allow-all rule 100) does nothing, because rule 100 matches first. Once a matching deny rule takes effect, subsequent matching packets can be dropped even on an existing connection. Check the actual flow direction and applicable exceptions.
Ravindra Bagale's Tip
If a custom NACL allows an incoming request but a client times out, inspect the outbound direction for the response to the client’s temporary destination port. Allow the required range and address scope. A security group handles tracked replies differently.
Ravindra Bagale's Tip – मराठी
Custom NACL मध्ये incoming request allow असूनही timeout आला तर reply चा outbound rule तपासा. Client च्या temporary destination port ची योग्य range आणि address scope पाहा. Security group tracked replies वेगळ्या प्रकारे हाताळतो.
Ravindra Bagale's Tip – हिंदी
Custom NACL में incoming request allow होने के बाद भी timeout आए तो reply का outbound rule देखो। Client के temporary destination port की सही range और address scope जाँचो। Security group tracked replies अलग तरीके से संभालता है।
Ravindra Bagale's Tip
To block an IP, keep the deny rule's number lower than the allow rule – 90 before 100. Many students give the deny rule number 200 and then say "it doesn't block", because rule 100 matches first. And if you block your own IP by mistake, SSH goes too – remove the rule from the console. Remember the order.
Ravindra Bagale's Tip – मराठी
IP block करायचा असेल तर deny rule चा number allow rule पेक्षा कमी ठेवा – 90 before 100. बरेच students deny rule ला 200 number देतात आणि मग "block होत नाही" म्हणतात, कारण rule 100 आधीच match होतो. आणि तुमचाच IP चुकून block केला तर SSH पण जातो – rule console मधून काढा. क्रम लक्षात ठेवा.
Ravindra Bagale's Tip – हिंदी
IP block करना हो तो deny rule का number allow rule से कम रखो – 90 before 100. बहुत से students deny rule को 200 number देते हैं और फिर कहते हैं "block नहीं होता", क्योंकि rule 100 पहले ही match हो जाता है. और अपना ही IP गलती से block कर दिया तो SSH भी चला जाता है – rule console से हटाओ. क्रम याद रखो.
Lab
Use the offline exercise below to test first match, return ports and allowed controls. For any separate authorised sandbox experiment, verify the ACL’s association scope, keep a tested restoration method and avoid changing a live or shared management path.
Step-by-step guide
Read the request and reply as two separate boundary decisions
The training centre opens its timetable through an approved public web entry. During a lab someone creates a new subnet traffic policy and allows incoming HTTPS. A student's browser still waits and eventually reports a problem. The change did allow a particular type of packet to enter. It did not ensure that the subnet policy also permits the server's replies. Those two facts can both be true. In a network access control list, the outbound direction is evaluated separately from the inbound direction.
A network access control list is a set of subnet-level rules, often called a network ACL or NACL. One network ACL is associated with a subnet at a time. The same ACL can serve multiple subnets. It evaluates applicable traffic when it enters or leaves the subnet, with distinct inbound and outbound lists. It can allow or deny incoming and outgoing traffic by the relevant address range, protocol and port or other protocol fields. It is stateless, which means it does not remember that it allowed a related packet earlier.
Write down a concrete flow before choosing a rule. A fictional client address of 198.51.100.7 starts a TCP connection from a temporary source port, say 52814, to the web listener on 443. The service's endpoint sends replies from 443 back to the client on 52814. The client's temporary port is known as an ephemeral port. It exists so the operating system can keep this connection distinct from other ones. A service port and a temporary port both appear in the same flow but play different roles.
You will practice choosing the winning ACL rule, determining return ports and checking adjacent subnets. The worked lab evaluates example packets in memory. It neither sends traffic to the example addresses nor changes any AWS resources. That allows you to test a deny and verify a repair without disrupting a lab, losing an administrator connection or spreading a rule to multiple real placements. For an authorised account, the optional inventory shows how to match the same facts in the console.
Read the direction, address, protocol, and destination port
The meaning of the address field depends on which list you are reading. An inbound rule uses the source CIDR range. For the visitor's packet above, the source is 198.51.100.7 and its destination port is 443. An outbound rule uses the destination CIDR range. The response goes to the visitor's address, and the destination port is 52814. The same address can appear in both rule lists, but it describes a different side of the packet. Write the whole tuple if you are unsure about which field to match.
A CIDR identifies a set of addresses. In IPv4 a slash-32 prefix stands for exactly one address. A slash 24 represents 256 possible IPv4 addresses. IPv6 uses its own family-specific CIDRs, including slash 128 for a single address. An IPv4 deny for a client address says nothing about IPv6 traffic. If the public service supports both families, confirm each family's actual path and policy. A dual-stack user can have several different source addresses across network contexts. Keep the test assumptions explicit when comparing permitted and denied traffic.
The protocol is part of the decision. For TCP and UDP rules, the specified port range matches the packet's destination port. Other protocols can have their own fields. Internet Control Message Protocol, usually called ICMP, identifies messages by type and code. An ICMP test such as a ping does not supply the same evidence as a TCP connection to the web listener. Treat responses that support network functions, such as path MTU discovery, according to the documented design. A blanket decision to block everything except the expected service port can unexpectedly disrupt legitimate control traffic.
For the training example, make a small two-row table on paper. The inbound row has source client, destination web, destination port 443 and desired allow. The outbound row has source web, destination client, destination port 52814 and desired allow. You are recording decisions at the web subnet boundary. The example is not yet considering any other subnet or resource policy. If a private app makes a new connection to a database, write a separate pair of rows. Its own temporary source port will normally differ from the one chosen by the visitor.
Preserve the full direction in troubleshooting notes. An operation might fail somewhere in the network, reject the requested identity or produce an application error. The ACL only sees its supported packet properties. It does not see that a browser is logged into the staff function, whose course record it asked for, or whether a database query succeeded. Use approved credentials and valid service tests when checking those additional layers. A rule that lets the network traffic through is one prerequisite, not the end of the investigation.
Predict the first match, including an earlier broad allow
AWS evaluates numbered ACL rules in ascending order within the applicable direction. The first rule matching the packet's properties decides the action. A later rule with a narrower address range does not override an earlier broad match. This is different from selecting a most-specific CIDR in a route table. The ACL rule number determines its order. The address and protocol test determines whether that ordered candidate applies. If no numbered rule matches, the final asterisk rule denies the traffic.
Imagine inbound rule 100 allows TCP port 443 from all IPv4 sources in the model. Rule 200 denies TCP port 443 from 203.0.113.25/32. A connection packet from that address to 443 matches rule 100 first, so the later deny is never considered. Move the narrow deny logically to rule 90 and compare again. It now applies first for that one address. A different source skips rule 90 and reaches rule 100. This demonstrates both a correctly restricted result and an allowed control. The addresses in the example are reserved for documentation, not targets for testing real connectivity.
Choose the denial scope on purpose. A deny for all protocols from one source can affect other services such as a bastion if those use the same boundary. A TCP 443 deny for that source applies only to the specified protocol, direction and port. A slash-24 deny affects all addresses under that IPv4 range when the other fields match. It is broader than a single source and can affect other legitimate clients. If many visitors share an internet access address, a deny on that address can affect more than the one person recorded in a web log. Use the intended enforcement layer and the smallest range that fits the policy.
Set rule numbers with room between them in an owned new policy. Starting in increments can allow a later reviewed exception to be inserted before another rule without renumbering everything. A revision still needs a verified view of all entries. A lower numbered allow can also cancel what someone expected from a deny. Trace the matching case from the first numbered row, not just the last edited row. If you are dropping traffic from one source, confirm a neighboring permitted test source continues to receive the correct service response.
Initial defaults can be confusing. An ordinary VPC default ACL starts with broad allows in both directions for its applicable address families. A newly created custom ACL has a default deny behavior for traffic without an explicit allow. Looking at a custom ACL with two empty numbered lists is not an indication the network is unrestricted. The final deny is already there. An existing default ACL may have been modified. Evaluate the actual ACL rules and the subnet association rather than depending on the resource name.
Find the return port without assuming one universal client range
For a public service, the client initiates the connection. Its operating system chooses a local temporary port under its configuration. On the return path, the server's response uses the temporary client port as its destination. At the server subnet ACL, the return packet is outbound toward the client. An outbound rule that allows only packets with destination port 443 does not cover those ordinary replies. Port 443 is the service's source port in that direction. The listener can be correctly configured, yet replies can be dropped on the way out.
Now reverse the roles. The private app initiates HTTPS to a permitted update system. The app is the client, so it uses a temporary local port of its own. The outbound packet from the app subnet has destination 443 at the update system. The return packet enters the app subnet with destination equal to the app's temporary port. This time the rule for the return range belongs in the inbound list of the app's subnet ACL. If the app and web service use two different associations, check both. There is no independent ephemeral-port direction that applies to all architectures.
There is also a difference between an example port and a supported operational range. A controlled lab can allow 52814 for one known sample client, but an actual client generally chooses a range and may choose another port on its next connection. AWS lists different example ranges for operating systems and load balancing. It documents that a NAT gateway uses 1024 through 65535. An owned design should use the required range at the relevant observation point, based on the actual initiating client and intermediaries. A broad 1024–65535 TCP example is sometimes appropriate for a designed type of traffic, not an instruction to authorise it in every direction or for every CIDR.
To reason about a NAT path, remember that a translation device can change the tuple that is visible on the other side. A private app's temporary port and the translated port used on the outside path are not necessarily the same. An ACL checks the packet as it crosses its own subnet boundary. Document the initiator, actual addresses and ports for the intended observation point. Use the provider's details for the selected NAT and subnet layout. For a controlled first lab without NAT, you can reason about exact ports without translation changing them.
A network ACL does not track which connection came first, so its allowance for return-range packets is based on the fields you chose. Any packet matching the same scope can satisfy that ACL rule. A security group can account for supported tracked traffic at the resource interface. The rule for an allowed tracked request usually permits its corresponding replies without adding a matching high-port inbound or outbound security group rule. A security group also needs rules for the side initiating new permitted traffic. These two policies are designed and diagnosed separately.
The same return reasoning applies to a load balancer. The public client's connection to the load balancer is one flow. A backend or health-check request from the load balancer to a target is a separate flow with its own addresses and ports. A target subnet ACL can see the load balancer path rather than the original visitor's packet. If the backend normally uses the load balancer as its source, an original client address may appear in an HTTP header or application log but no longer be the source field in the subnet's packet. Choose the layer that sees the relevant identity correctly.
Review the four parts of a cross-subnet service connection
The centre's web and app each have their own subnet. Assume for this worksheet that web uses private source 10.76.20.10 and starts a FastCGI connection from TCP 49600 to app address 10.76.20.130 on TCP 9000. The app then answers that connection. Both addresses belong to the VPC, so the ordinary route can stay local. When both subnets have restrictive network ACLs, the packet crosses two ACL boundaries for that request and two for its reply. A correct allowance in only the destination subnet is incomplete.
| Point being checked | Relevant address on this rule | TCP destination port | Purpose |
|---|---|---|---|
| Web subnet outbound | App address or approved app range | 9000 | Let the web gateway start the FastCGI connection. |
| App subnet inbound | Web address or approved web range | 9000 | Let the request reach the app listener. |
| App subnet outbound | Web address or approved web range | 49600 in this one recorded flow | Let the app send its reply to the web source port. |
| Web subnet inbound | App address or approved app range | 49600 in this one recorded flow | Let the web gateway receive the app reply. |
Write a separate four-row worksheet for the app-to-database connection. Change the initiator to the private app, the destination to the database and the service port to whatever the database actually uses. The app's next temporary port is separate. The web client does not need a database permission merely because its application request triggers a read. If a learner adds a rule allowing the entire VPC to talk on every service port, ask which one required connection that rule is meant to support. The directional worksheet helps choose the smallest useful approved match.
A broad earlier rule can also make a later narrow allow redundant. For example, if the web subnet allows all outbound TCP destination ports from 1024 through 65535 to any IPv4 address, the later narrow outbound allowance for port 9000 to the app does not control that connection. It already matched the earlier range. The worksheet should show actual first matches, not merely which row was added to explain the intended behavior. Keep the broad range for traffic that genuinely needs its reply path, with the appropriate address scope and rule order. Combining subtasks under one broad range can introduce unwanted initiations.
Two resources inside the same subnet do not cross that subnet's ACL boundary for ordinary same-subnet traffic. Their interface security groups, software firewalls and listeners still matter. If the goal is to isolate resources within one subnet, a subnet ACL is not the right control for that local exchange. If the network design requires a distinct subnet-level policy, choose an actual separate placement and connect it intentionally. The scope follows the packet and the association, not the name of the list.
Run first-match and reply checks without touching a network
Use Python 3 and a terminal. The script represents TCP traffic with source and destination addresses and ports. It is a simple model of the requested bits of rule selection, not a full AWS firewall. It ignores application behavior, NAT, connection tracking and service-specific exceptions. First a late deny fails to override the earlier HTTPS allow. Then a lower numbered deny works while another IPv4 visitor remains allowed on the same protocol and port. Next the reply fails when only outbound destination 443 is allowed. Finally the example adds a reply rule covering the approved client range and temporary port.
python3 - <<'PY'
from dataclasses import dataclass
from ipaddress import ip_address, ip_network
@dataclass
class Packet:
source: str
source_port: int
destination: str
destination_port: int
def decision(direction, packet, rules):
peer = ip_address(packet.source if direction == 'in' else packet.destination)
for number, action, cidr, first_port, last_port in sorted(rules):
network = ip_network(cidr)
if peer.version != network.version:
continue
if peer in network and first_port <= packet.destination_port <= last_port:
return number, action
return '*', 'deny'
excluded_source = Packet('203.0.113.25', 52814, '10.76.20.10', 443)
visitor = Packet('198.51.100.7', 52814, '10.76.20.10', 443)
reply = Packet('10.76.20.10', 443, '198.51.100.7', 52814)
https = (100, 'allow', '0.0.0.0/0', 443, 443)
late_deny = (200, 'deny', '203.0.113.25/32', 443, 443)
early_deny = (90, 'deny', '203.0.113.25/32', 443, 443)
assert decision('in', excluded_source, [late_deny, https]) == (100, 'allow')
assert decision('in', excluded_source, [https, early_deny]) == (90, 'deny')
assert decision('in', visitor, [https, early_deny]) == (100, 'allow')
print('The early deny blocks just the modeled source, even when listed last in the input.')
assert decision('out', reply, [https]) == ('*', 'deny')
print('Outbound destination port 443 does not match the reply to 52814.')
reply_rule = (120, 'allow', '198.51.100.0/24', 49152, 65535)
assert decision('out', reply, [https, reply_rule]) == (120, 'allow')
print('The modeled reply matches the approved client range and temporary port rule.')
ipv6_visitor = Packet('2001:db8:90::7', 52814, '2001:db8:76::10', 443)
assert decision('in', ipv6_visitor, [https, early_deny]) == ('*', 'deny')
https6 = (110, 'allow', '2001:db8:90::/64', 443, 443)
assert decision('in', ipv6_visitor, [https, early_deny, https6]) == (110, 'allow')
print('The IPv4 entries did not supply an IPv6 allow. An IPv6 entry did.')
PY
Inspect the source and destination on the reply object. They are swapped from the permitted visitor's object, along with their ports. The rule function always checks the destination port. It chooses the source address on inbound and the destination address on outbound. That is why adding an outbound allow on destination port 443 fails to cover the server's reply. The last rules deliberately assess an IPv6 connection separately. The test focuses on its inbound direction; to complete the flow, describe corresponding IPv6 outbound destination scope and the selected temporary port.
Now deliberately change the example client's temporary port to 48000 on the initial packet and the return object. The narrow example scope of 49152–65535 no longer includes the destination port of the reply. The assertion expecting rule 120 would fail. Explain why that is the expected behavior before updating the test. Ask what legitimate client configurations the actual design supports and where in the architecture to check the appropriate range. Do not generalise the controlled range to every application.
Finish with a one-source and one-neighbor control. Predict the effect on IPv4 if the excluded example address is replaced with an agreed known allowed test address. Record the exact rule number instead of saying only that everything works. Then restore the script input. The code creates no files, processes that stay active, or cloud resources. It is safe to repeat and provides no evidence about the account's live policies. The benefit is a clear trace of which packet should match which rule under the stated inputs.
Apply the restriction where the actual address is visible
The training centre originally served its timetable directly from a public web server. A subnet ACL at that edge can evaluate the source address of the network connection crossing that subnet. Later the team adds an application load balancer. An approved network connection from the load balancer to a private app can now form the backend path. The app's subnet still has an ACL, but the source crossing it on that path is no longer necessarily the original family visitor. Ask which network interface and connection a rule describes. A defensive rule written for the old direct path may not describe the new path.
A web policy may be more appropriate when the requirement is about a particular HTTP request. AWS WAF uses web ACLs for supported services. Despite the similar abbreviation, this is a different enforcement layer from the VPC network ACL. The policy can evaluate web properties instead of raw subnet packet fields. If a trusted proxy forwards client identity in a header, use the documented handling and trust model of the deployed web service. Treat a header that can come from an arbitrary caller as untrusted unless the architecture establishes and preserves the expected source. Check how the rule handles absent or invalid forwarded identity under the approved design.
Run a simple decision exercise. The operations team needs to restrict direct traffic to a reserved lab web endpoint from a specific approved test source. The packet-layer restriction and a subnet-level test can show the relevant direct path. A different requirement asks to limit requests to the form path without affecting the published schedule at the same host. Those requests can use the same TCP connection and port. The subnet ACL sees their same network fields and cannot make the desired HTTP-path decision. Choose an appropriate application or managed web control for the path-based policy and use observed application responses.
A shared public IPv4 address can represent many people using one provider or company network. Someone seeing a source in a log should describe it as a source address observed at that boundary. It is not proof of an individual person or a permanent address. Some legitimate clients also change networks and use different addresses. Record the exact control requirement. A rule using an address range is suitable only when that address scope identifies what the policy actually needs to restrict. Confirm with the application and network owners before applying it to a shared endpoint.
Distinguish the observed packet, the policy and the application result
After a network team deployment, a browser can connect to an existing site but sometimes a large download stops partway through. Start by proving which ordinary paths still work. A small response can reach the client while a path with a smaller supported packet size drops larger packets. Path MTU discovery uses relevant ICMP information to tell the sender when it needs smaller packets. AWS documents the required IPv4 fragmentation-needed message and IPv6 Packet Too Big behavior. If the ACL changed recently, check the service's documented control traffic needs along with the candidate policy. Do not assume only TCP port rows matter.
There are also AWS-provided paths a network ACL cannot simply filter. AWS documents exceptions, including traffic to and from its Route 53 Resolver and certain infrastructure endpoints such as the instance metadata service. A learner may see a working DNS request after configuring a restrictive ACL. That observation does not prove the rule is ordered incorrectly. For Route 53 Resolver DNS policy, use the applicable Resolver DNS Firewall feature where approved. For instance metadata options, follow the documented EC2 configuration. Describe the actual control you intend to apply to the desired service.
Use flow evidence and actual application observations together. VPC Flow Logs can record fields such as capture interface, source, destination, ports, protocol and an accept or reject action. Logs are collected for the specifically configured resources. They aggregate flow information, and some records or traffic may be absent. An accept describes traffic observed at that capture point, not a completed HTTPS transaction. A reject may require checking both security group and subnet ACL policy and the direction of the relevant record. Compare observed tuple, direction, timestamp and related records before choosing a conclusion.
Consider two lines of evidence in a training report. One records a TCP 443 request toward the web interface from an authorised test client. Another shows a rejected outgoing packet destined back to that client's temporary port. Consult the web subnet's outbound ACL and the actual security-group behavior. After verifying the selected rule, explain whether a known reply path was denied. Then repeat the intended app request with the expected body result. A changed flow-log action alone does not verify the site now shows the correct timetable.
Reachability Analyzer can help in an authorised environment by evaluating supported network paths against their configuration. It does not send the packets, see the browser's rendered page or establish an application identity. Treat that static analysis as evidence about a potential path and combine it with a controlled live operation where authorised. For an offline report, explicitly identify which part was a model and which configuration came from a real account inventory. The local exercise never changes ACLs or produces AWS flow records.
Work through a second example. The front door's web listener serves a static status page. A dynamic request depends on FastCGI to another subnet. Both pages use the same external TCP 443 connection. If only the dynamic route fails after an ACL change, compare the request-forwarding and reply flows between web and app. If the app logs the work and the web component never receives its reply, inspect app outbound and web inbound policies for that flow. If the app never sees the request, inspect the corresponding initial direction first. Keep the known static result as a control while testing the narrow correction.
Plan an owned ACL change and verify its rollback
Start by identifying the approved account, Region, VPC, subnet ID and actual network ACL ID. List every subnet associated with that ACL. A change to one ACL changes the policy for all its associated subnets, whether or not you clicked through from one subnet. In a teaching build it is often clearer to prepare a separate ACL for an isolated sandbox and review it before associating a test subnet. Verify the inbound and outbound lists and the original association or planned rollback target. A newly created custom ACL with no allow entries will block ordinary traffic according to the default deny behavior.
Write an explicit test matrix. Include the allowed external web request, its expected return path, an agreed denied test source, and a neighboring permitted source or path where one can be tested appropriately. Add each private dependency and management path the selected subnet must retain. For each row identify the IP family, protocol, initiation direction, scope and return port needs. Check for earlier matching broad rules and the unmatched rule at the end. If you cannot predict which entries permit an essential flow, resolve that before changing the association.
For added scope, review how many rules your environment supports. AWS lists a default 20 inbound and 20 outbound entries, both adjustable up to the documented maximum. Verify current limits. AWS also warns that some edits combining removals and oversize additions can remove older entries while failing to add all proposed ones. Check quotas and inspect the actual result after a change. Keep an approved rollback that restores the right original policy or association without redefining another team's shared subnet. An operator should not rely on the same path being changed to retain all access during the test.
If the desired denial is a single outside IPv4 source, first record its actual address as seen by the relevant trusted boundary. Use the intended direction and applicable port or protocol. In the model a lower-numbered rule narrows the policy. In a real approved sandbox, inspect exact rules and keep both management and application controls clearly identified. Avoid experimenting with a shared production ACL by indiscriminately denying your current address. That could also cut access via a shared administrative source. Use an owned test configuration and network owner's approved restoration method. Losing one remote login does not establish that the actual intended restriction was correctly scoped.
After a supported change takes effect, compare the desired results with recorded observations. A permitted test should reach the expected application, not just complete a handshake. The denied scenario should be confirmed within its approved observation scope. A stale browser tab, cached response, or different connection family can make test observations hard to compare. Use the same intended service request and a known address family, note the test origin, and collect relevant route and policy records. Note which cases were not exercised. A single denied request is not proof that every IP or service path has been assessed.
If the result fails, choose the narrow step that fits the evidence. An ACL change may need the earlier association restored for that owned subnet. If a tracked resource rule or a listener is the actual cause, the ACL might already behave as intended. In either case, retest the same useful endpoint and retain the relevant control. When the exercise ends, restore associations and delete temporary unattached ACLs according to the approved sandbox plan. Do not delete a shared default ACL or remove live network policies based only on the label. The offline worksheet has nothing to restore.
Create a new example from the course's private database path
The app initiates a database connection using TCP source port 50610 with destination port 3306. The app subnet's outbound list matches a permitted data-service range and destination port 3306. The data subnet's inbound list matches the appropriate app source range and the same service destination port. On return, the data subnet's outbound list matches the app destination and destination port 50610. The app subnet's inbound list matches the database source range and destination port 50610. These are four independent worksheet decisions before resource groups, route choices and database authentication are evaluated.
Now assume the app and database use IPv6. Replace both addresses with correctly planned examples and verify the separate IPv6 rules and route. The service and temporary port roles stay the same while network addresses and ACL entries change. Finally, imagine the app's temporary port comes from a documented allowable range rather than fixed 50610. Use the relevant range in the appropriate directions and narrow address scope. A single trace proves how one connection was evaluated. A planned service must support the expected set of eligible connections and operational circumstances.
Answer another learner's review using three observations. With one row missing, explain which side and direction fails. With a broad rule added early, explain how to determine whether a narrower later row still matters. With a working result through the correct listener, explain which expected database operation was verified. Revise the worksheet as needed and keep the test read-only until you have the scope and approvals for a real environment.
When you review a restricted temporary-port range, check both the use of the range and its address scope. A broad rule for every address could match packets unrelated to the intended return flows, since no state is recorded in this layer. A narrow range could fail for eligible clients whose temporary ports happen to fall outside it. This trade-off is why the lab uses one known range and a separate ordinary application design needs to observe the actual expected clients or intermediaries. Record the reason for each allowed source or destination as part of the rule review.
Imagine a review detects an obsolete allow added for a one-time deployment. Before removing it, verify whether an earlier or later row currently supplies the same decision and whether any other subnet shares the policy. Look for evidence of legitimate matching operations. A useful control uses the same application path and CIDR scope as the policy under review. After a supported change, inspect the actual rule set and association, then repeat the selected positive and denied tests. Knowing that a row was saved is only evidence that a configuration action happened.
Each chapter's example uses a different level of evidence. The model traces rule selection. A configuration inventory establishes the applicable rows. An approved application test and its corresponding logs show what happened to a specific request. Keeping those results separately labelled helps a new operator avoid interpreting a recent screenshot as proof that all traffic is secure or all users can reach the service.
Respond from the observed flow rather than a shortcut
Why can inbound HTTPS be allowed while a browser times out?
A stateless subnet ACL can allow the initial inbound packet and deny the outbound answer. Read the response's destination port, normally the visitor's temporary source port. Check the actual outgoing policy, route and host listener. The browser symptom alone could have other causes, so prove the relevant flow and use a known good control.
Does a rule denying one IP address override any allow automatically?
No. The first matching numbered rule is used. If a lower-numbered allow matches the same packet, a later deny is not evaluated. Use the appropriate subnet, direction, family, scoped address and protocol when planning a defensive rule. Verify the permitted control as well as the blocked scenario.
Can an ACL stop ordinary traffic between two interfaces in the same subnet?
Ordinary same-subnet traffic does not cross that subnet's ACL boundary. Use appropriate resource security groups or other supported controls for that purpose. A separate subnet can support a deliberate subnet-level boundary. Confirm the expected path before choosing an enforcement layer.
How is a subnet ACL different from an AWS WAF web ACL?
A subnet ACL controls eligible network packets by direction and packet fields at a subnet boundary. AWS WAF evaluates supported web requests at an associated service and can inspect HTTP properties under its rules. If a load balancer or proxy changes the packet source, check which layer observes the intended client address and configure only the approved policy.
Identify the winning direction and rule
The app at port 9000 replies to web's initiating port 49600. Which destination port does the app outbound ACL see?
Answer and reasoning
49600. Port 9000 is the source in the reply. The outbound rule must match the web destination and the web client's intended return-port scope.
Rule 100 allows all sources to 443. Rule 90 denies one matching source to 443. Which rule decides for that source?
Answer and reasoning
Rule 90 is evaluated before 100 and matches, so it denies. A source outside the deny range can skip that rule and still match 100.
The app subnet ACL was modified. Which other subnets now have the change?
Answer and reasoning
All subnets associated with that same ACL. Review its association list before changing it. Other ACLs can have different rule sets even when attached in the same VPC.
A known IPv6 client has no allowed inbound subnet ACL entry even though its IPv4 counterpart works. Will the IPv4 entry carry over?
Answer and reasoning
No. The families are handled separately. Review IPv6 address, route, both applicable ACL directions, resource permissions and the listener for the intended IPv6 connection.
Revision cards for network ACLs
Order and first match
Evaluate the lowest numbered matching rule in the chosen direction. A later narrower match cannot override an earlier match.
Request and reply
Inbound matches the source scope and outbound matches the destination scope. For TCP, use the destination port observed in each packet.
Boundary and ownership
Review every subnet using the ACL. Ordinary traffic within one subnet does not cross that ACL boundary.
Choose the enforcement layer
Use routes for forwarding and network controls for packet scope. Use supported application or web rules for identity and HTTP properties as appropriate.
Official references
- Network ACL association, stateless behavior and exceptions
- Rule numbering, fields and change scope
- Initial default network ACL rules
- Custom ACLs, client temporary ports and return paths
- Applied network ACL quota reference
- Path MTU Discovery and ACL control traffic
- VPC Flow Log accept and reject examples
- Application Load Balancer and AWS WAF
- AWS WAF forwarded IP considerations