AQA Computer Science A Level

Using Port Forwarding
By Admin - June 22, 2020, 9:11 a.m.
Last Edit - June 23, 2020, 8:21 a.m.

Your router will receive incoming traffic, and this traffic will also specify a port number. For example HTTP uses port 80, so when your router receives incoming traffic on port 80 it will look to see if any port forwarding rules have been created.

Port forwarding is when you map incoming traffic on a specific port to an internal IP address for a specific device and a specific port.

Using Port Forwarding

Image

This is a screenshot of the Port Forwarding rules on my router. The first line will take an external traffic on port 80 and map it to the IP 192.168.0.56 and it will use port 80. This will ensure any HTTP traffic will be passed to my main raspberry pi server (Pi 3B+).

The second line will take external traffic on port 443 and map it also to the IP 192.168.0.56 and it will also use the internal port of 443. Port 443 is for HTTPS, so this will pass any HTTPS traffic to the main raspberry pi server.

Port numbers without a Port Forwarding rule will be dropped, so attempts to access them will be ignored.

What could you do

Step1

Download USBWebServer:

USBWebServer

USBWebServer doesn't require any installation, so simply run the executable file and click Allow on any firewall window.

Step 2

Access your router on http:/192.168.0.1 . If this doesn't work you can goto Settings, then select Network & Internet, then Wifi. You are looking for Change Adapter Options:

Image

Next you need to double click your wifi adapter name (it will be the one with the green bars, because it should be connected).

Image

You need to click the Details button. Now look for the Default Gateway, and this will be the IP address of your router.

Step 3 Create a Port Forwarding rule for port 80, on my router this is under Advanced Settings, Security, and then Port Forwarding:

Image

Step 4

You will need to find your Pubic IP address, so simply search "whats my IP" on google and make a note of the address. Mine is 82.7.198.16 , now type this IP address into the address bar of your browser. You should see the info page from the USBWebServer.

Step 5

After you have had a play, for example change the index.html file in your USBWebServer folder, you should delete the Port Forwarding rule because it exposes your device and if it is not properly configured you could be hacked.