What is port forwarding and why is it needed? How to forward ports on a TP-LINK router. Virtual Servers feature

You've probably heard about port forwarding more than once. This is a fairly easy to set up and extremely useful tool. Mastering it will not hurt those who are planning to deploy game servers or set up video surveillance systems.

A few words about ports

A port is a natural number that is written in the OSI transport layer protocol header and is used to identify the sending process.
Data exchange over the network is carried out according to a specific protocol between two processes (sender and recipient). To establish a connection and transfer information, the following data is needed:

  • two IP addresses (sender host and recipient host);
  • protocol number;
  • port numbers of the sender and recipient processes.

Why do you need port forwarding?

The standard settings of the router provide for masking the addresses of devices located behind it. When the router receives outgoing data packets from a device on the internal network, it opens a specific port and sends data, changing the internal IP address of the destination device to its own external address. When data packets arrive in response to this router port, it redirects them to the device for which the information is intended. It turns out that only the router’s IP address is visible from the external network, and the devices behind it remain invisible.

This technology is good in conditions of a critical decrease in the number of free IPv4 addresses, but it has a drawback: the router will only accept those data packets that arrive via a connection initiated by an internal network device. But if the server or computer tries to contact the device behind the router first, the requests will be rejected.
Getting access to devices on the local network from an external one is not so easy. To do this, you need to configure port forwarding.

Port forwarding or redirection is an operation that is part of a set of network address translation or NAT functions (the NAT mechanism involves the use of one external interface by several local network devices). Forwarding involves matching a given port on the external interface of the router with a specific port of the requested device on the local network.

It is worth noting that with , the need for port forwarding and NAT will generally disappear.

Application cases

Port forwarding is configured for the following cases:

  • organization of a game server;
  • remote computer control;
  • connection to an IP video camera or to a computer to which the image from the camera is transmitted;
  • organization of WEB/FTP servers.

How it works

“Forward” ports is to instruct the router to reserve one port and all data coming to it for transmission to a specific computer. In other words, make an exception to the rule of rejecting uninitiated external requests and accept them under specified conditions.

To do this, set a rule to redirect any free port of the WAN interface on the router to a specific port of the specified device.

Once the redirection rule is created, requests incoming on the specified external port will be addressed to the specified port of the specific device.

Setting up using Totolink routers as an example

To begin, connect the router to your computer via a cable and go into settings. Read how to do this.
Go to “Advanced Setup”, then to “Port Forwarding”.

The next step is to come up with a rule name, select a protocol (TCP), and specify the IP address of the recipient host (Totolink only). For other models, there may be a sender IP input field. It is needed to ensure that only a user from a specific IP or IP subnet has access to a custom process (for example, a DVR stream).
Next, you need to assign the external and internal ports for mapping.


After entering the data, click the “Add” button, after which the rule will work.

In the computer world, the word "Port" has two meanings. The first is a physical port, that is, a connector for connection.

Physical ports are LAN ports, the same socket where the local network network cable is connected; USB port to which flash drives and other equipment are connected; COM ports and many others. But there are also network ports - this is, roughly speaking, the identifier of a program that exchanges data over the network. Let's figure out what a network port is and how to find out the router port.

As you know, when exchanging information between computers, the sender and recipient find each other by IP network address. But the computer has one IP address, and many network programs can be running at the same time, for example, ICQ, web browser, Skype and email. Responses come from all applications at the same time, and the computer must understand which one is intended for whom. It is for these purposes that ports are used, for example, a web browser is assigned port 80, an email client is assigned port 25. Many network programs, such as Skype and ICQ, do not have assigned ports, that is, it can be changed to another at any time.

Port forwarding on the router

Why do you need port forwarding on a router? For example, you have created a website on your local network that any user of this local network can access without any problems. But when I try to access it from the Internet, I get an error: the site is unavailable. This happens because the router settings discard all information coming from outside if the port number is not included in the “white” list. To solve this problem, you need to tell the router that if information has arrived for such and such a port, then it is necessary to send this information to such and such a computer at such and such an IP address.

Let's look at how router ports are configured from major network equipment manufacturers:

  1. ZyXEL, model NBG460N;
  2. TP-LINK, TL-WR741;
  3. D-LINK DIR-620.

Setting up port forwarding on a ZyXEL router

