HTTP协议中源端口和目标端口的问题
【提问】
|
How is source port for HTTP determined? Is there ever collision in NAT?
I know that when a HTTP request is made, packets are sent from a seemingly-random high-numbered port (e.g. 4575) on the client to port 80 on the server. Then the server sends the reply to the same high-numbered port, the router knows to route that to the client computer, and all is complete. My question is: How is the return port (4575 in this example) determined? Is it random? If so, within what range? Are there any constraints on it? What happens, for example, if two computers in a LAN send HTTP requests with the same source port to the same website? How does the router know which one to route to which computer? Or maybe this situation is rare enough that no-one bothered to defend against it? |
【回答】
|
The NAT is going to decide/determine the outbound port for a NATed connection/session, via it's own internal means. Meaning, it will vary according to the implementation of the NAT. This means any responses back will come back to that same outbound port. As for your question: What happens, for example, if two computers in a LAN send HTTP requests with the same source port to the same website? It will assign different outbound ports for each. Thus, it can distinguish between the two in responses it receives. A NATs would create/maintain a mapping of translated ports, creating new outbound port numbers for new sessions. So even if if there were two different "internal" sessions, from two different machines, on the same port number, it would map to two different port numbers on the outgoing side. Thus, when packets came back in on the respective ports, it would know how to translate them back to the correct address/port on the inside LAN. Diagram:
|
HTTP协议中源端口和目标端口的问题的更多相关文章
- iptables禁止端口和开放端口
1.关闭所有的 INPUT FORWARD OUTPUT 只对某些端口开放. 下面是命令实现: iptables -P INPUT DROP iptables -P FORWARD DROP ipta ...
- Linux下iptables 禁止端口和开放端口
1.关闭所有的 INPUT FORWARD OUTPUT 只对某些端口开放.下面是命令实现: iptables -P INPUT DROP iptables -P FORWARD DROP iptab ...
- 移动IP 它最初设想每个人都在编写应用层(7)API而不是传输层(4)API 对于QUIC,连接的标识符不是“套接字”(源/目标端口/地址协议组合)的传统概念,而是分配给连接的64位标识符
小结: 1. 因为您对OSI模型的教育中缺少的一点是,它最初设想每个人都在编写应用层(7)API而不是传输层(4)API.应该有像应用程序服务元素之类的 东西,它们可以以标准方式处理文件传输和消息传递 ...
- cdn贝四层协议配置端口映射TCP端口转发
端口映射就是将外网主机的IP地址的一个端口映射到内网中一台机器,提供相应的服务.当用户访问该IP的这个端口时,服务器自动将请求映射到对应局域网内部的机器上.端口映射有动态和静态之分 1.安装好节点后初 ...
- quagga源码学习--BGP协议中的routemap
路由策略的基础知识 定义 路由策略(Routing Policy)作用于路由,主要实现了路由过滤和路由属性设置等功能,它通过改变路由属性(包括可达性)来改变网络流量所经过的路径. 目的 路由器在发布. ...
- 内网渗透中的反弹Shell与端口转发
from:https://www.91ri.org/9367.html Web渗透中的反弹Shell与端口转发 php需未禁用exec函数一:生成php反弹脚本msf > msfpayload ...
- 如何在 Linux 中查看进程占用的端口号【转】
对于 Linux 系统管理员来说,清楚某个服务是否正确地绑定或监听某个端口,是至关重要的.如果你需要处理端口相关的问题,这篇文章可能会对你有用. 端口是 Linux 系统上特定进程之间逻辑连接的标识, ...
- 在 CentOS 7.3 上安装 nginx 服务为例,说明在 Linux 实例中如何检查 TCP 80 端口是否正常工作
CentOS 7.3 这部分以在 CentOS 7.3 上安装 nginx 服务为例,说明在 Linux 实例中如何检查 TCP 80 端口是否正常工作. 登录 ECS 管理控制台,确认实例所在安全组 ...
- 如何在 vmware esxi 中开放 VNC功能及端口实现远程管理 完整篇
VMWare esxi中开放 VNC功能及端口实现远程管理 完整篇 在多个论坛上看了相关文章,总的写得不完整.现将各方资源整编写完整版.详文如下! (图片来自51CTO) 步骤1. 修改ESXi主机的 ...
随机推荐
- Revit API取得系统族普通族几何信息的方法
系统族,可以直接转化为对应的类(Wall,Duct)然后取得几何信息,普通族需要转化为FamilyInstance )) { TaskDialog.Show() ...
- EF6+Sqlite连接字符串的动态设置
摘要 在winform中应用sqlite和ef,对于sqlite连接字串的设置,大多情况下是不想写死了,你不知道用户会将你的exe程序安装在什么位置,也不知道他的电脑盘符是什么,如果写死了,那么很有可 ...
- webpack原理与实战
webpack是一个js打包工具,不一个完整的前端构建工具.它的流行得益于模块化和单页应用的流行.webpack提供扩展机制,在庞大的社区支持下各种场景基本它都可找到解决方案.本文的目的是教会你用we ...
- win8、server 2012 清除winsxs文件夹
使用系统自带的文件清理工具 1.组合键win+x ,选择“命令提示符(管理员)” 复制“dism /online /Cleanup-Image /StartComponentCleanup” 到dos ...
- mqtt介绍
MQTT是轻量级基于代理的发布/订阅的消息传输协议,它可以通过很少的代码和带宽和远程设备连接.例如通过卫星和代理连接,通过拨号和医疗保健提供者连接,以及在一些自动化或小型设备上,而且由于小巧,省电,协 ...
- View Programming Guide for iOS_读书笔记[正在更新……]
原文:View Programming Guide for iOS 1 Introduction 先熟悉一下基本概念. Window Windows do not have any visible c ...
- excel 批注
Excel VBA之Name对象.Comment对象及字体设置等,点滴学习积累 存在的方式 百家号11-1518:46 ======================================== ...
- Linux学习15-CentOS安装mysql5.6环境
前言 在linux上安装mysql5.6版本,并远程连接mysql数据库操作 安装mysql mysql的安装可以用yum安装更方便 [root@yoyo ~]# cd /usr/local/ [ro ...
- DNS 劫持 和 DNS 污染
1,用户需要访问www.liusuping.com这个网站,向DNS服务器提出解析请求. 2,DNS服务器通过检查发现www.liusuping.com域名的IP地址是127.0.0.1,将结果返回给 ...
- 黑吃黑第四季/全集Banshee迅雷下载
英文全名Banshee,第5季(2015)Cinemax. 本季看点:<黑吃黑>Ana Ayora加盟第四季,将会饰演Nina Cruz,表面上是在镇里一个聪明而又强悍的新副警长,但实际是 ...
