开始浏览时发送第一个数据包 [英] First packet to be sent when starting to browse

查看:134
本文介绍了开始浏览时发送第一个数据包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想象一下,一个用户坐在以太网连接的PC。他有一个浏览器中打开。他在地址栏中类型www.google.com,并点击进入。

Imagine a user sitting at an Ethernet-connected PC. He has a browser open. He types "www.google.com" in the address bar and hits enter.

现在告诉我出现在以太网上的第一个数据包是什么。

Now tell me what the first packet to appear on the Ethernet is.

我在这里找到了这个问题:<一href=\"http://stackoverflow.com/questions/177197/interview-questions-on-socket-programming-and-multi-threading\">http://stackoverflow.com/questions/177197/interview-questions-on-socket-programming-and-multi-threading

I found this question here: http://stackoverflow.com/questions/177197/interview-questions-on-socket-programming-and-multi-threading

由于我不是一个网络专家,我想听到的答案(我假设它是这取决于)。)

As I'm not a networking expert, I'd like to hear the answer (I'd assume it is "It depends" ;) ).

通过像Wireshark的一个工具,我可以明显地检查我自己的电脑的行为。我想知道我看到的数据包(如ARP,DNS,VRRP)在每个以太网配置相同是否(它是依赖于操作系统?驱动程序?浏览器甚至:)?),哪些是在条件它们出现。作为数据链路层,它是甚至依赖于物理网络(连接到集线器/交换机/路由器)上的?

With a tool like Wireshark, I can obviously check my own computers behaviour. I'd like to know whether the packets I see (e.g. ARP, DNS, VRRP) are the same in each ethernet configuration (is it dependent on the OS? the driver? the browser even :)?) and which are the conditions in which they appear. Being on the data-link layer, is it maybe even dependent on the physical network (connected to a hub/switch/router)?

推荐答案

这说说使用ARP查找DNS服务器的答案通常是错误的。

The answers that talk about using ARP to find the DNS server are generally wrong.

特别是,对离网IP地址,IP地址解析的从不的使用做了ARP,并回答这样一个ARP查询,这不是路由器的责任。

In particular, IP address resolution for off-net IP addresses is never done using ARP, and it's not the router's responsibility to answer such an ARP query.

网外的路由是由的客户的机器知道哪些IP地址是在本地子网它连接完成。如果请求的IP地址不在本地,那么客户机是指它的路由表,找出将数据包发送到网关。

Off-net routing is done by the client machine knowing which IP addresses are on the local subnets to which it is connected. If the requested IP address is not local, then the client machine refers to its routing table to find out which gateway to send the packet to.

因此​​,在大多数情况下的第一个的发出将是一个ARP请求,找到默认网关的MAC地址,如果不是已经在ARP高速缓存中的数据包。

Hence in most circumstances the first packet sent out will be an ARP request to find the MAC address of the default gateway, if it's not already in the ARP cache.

只有这样,它通过网关发送DNS查询。在这种情况下,该分组被用在IP目的地字段中的DNS服务器的IP地址发送的,但对以太网分组网关的MAC地址

Only then can it send the DNS query via the gateway. In this case the packet is sent with the DNS server's IP address in the IP destination field, but with the gateway's MAC address on the ethernet packet.

这篇关于开始浏览时发送第一个数据包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