Although the settings menus of different lines of routers differ in appearance, the setup principle is the same everywhere - you need to find a menu item with a name like “Network”, “Network”, or something similar. For example, let's configure the NBG460N router to work with a torrent. To forward the port, go to the “Network” item, then the “NAT” submenu.

Configuring port forwarding for the ZyXEL router

In the “Application” tab, check the “Active” box, thereby enabling the transfer function. Next, we set the rule in the fields - in the “Service Name” field we set the name of the exception (for example, Torrent, so that we don’t get confused in the future), in the “External port” and “Internal Port” fields we enter the port number on which our program runs on the computer. In the “Server IP Address” field, enter the network IP address of the same computer. Click “Apply”.

Adding a port forwarding rule for a torrent

This rule will appear at the bottom of the window.

Setting up port forwarding on a TP-LINK router

Next, we’ll learn how to configure ports on a router from the manufacturer TP-LINK, model TL-WR741. To do this, go to the router settings menu, then select the “Forwarding” item, and then the “Virtual servers” sub-item.

Selecting the port forwarding setup item on the TP-LINK router

In the main window, click the “Add new...” button. The port forwarding configuration window will open.

Setting up TP-LINK port forwarding

Here you need to create the rule itself. To do this, in the “Service Port” field, enter the number of the forwarded port, for example, 1234. In the “IP Address” field, enter the network address of the computer to which you need to forward data addressed to port 1234; in the “Protocol” field, select the protocol (we’ll talk about this point more details). In the “Status” line, select the value “enabled” or “disabled”.

As for the choice of protocol, the list has a choice between TCP and UDP. These are different protocols, the ports of which do not intersect with each other. In other words, if port 1234 for the TCP protocol is busy, this does not mean that the UDP protocol cannot use this port.

For this reason, if the TCP protocol is specified in the router settings, a block of data controlled by the UDP protocol will arrive at the router, then the router will ignore it, although the port will be 1234. If the protocol is not known, then to solve this problem we create a copy of the rule, but in the “ protocol" we indicate the second type of protocol. But you can create another rule. For example, for port 1235.

Leave the “Common service port” item as default and click “Save”. Both rules will appear.

Displaying TP-LINK port forwarding rules

Please note that the status of all rules is “Enabled”.

Setting up port forwarding on a D-LINK router

Entering the D-LINK port forwarding settings menu

Click the “Add” button. A form for filling out the rule will open.

D-LINK port forwarding form

In the “Template” field, select “Custom”, that is, manual configuration. In the “Name” field, enter the name of the rule. In the “Interface” field, select the interface (that is, the physical port) for which we are setting up the rule. The protocol is the same as in the previous router. In the “External port” and “Internal port” fields we enter the numbers of the port/ports through which the request will pass, and the port/ports to which this data will be redirected. Accordingly, in the “Internal IP” field, enter the network address of the computer to which you want to send.

To save the settings, click the “Change” button. The previous window will open and the new rule will appear.

Displaying the new D-LINK rule

Additionally, you can familiarize yourself with the settings by watching a video lesson on port forwarding on the D-Link DIR-100:

In this article, we will tell you how to open a specific port on your router to provide network access to a specific program. If you open specific ports on your router, games, torrent clients, servers and other programs that are denied access to these ports by default will be able to connect to the Internet. Be aware that if you open the ports, the security of the system will be greatly reduced.

Steps

Part 1

