Port Fowarding

本文详细介绍了端口转发技术的工作原理及其应用场景。通过配置网关将公共网络上的数据包定向到私有网络内的特定主机和服务。文章还提供了如何设置端口转发及验证其正确性的示例。

摘要生成于 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

 

Iperf测试:

1  LAN 端

iperf -s -p 0000(监听的端口号) -u (UDP)

2 WAN 端(此计算机可以Ping 通你的Router)

iperf -c 0.0.0.0 (Router 的IP地址) -p  0000(监听的端口号) -u (UDP)

3 如果LAN端能收到默认大小的流量,则证明Port Forwarding 起作用.

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.

 

 

 

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值