arp协议、mac和ip

发布于 2024-09-04 08:54:57 字数 156 浏览 8 评论 0原文

对 ARP 感兴趣并想检查一下。

ARP协议是用来查找MAC和IP地址的,是吗?

与此有何不同:

IPHostEntry iphostentry = Dns.GetHostByName(strHostName);

interested in ARP and wanted to check.

ARP protocol is used found MAC and IP addresses, yes?

How is it different from this:

IPHostEntry iphostentry = Dns.GetHostByName(strHostName);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

开始看清了 2024-09-11 08:54:57

Dns.GetHostByName() 使用 DNS - 从 DNS 域 (www.google.com) 获取 IP 地址 (1.2.3.4)。

ARP 用于从 IP (1.2.3.4) 获取 MAC 地址 (11:22:33:44:55:66)。

假设您在浏览器中输入 www.google.com:

  1. 它需要找出 www.google.com 的 IP,因此它使用 DNS 来完成此操作。
  2. 它需要将数据包发送到 www.google.com 的 IP 地址,但在以太网级别,这意味着您首先需要将数据包发送到目标路由中的下一个路由器(可能是您的默认网关)。
  3. 要在以太网级别执行此操作,您需要知道默认网关的 MAC 地址是什么 - 这是使用 ARP 完成的。

ARP 向局域网发送一个问题 - 谁有 1.2.3.4?拥有它的人都会回答 - 这样发送者就知道他需要将数据包发送到的 1.2.3.4 的 MAC 地址是什么。

请参阅 http://en.wikipedia.org/wiki/Address_Resolution_Protocol

http://en.wikipedia.org/wiki/Domain_Name_System

Dns.GetHostByName() uses DNS - to get IP address (1.2.3.4) from a DNS domain (www.google.com).

ARP is used to get a MAC address (11:22:33:44:55:66) from IP (1.2.3.4).

Let's say you write www.google.com in your browser:

  1. It needs to find out what IP is www.google.com, so it uses DNS to do that.
  2. It needs to send packets to the IP address of www.google.com, but in the Ethernet level, this means you first need to send the packets to the next router in the route to the target (probably your default gateway).
  3. To do that in the Ethernet level, you need to know what is the MAC address of the default gateway - this is done using ARP.

ARP sends a question to the LAN - who has 1.2.3.4? And whoever has it answers - so the sender knows what's the MAC address of 1.2.3.4 that he needs to send the packets to.

See http://en.wikipedia.org/wiki/Address_Resolution_Protocol

And http://en.wikipedia.org/wiki/Domain_Name_System

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文