How to Open a Router Configuration Page in Windows

    connected to the internet.

    Open the Start menu. Click the Windows logo in the lower left corner of the screen.

    Click Options. It's a gear-shaped icon at the bottom left of the Start menu. A window with parameters will open.

    Click on "Network and Internet". It's a globe icon in the middle of the window.

    Click View network settings. It's a link at the bottom of the window.

    • You may have to scroll down the page to find this link.
  1. Scroll down to the Wi-Fi section. You'll find it to the right of "Name:" on this page.

    Find the "Default Gateway" line. It's at the bottom of the Wi-Fi section.

    Find the default gateway address. It is located on the right in the line "Default Gateway" - this address is the address of the router.

    ↵Enter.

  2. Skip this step if you do not need to enter these credentials. If you changed your username and password (for example, when you first set up your router), enter them. If not, enter the default username and password:

  3. Part 2

    How to Open the Router Configuration Page in Mac OS X
    1. Make sure your computer is connected to the Internet. To open the router's configuration page, you need to find out its address and connect to it, and for this you will need an active Internet connection.

      Open the Apple menu. Click the Apple logo in the top left corner of the screen.

      Click System Settings. This option is in the menu. The System Preferences window will open.

      Click on Net. You'll find this globe-shaped icon in the System Preferences window. The Network window will open.

      Click Additionally. This option is at the bottom right of the window. A pop-up window will appear.

      Click on the tab TCP/IP. It's at the top of the pop-up window.

      Find the address in the "Router" line. This address is the router's address.

    2. Open your router's configuration page. In your web browser's address bar, enter your default gateway address, and then click ⏎ Return.

      • For example, if your default gateway address is 192.168.1.1, enter 192.168.1.1 in your browser's address bar.
    3. Enter your username and password. Skip this step if you do not need to enter these credentials. If you changed your username and password (for example, when you first set up your router), enter them. If not, enter the default username and password:

      • For a Linksys router, enter admin in the username and password text boxes;
      • For a Netgear router, enter admin in the username text box, and then enter password in the password text box;
      • To find out what the default username and password are, read the instructions that came with your router.
      • If you have forgotten your credentials, you will have to reset your router.
      • The username and password for the router can be found on a sticker on its case.

    Part 3

    How to set up port forwarding
    1. Explore the interface of the router configuration page. The interface on this page varies depending on your router model, so you'll have to look for the port forwarding options section. The easiest way to find this section is to read the instructions (online or on paper) that came with your router.

      • For example, the port forwarding settings section on a Linksys router is called linksys port forwarding; In this section you need to find the model of your router.
      • Don't give up if you don't see the option or section you need. For example, if you can't find the "Advanced" option on a page, keep searching.
    2. Look for the "Port Forwarding" section. The configuration page interfaces will vary slightly, but forwarding options can be found in one of the following sections: Port Forwarding, Gaming, Applications, Virtual Servers, “Protected Setup”, “Firewall”.

      • Any section with the word "Port" should be opened and viewed.
      • If you can't find any of these sections, open the "Advanced Settings" section and look for the "Port Forwarding" subsection.
    3. Find the default port forwarding settings. Many routers have a menu with preset settings for popular programs. To open ports for such a program, select it from the Service Name, Application, or similar menu, and then click Save or similar.

      • For example, "Minecraft" is a popular program for which users forward ports, so select "Minecraft" from the menu.
    4. Create a port forwarding rule. If the program you need is not in the list of popular programs, create a new port forwarding rule. Your steps will depend on your router model, but in most cases you will need to enter the following information:

      • "Name" or "Description": This is where you enter the name of the service/program (for example, enter "Minecraft"). This is not necessary, but it will prevent you from getting confused by different port forwarding rules.
      • Type or Service Type: Select TCP, UDP, or TCP/UDP here. If you don't know what to select, click TCP/UDP or Both.
      • "Inbound" or "Start": Enter the first port number here. But first, find out whether to open this port for another program.
      • "Private" or "End": Enter the second port number here. If you only want to open one port, enter the number you entered in the previous text box. If you want to open a series of ports, enter the number of the last (in the series) port in this text field (for example, if you enter “23” in the first text field and enter “33” in the second, ports 23 through 33 will be opened).
    5. Enter the computer's private IP address. This must be done in the "Private IP" text box or in the "Device IP" text box. You can find out the IP address on a Windows computer with .

      • Depending on your router model, this text field may already be filled with the computer's IP address. If so, skip this step.

Details about setting up Tp-Link router forwarding

By the way, about port forwarding. We come to the “Forwarding” section and the first item “Virtual servers”. Yes, this is such a clever name for the familiar Port Forwarding. This is what the main menu looks like. As you can see, I have 2 rules here for my desktop PC - for port 8888 and for port 3389. These are WebUi uTorrent and RDP remote desktop.

So, we need to create a rule for, say, a Minecraft server (or 1c Accounting), which you run on your computer and want to play with friends without any Hamachi. Click “add” and see:

What is what?

The service port is the public port, that is, the port that your friends should specify when trying to connect to your server. I set 1313 for clarity, that it does not have to be with an internal port.

But the internal port must match the Minecraft server port, which is 25565 by default.

Next comes the IP address of the computer on the network to which we want to connect, and this is where we need IP address reservation. Enter the IP address of your Minecraft/1 From the server.
The protocol is most often UDP, but if you are not sure, you can use everything.

We enable the rule and set it to “Standard service port”, we have already done everything ourselves.

