Port Fowarding

本文详细介绍了端口转发技术的基本原理及其应用场景。通过配置网关将公共网络上的数据包定向到私有网络内的特定主机和服务上,使得外部互联网能够访问位于私有局域网内的服务。文中还列举了常见应用案例,如搭建公网HTTP服务器、实现SSH安全连接及FTP访问等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值