December 04, 2023

What is port forwarding? What is port mapping? How to set up port mapping?

ForewordHi everyone, I'm Mr. Lin, what's difference between port mapping and a port? If they don't differ in details, it's easy to confuse them. Let's take a look today. Text1. What is port mapping

Port mapping. Port mapping is mapping of a host port on internal network to a host port on external network to provide corresponding services. When a user accesses this port of an external network IP address, server automatically maps request to a machine within appropriate local network.

For example:

We have a web server on internal network, but users on external network cannot access server directly. In this way, we can set up port mapping on router. As long as users on external network access port 80 of router's IP address, router automatically forwards traffic to port 80 of internal web server. In addition, there is also a session on router, when internal network server returns data to router, router can accurately send a message to external network with a request to user's host. In this process, router acts as a reverse proxy that secures hosts on intranet.

What is port forwarding? What is port mapping? How to set up port mapping?

Second, what is a port

Port. A port (port forwarding), sometimes referred to as tunneling, is a method used by Secure Shell (SSH) to communicate securely over Internet.

For example, we are now in internal network, there is no way to go directly to external network. But we can access external network through NAT mode of router. If we now have 100 hosts on our intranet, then we are all communicating with external network through this router's public network IP address. So, when a message is sent back on Internet, how does router know that message is for it and other message is for you? This requires our IP address to be bound to router port. At this time, there will be a table corresponding to intranet IP address and router port in router. When port 10000 of router receives a message, it knows to send a message, and when port 20000 receives a message, it knows to send a message to you. This is a port, and traffic received on one port is sent to another host.

What is port forwarding? What is port mapping? How to set up port mapping?

Third, difference between port mapping and port

Here is an example that everyone should understand:

Port: Emphasis is placed on "transfer". Those who deliver courier come up and hand over all couriers to guard at gate, and guard distributes them to recipient for each courier.

Port Mapping: This is a cabinet setting for everyone at gate, and courier will directly place courier in appropriate cabinet according to name of recipient.

4. How to use peanut shell for port mapping? Implement external network access to local server

Mapping to implement external network access to local server, when external network users need to access your internal and external content, you can perform port mapping.

Download Peanut Shell and after registration it will be given a second-level domain name, internal and external network ports or an internal network host.

What is port forwarding? What is port mapping? How to set up port mapping?
What is port forwarding? What is port mapping? How to set up port mapping?

The intranet host IP address is IP address of same network segment as your intranet. How to check your own intranet IP address? Please type cmd in win key search field, open command prompt and type ipconfig and you can view intranet IP segment.

Then set port forwarding function of the router.

What is port forwarding? What is port mapping? How to set up port mapping?

Some routers are installed directly on virtual server.

What is port forwarding? What is port mapping? How to set up port mapping?

After setting, restart your router. Of course, if port is occupied by others, you can use other ports.

You can use domain name 25c8898k47.zicp.vip:55694 to access intranet server.

5. The router has configured port mapping in gateway, but reason why external network cannot be accessed

1. First, check if specified port mapping is correctly mapped to your intranet server. That is, whether IP address of rule you set is IP address of your server.

2. Unable to access intranet server. Check if server is on. You can use other computers on local network to access your server to ensure that server is turned on and can be accessed.

3. Check if you have mapped all ports required by server. It is possible that ports required to access server are not fully set, causing access to fail. You can check if port is not fully mapped by opening "DMZ host". If you can access server after enabling DMZ host, port may not have been fully added.

4. Is a "firewall" installed on gateway and is port being filtered to communicate with server, causing access to fail.

5. Local firewall: Since local network is a trusted area, firewall will not block access to the local network. blocked by firewall and not accessible.

What is port forwarding? What is port mapping? How to set up port mapping?

6. The service provider protects corresponding port: connect computer to WAN port of gateway to simulate internal and external network environment. If computer connected to WAN port can access intranet server normally, but cannot access it on Internet, it may happen that that server will Appropriate port screening makes virtual server inaccessible;

Lastly add:

1. If it is a web server on port 80, you must pay attention to whether gateway control port is changed, otherwise they will conflict;

2. To check if virtual server has been successfully mapped, it must be accessed from external network. Do not use IP address of WAN port for access from internal network. It succeeds during test, but actual external network cannot be accessed successfully.

3. For special servers such as network cameras and special application software, etc., if client does not know communication port, it can try DMZ host first to confirm whether it can be used. , customer is advised to consult with software supplier.

Related