Let's move on to Port Triggering. Long meditation allowed me to conclude that it is like UPnP, only manually.

In general, the point is that we have an application that uses a group of ports, in my example it is 15550-15590. In order to forward this bunch of (40) ports to the external network and back, a trigger port is created through which all this passes.

DMZ, or Demilitarized Zone. A function that opens ALL ports to your computer. That is, only those that are closed on the computer will remain closed. Need I say how safe it is? There are 2 points in the settings, these are ON/OFF and the IP address of the device.

UPnP(Universal Plug and Play). Few settings - ON/OFF. A set of networking standards and protocols designed to make your life easier. Automatically “adjusts” the router for various applications (Skype, uTorrent) and network activities. Of course, we turn it on.

Technology Universal Plug and Play (UPnP) is a convenient way to provide any network program that needs to forward ports without having to configure “mapping” on the router’s web interface. But not all programs have built-in support for UPnP. Unfortunately, some programs that require port forwarding do not support UPnP. In these cases it will help us UPnP Portmapper. Let's talk about its installation, configuration and use.

The main purpose of UPnP Portmapper is to take care of port forwarding for the application without configuring forwarding on the router. But if you want to manually configure all the details of port forwarding, then you will have to log into the web interface of your router and change the port forwarding rules. If for some reason you cannot log into your router, then this article on gaining access to the router will help you update your credentials for it.

But situations often arise when it is necessary to perform port forwarding, but it is undesirable to configure the router. For example, if you are in a public place or visiting friends, then simply launch UPnP Portmapper and activate the preset rules.

Let me make a reservation right away that I will consider the router and the router to be the same device. It makes no sense to divide them into two different types within the framework of this article. But this does not mean that they are actually the same device. This is far from true.

Installing UPnP PortMapper

UPnP PortMapper is written entirely in Java, so you need the free Java Runtime Environment package, which you can download from the official website. After installing Java, download UPnP PortMapper, for example from GitHub.

It should be noted that UPnP PortMapper also works great on Mac OS X and various Linux systems.

UPnP PortMapper communicates with the router using UPnP protocols, so your router must support this technology and it must be enabled. However, there is nothing to worry about, all modern routers support UPnP, which is already enabled on the router by default.

To launch Portmapper, double-click on the JAR file.

UPnP PortMapper

Or run the file on the command line.

$ java -jar PortMapper-1.9.6.jar

Port Forwarding with UPnP PortMapper

To get started, click the button Connect in UPnP Port Mapper. If you see a Windows Firewall pop-up window, click Allow access.


Connect UPnP PortMapper

If UPnP Portmapper tells you in the Log messages field that it cannot find the router.


Warning UPnP PortMapper

This means that the UPnP setting is disabled on the router itself. You need to go to the router's web interface and enable UPnP.


Enable UPnP on the router

After clicking the Connect button, you will be connected to the router and you will see a list of UPnP port mappings in the top panel (this list will be empty by default), as well as the external IP address of the router on the Internet and its IP address on your local network.


UPnP PortMapper connected to router

To create a new port forwarding, click the button Create.

Enter a description for the forwarding rule and specify a list of one or more ports to forward. You can specify a range of ports using the button Add port range.

You can also specify a specific remote host. When you enter an IP address, only traffic from that address will be forwarded to your computer from the router. For example, you can use this feature to only allow connections from your friend's Internet IP address.

Jackdaw Local host installed by default, it forwards ports to the address of your computer without having to double-check the local IP address of your computer. If you disable the checkbox, you can use the application to forward ports to several different computers on the network.


Add a port range, disable localhost forwarding

After specifying a range of ports, they will be displayed in the preset Ports. Save the selected range, select a preset and press the button Use to enable the selected range of ports.

Port preset

When you press the button Use Portmapper forwards ports to the router. You can see the prepared setting in the preset Port mappings.


Using the My Game Server preset

You can remove port mappings by highlighting a row in the table and clicking Delete.

The port forwarding settings made will be saved on the router until its cache with UPnP data is cleared. Depending on your router, this may happen, for example, when the router is rebooted. If you open UPnP Port Mapper next time and click the button Connect You will see your active port mappings.

You will also need to reapply your port mapping settings if your computer's local IP address has changed.

With UPnP PortMapper, you can quickly and easily apply port forwarding settings on any network with a router that supports UPnP. This is convenient if you use a laptop outside the home and need to forward ports for games, servers or other tasks.