Port forwarding or port mapping[1] is the technique of forwarding a TCP/IP packet traversing a network address translator (NAT) gateway to a predetermined network port on a host within a NAT-masqueraded, typically private network based on the port number on which it was received at the gateway from the originating host.
Port forwarding allows remote computers, for example, computers on the Internet, to connect to a specific computer or service within a private local area network (LAN).[3]
In a typical residential network Internet access is obtained through a DSL or cable modem connected to a router or network address translator (NAT). Hosts on the private network are connected to an Ethernet switch or communicate via a wireless LAN. The NAT device's external interface is configured with a public IP address. The computers behind the router, on the other hand, are invisible to hosts on the Internet as they each communicate only with a private IP address.
When configuring port forwarding, the network administrator sets aside one port number on the gateway for exclusive use of communicating with a service in the private network, located on a specific host. External hosts must know this port number and the address of the gateway to communicate with the network-internal service. Often, the port numbers of well-known Internet services, such as port number 80 for web services (HTTP), are used in port forwarding, so that common Internet services may be implemented on hosts within private networks.
Typical applications include the following:
§ Running a public HTTP server within a private LAN
§ Permitting Secure Shell access to a host on the private LAN from the Internet
§ Permitting FTP access to a host on a private LAN from the Internet
Test using Iperf tool:
1 Internal-host :
iperf -s -p xxx(port) -u (UDP)
2 External side host :
iperf -c zzz.zzz.zzz.zzz (Router's Wan ip address ) -p yyy(port) -u (UDP)
If port xxx can receive iperf data stream , then Port forwarding function does work .
Note:
The external port (or the first port of a range of external ports) that the NAT gateway would listen on for connection requests to a corresponding InternalPort. Inbound packets to this external port on the WAN interface SHOULD be forwarded to InternalClient on the InternalPort.
本文来自优快云博客,转载请标明出处:http://blog.youkuaiyun.com/gl1987807/archive/2010/09/18/5892974.aspx