What is port forwarding? Now maybe you've
heard about it, but you weren't exactly sure what it was or how it works. So basically, port
forwarding allows computers over the internet to connect to a specific computer or service
within a private network. It's basically making your computer accessible over the internet, even
though you're behind a router. So for example, let's say a friend of yours at their home wants
to remotely control your computer at your home using a service such as remote desktop connection.
Now remote desktop connection is a service built into Microsoft Windows that enables you to
connect to another computer running Microsoft Windows. And then once you're connected to the
remote computer, you can use that computer's programs and files just as if you were sitting
in front of it. So now your friend is ready to connect to your computer. So he starts up the
remote desktop connection and sends the request to your public IP address with a specific port
number. Now a port is not a physical connection, but it's a logical connection that is used by
programs and services to exchange information. Ports uniquely identify these programs and
services that are running on a computer, and in this case remote desktop connection uses port
3389. So the request with the port number will make its way through the internet, to your router and
once it reaches your router, your router needs to know where to forward the request for port 3389.
Because without any port forwarding configured, your friend will not be able to connect to your
computer because your router does not know what to do with this request. So this is where port
forwarding comes in. So now we're going to tell our router to send or forward any requests that
come in with port 3389 and send the request to our computer here. So to do this we're going
to log in to our router's configuration page by typing in the routers internal IP address
using a web browser. So if you're not sure what your router is internal private IP address is,
you just open up a command prompt on a Windows computer and type in ipconfig and press enter. And
the default gateway is the internal IP address of your router. And it's also important to know what
your computer's IP address is, which is right here, because we're going to be entering that IP
address in the port forwarding configuration page. So in a web browser, we enter the IP address
of the router and now we are in the router's configuration page. Now depending upon what
router you're using, the configuration page will be different depending on which brand of
router you are using. I'm using a Cisco Linksys router in this example. So whatever type of router
you're using, the layout is going to be a little different. But basically you need to go to the port
forwarding section to configure port forwarding. So here on a port forwarding configuration page, we
can just enter a name for our application and we can just call it remote desktop and then we have
to forward the remote desktop connection port to the computer. So you type in the remote desktop
port number which happens to be 3389 and then you have to point it to the IP address of the computer
that you want your friend to access, which is 192.168.1.2 and then we can just
save our settings and now we're done. So now when your friend sends a request
with port 3389, the router knows where to forward that request to
and now the connection is complete. So if you're still confused about ports
let's use an illustration to explain what a port is and how it works. So here we have
a phone with an electronic switchboard that would typically be used in a company. So when
someone wants to make a call to this company, and let's say they wanted to talk to the sales
department within this company, they would dial the company's phone number, along with the
extension of the sales department. So when the call comes in, the phone will answer
the call and then the phone will look at the extension number and send or forward the
call to the corresponding department number. So let's say another person calls the company
and they wanted to talk to the support department. So the call comes in and is received by the
phone. Now the phone number has done its job, which is to send the call to the specific
company from the outside. But once the call is received using the phone number, the phone
number is no longer needed because it's done its job. So the only thing that is needed
now is the extension. So now the phone will forward the call to the support department
because of the matching extension number. Now this works very similar in a network. So
in a network, the router is contacted with an IP address along with a port number. So now
the router will look at the port number and send or forward the request to the internal IP
address that the port has been configured to. So again another request from the internet comes
into the network and reaches the router. So the IP address has done its job, which was to bring
the request to the router from the internet. So the IP address is no longer needed because
it has already done its job. So now the router will look at the port number and based on its port
forwarding configuration it will now forward the request to the computer with the IP address
that the port number has been configured to. So in a network the IP address is
similar to a phone number. And the port number is similar to an extension.
The router represents the phone. And the computers within that network
represents different departments. Ports are always associated with an IP
address and they are identified by a unique number. So regardless if you see the
port number or not, a port number is always associated with an IP address because an IP
address always has a purpose. And it uses the port number to determine what the purpose
is. Whether it's pulling up a web page, using an FTP service, or using remote desktop. It
always has a purpose that's determined by the port number. Because not only are ports
associated with an IP address, but they are also always associated with an application or
process, such as FTP web pages, email, and so on. The port numbers range from 0 to 65535. But of
the 65,000, there's a fear these that are most common and that are used on a daily basis. For
example, such as port 80 which is used for web pages. There's also ports 20 and port 21 which are
used for File Transfer Protocol or FTP. Or port 443 which is used for bringing up secure web pages. But
these are just a few. In fact there is a privileged category of ports that are called the well-known
ports which ranges from port 0 to port 1023.