Port forwarding — AQA A-Level Computer Science
Port forwarding is a network address translation (NAT) technique that directs external Internet traffic destined for a specific public IP address and port number to an internal private IP address and port within a local area network (LAN). This mechanism allows remote devices to access local server applications, such as web servers or game hosts, while keeping the rest of the private network hidden behind a firewall.
Port forwarding explained
Port forwarding is a rule configured on a router, usually as part of NAT, that directs incoming traffic arriving on a specific port of the router's public IP address to a specific internal device and port on the private network.
Read the full explanation
Because NAT normally only translates connections initiated from inside the network, an external host cannot reach a server inside the network without a rule telling the router where to send the traffic. When a request arrives at the public address on a chosen port, such as port 80 for web traffic, the router rewrites the destination address and port so the packet reaches the intended internal host. A concrete example is a rule sending traffic arriving on public port 8080 to internal address 192.168.1.10 on port 80.
Your focus
- Explain the basic concept of port forwarding
Port forwarding exam tips
Topic Overview
Port forwarding is a network management technique used in conjunction with Network Address Translation (NAT) to route external communications from the Internet to a specific device or service residing on a private local area network (LAN). It operates at the network and transport layers of the TCP/IP stack to inspect destination IP addresses and port numbers.
Understanding port forwarding is essential for modern networking, systems architecture, and cybersecurity within the AQA A-Level syllabus. It illustrates how firewalls control ingress traffic and how limited IPv4 public address spaces are bypassed to host accessible services securely.
Key Concepts
- →Distinction between private IP addressing (RFC 1918) and globally routable public IP addressing.
- →Role of the transport layer port number in demultiplexing network traffic to specific application processes (e.g., port 80 for HTTP, port 443 for HTTPS, port 22 for SSH).
- →Header rewriting: The router modifies the destination IP address (and optionally the destination port) from the public value to the internal private host values.
- →Security implications: Port forwarding bypasses default firewall blocking for specified ports, creating potential entry vectors for unauthorised external access if services are unpatched.
Marking Points
- Describes port forwarding as a router rule that redirects incoming traffic on a given port to an internal device
- Explains that NAT normally only handles connections initiated from inside the network, so a rule is needed for inbound access
- Identifies the mapping from a public address and port to an internal address and port
- Gives a concrete example such as forwarding traffic on one port to a specified internal host and port
Examiner Tips
- 💡Explain that the rule is configured on the router and applies to incoming traffic
- 💡Name one example port and one internal address to show the mapping clearly
- 💡State that port forwarding allows an internal server to be reached from outside the network
- 💡State explicitly which fields in the packet header change: the destination IP is translated from the router's public IP to the server's private IP.
- 💡Always specify transport protocols (TCP or UDP) and default standard port numbers when citing examples (such as HTTP 80, HTTPS 443, or SSH 22) to gain precision marks.
Common Mistakes
- Describes port forwarding as opening every port on the router; correct it by stating that a rule maps one specific port to one specific internal device
- Says port forwarding sends traffic from inside the network to the internet; correct it by explaining that it handles incoming traffic from external sources
- Confuses the port number with the IP address; correct it by stating that the rule maps both an address and a port
- Believing that port forwarding changes the source IP address; in inbound port forwarding, the router modifies the destination IP to route to the internal device, while the source IP remains that of the external client.
- Assuming that multiple internal hosts can use the same external port without port mapping; external ports must be unique per public IP to ensure the router knows which internal device to target.
Revision Plan
- 1Day 1: Review IPv4 address classes, private versus public IP ranges, and standard TCP/UDP port allocations.
- 2Day 2: Diagram packet traversal for outbound NAT versus inbound port forwarding, highlighting IP and port header modifications.
- 3Day 3: Practice multi-host scenarios involving port translation (mapping non-standard external ports to default internal ports).
- 4Day 4: Attempt past AQA exam questions focusing on network routing, NAT, and network security trade-offs.
Exam Question Types
- 📋Trace and explain questions: Describe the changes made to packet headers as a packet moves from an external client to an internal host.
- 📋Scenario configuration questions: Given a network diagram with IP addresses, explain how to configure port rules for multiple services.
- 📋Evaluative questions: Discuss the security risks of opening ports on a router versus using a Virtual Private Network (VPN).
Command Word Expectations (AQA)
Set out the causes, reasons, or mechanisms clearly. For port forwarding, mention packet headers, router NAT tables, public vs private IPs, and port redirection.
State the key characteristics or steps in order. For networking, recount the chronological journey of the packet across the boundaries.
How Students Lose Marks (Examiner Pitfalls)
Step-by-Step Worked Solutions
Question: An organisation hosts an internal web server with private IP address 192.168.1.50 running on port 80. The network router has a public IP address of 203.0.113.10. Explain how an external client accesses this web server and how port forwarding directs the packet. [4 marks]
- 1.Step 1: The external client sends an HTTP request packet destined for the router's public IP address (203.0.113.10) on destination port 80.
- 2.Step 2: The packet arrives at the router's external interface, passing through the firewall rule that permits incoming port 80 traffic.
- 3.Step 3: The router consults its port forwarding configuration table, which maps incoming requests on port 80 to the internal destination 192.168.1.50:80.
- 4.Step 4: The router modifies the destination IP address in the packet header to 192.168.1.50 and forwards the frame across the local network to the web server.
Question: A network technician needs to allow remote desktop access (using default port 3389) to two separate machines with private IPs 10.0.0.5 and 10.0.0.6 via a single public IP 198.51.100.2. Explain how port forwarding can be configured to achieve this. [3 marks]
- 1.Step 1: Identify that a single public IP cannot route the identical external destination port 3389 to two distinct private IPs simultaneously.
- 2.Step 2: Assign distinct external port numbers on the router to differentiate traffic (e.g., external port 3389 for machine 1 and external port 3390 for machine 2).
- 3.Step 3: Map external port 3389 to 10.0.0.5:3389 and external port 3390 to 10.0.0.6:3389 in the router's NAT table so the router redirects each unique port request to the correct host.