Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

networks
ip
nat

What is port forwarding?

Educative Answers Team

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Port forwarding allows external devices to connect to devices in a private network.

The need for port forwarding

Small networks (e.g., home networks) have a single external IP address, and each device in the network has a unique internal IP address. Internal IP addresses are not routable on the internet; hence, a router uses Network Address Translation (NAT) to map internal IP addresses and port numbers to external IP addresses and port numbers. The port numbers that NAT uses are randomly selected, which poses a problem when you want a host to connect to a server in your internal network that uses a standard port.

svg viewer
The router translates private IP addresses and ports to public IP addresses and ports (and vice versa) so that external devices can connect to the devices in the private network.

How port forwarding works

Suppose you have a web server running on your private network ​and external clients expect to connect to port 80. To enable this, you need to use port forwarding. In this example, port forwarding would involve statically mapping the external IP address and port 80 to the internal IP address and port 80.

How to enable port forwarding

To enable port forwarding, log in as an admin on the desired router, and enter the external port numbers that need to be mapped to the internal port number.

RELATED TAGS

networks
ip
nat
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring