Port Forwarding on a Router: What It Is and How to Set It Up
What port forwarding is, where the setting is on TP-Link, ASUS, Linksys and D-Link routers, how to set it up, and why a port still shows closed.
Port forwarding tells your router to send traffic that arrives on one port to one device inside your network, such as a game server, a camera or a web server. Without a rule, the router drops traffic that nobody inside asked for. Menu names differ (Virtual Servers, Port Forwarding, Single Port Forwarding), but the fields are the same: external port, internal address, internal port and protocol.
Steps
- Give the device a fixed private address. Reserve it in the router’s DHCP settings, or set a static address outside the DHCP range, so the rule does not break when the address changes.
- Find the port and protocol the program needs (TCP, UDP or both). Use only the ports you need.
- Log in to your router. Use the router IP finder if you do not know the address.
- Find the port forwarding page using the table below, and add a rule: external port, the device’s private address, the internal port and the protocol. Save it.
- Allow the port in the device’s own firewall, and make sure the program is listening on it.
- Test from outside your network, for example on mobile data, with your public address and the port. Testing from inside can fail even when the rule is right.
- Delete the rule when you no longer need it.
Where the setting is on common routers
| Router | Menu path | Fields it asks for |
|---|---|---|
| TP-Link | Advanced, NAT Forwarding, Virtual Servers | Service type (or external port), internal IP, internal port, protocol |
| ASUS | WAN, Virtual Server / Port Forwarding. Switch Enable Port Forwarding to On (it is off by default), then Add profile | External port (a range uses a colon, such as 300:500), internal IP address, internal port, optional source IP |
| Linksys | Router Settings, Security, Apps and Gaming, Single Port Forwarding | Application name, external port, internal port, device IP, protocol |
| D-Link | Manual Setup, Advanced, Advanced Port Forwarding Rules | Name, public port, private port, traffic type, IP address |
Menus come from the TP-Link, ASUS, Linksys (No-IP guide) and D-Link support pages listed below. Your model may differ, so check its support page.
What a rule looks like
Say a web server runs on a computer at 192.168.0.100 on port 80. The rule is: external port 80, internal IP 192.168.0.100, internal port 80, protocol TCP. Someone on the internet who opens your router’s public address then reaches that computer. TP-Link’s own example is exactly this, with the test http:// followed by the WAN address.
The internal port can differ from the external one. External 8080 to internal 80 means visitors use :8080 while the program keeps listening on 80.
Port forwarding, port triggering, DMZ and UPnP
- Port forwarding: a fixed rule for one port to one device. The safest choice, because you open only what you need.
- Port triggering: the router opens a port only after a device sends traffic out on a trigger port.
- DMZ: sends all unsolicited traffic to one device. Avoid it unless you understand the risk, because the whole device is exposed.
- UPnP: lets programs on your network ask the router to open ports by themselves. Convenient, but you lose control of what is open, so many people turn it off.
If the port will not open
- The port still shows as closed
- Check the device has the private address you set, the program is running and listening on that port, and the device firewall allows it. ASUS adds that each port can belong to only one device, and a conflict makes the rule fail. Then test from another network, such as mobile data.
- The router’s internet address is not your public address
- Compare the router’s WAN address with what a “what is my IP” site shows. If they differ, or the WAN address is private or starts with 100.64 to 100.127, your provider shares one public address between customers (CGNAT) and forwarding will not work. ASUS says the same for any multi-layer NAT. Ask the provider for a public address, or use a tunnel or relay service.
- My public address keeps changing
- TP-Link’s page says that if the provider assigns the address dynamically, you should register a domain name for it so visitors do not need the number. A dynamic DNS service does this.
- It works from inside but not outside
- Some routers cannot loop traffic back to their own public address. Use the device’s private address inside your network.
- IPv6
- ASUS states its port forwarding does not support IPv6. Rules like these are for IPv4. With IPv6 a device usually has a public address, and a firewall rule on the router decides what is allowed.
- Two routers in a row
- Forward the port on both, or put the first router in bridge or access-point mode. See own router behind an ISP router.
- The rule stops working after a restart
- The device probably got a new private address. Reserve its address (TP-Link recommends a static IP or an address reservation) so the rule keeps pointing at it. See DHCP reservation.
Questions people ask about Port forwarding
- What is port forwarding?
- A router rule that sends traffic arriving on a chosen port to a chosen device inside your network, so that something on your network can be reached from the internet.
- Is port forwarding safe?
- It exposes that one service to the internet, so keep the program updated, use strong logins, open only the ports you need, and remove rules you no longer use.
- Do I need port forwarding to host a game or a web server?
- Usually yes, unless the program or a relay service handles it for you.
- What is the difference between TCP and UDP?
- TCP checks that data arrives. UDP does not. The program’s documentation says which one it uses. If you do not know, some routers offer Both.
- Can I forward a range of ports?
- Yes on many routers. ASUS accepts a range with a colon, such as 300:500, or several ports separated by commas.
- Does port forwarding work with CGNAT?
- No. If your provider shares one public address between customers, forwarding on your router has no effect.
Related pages
- Find your router IP
- Login not working
- Forgot password and reset
- Change Wi-Fi password
- Default IP list
- Security checklist