需要IP地址
当 MAC 地址是唯一的时,为什么我们还需要 IP 地址?不能只用MAC地址通讯吗?
Why do we need an IP address when the MAC address is unique? Cant we communicate only with the MAC address?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您可以仅使用 MAC 地址进行通信,但只能在本地网络上进行。 IP 地址是可路由的,网络上的每个系统都不需要相互了解。您只需要知道本地网络上的一系列地址,然后将其他所有内容交给路由器即可。同样的事情也发生在 ISP 级别。 “所有 216.xxx 流量都这样,所有 105.xxx 流量都这样……”(显然过于简单化,但这是基本过程)。
如果我们尝试通过 MAC 地址路由所有内容,则网络上的每台计算机都必须维护所有其他参与者的列表,而且它无法扩展。
You COULD communicate using only the MAC address, but only on your local network. IP addresses are routeable, without every system on the network needing to know about every other. You just need to know a range of addresses that are on your local network, and throw everything else up to your router. The same thing happens at the ISP level. "All 216.x.x.x traffic goes that way, all 105.x.x.x goes that way..."(Obviously a gross oversimplification, but that's the basic process).
If we tried to route everything by MAC address, every machine on the network would have to maintain a list of every other participant, and it just wouldn't scale.
不。MAC 地址特定于以太网,IP 独立于底层硬件。如果您有所需的网桥,则可以将不使用以太网的计算机连接到 Internet。
No. MAC addresses are specific to Ethernet, IP is independent of the underlying hardware. You can connect machines that don't use Ethernet to the Internet, if you have the required bridges.
我的一位伟大教授乔治·瓦尔盖斯(George Varghese)现在就职于加州大学圣地亚哥分校,他做了以下恰当的类比:你想给某人寄一封信。根据 MAC 地址发送到美国任何地方的设备就像向某人发送一封只知道其社会安全号码的信件。它确实唯一地标识了某人(好吧,是的,SSN 不能保证唯一,但假设这是为了举例),但如果没有一张包含每个人居住地的巨大表格供您查找,就很难找到他们按他们的 SSN 索引。
IP 地址(以及类似的开放系统互连 (OSI) 网络地址)更像是带有区号和交换号码的美国电话号码:(AAA) BBB-CCCC,其中 AAA 是区号,BBB 是交换号码, CCCC 在该交易所确定一条单独的线路。该号码中编码了分层信息,因此当您距离目的地很远时,您只需要一个按区号索引的小表即可确定将呼叫转发到的良好“下一跳”,而不是一个包含所有呼叫的表该国的电话号码。
A great professor of mine named George Varghese, now at UCSD, made the following apt analogy: You want to send someone a letter. The analogy of sending to a device anywhere in the USA based on its MAC address is like sending someone a letter knowing only their Social Security Number. It does uniquely identify someone (OK, yes, SSN isn't guaranteed unique, but suppose it was for the sake of example), but it would be very hard to find them without some giant table of where everyone lived that you could look up indexed by their SSN.
An IP address (and the similar Open Systems Interconnect, or OSI, network addresses) are more like USA phone numbers with area codes and exchange numbers: (AAA) BBB-CCCC, where AAA is an area code, BBB is an exchange number, and CCCC identifies an individual line at that exchange. There is hierarchical information encoded in that number, so that when you are far away from the destination, you only need a small table indexed by area code to determine a good "next hop" to forward the call to, rather than a table of all phone numbers in the country.
以太网是一种媒体访问层协议。它专门设计用于连接同一网络上的计算机。如果您想连接远程计算机,您当然需要通过多个路由器跳跃来跳转到目的地。 IP(互联网协议)就是为了这个目标而设计的,因此需要它,而以太网协议不支持路由。只有某些形式的原始桥接无法扩展到像互联网这样的大型事物。
Ethernet is a Medium Access Layer protocol. It was designed specifically to connect computers on the same network. If you want to connect computers remotely located, you certainly need to jump to destination by hopping through several routers. IP (Internet Protocol) was designed with this goal in mind, hence the need for it, while Ethernet protocol does not support routing. Only some forms of primitive bridging that would not scale for something huge like the Internet.
它们用于不同的协议层。
they are used for different protocol layer.
MAC 地址是您设备的特定地址。与您当前所在的地理位置等无关。
因此,在便携式设备的互联网络中路由数据包尤其困难。
会怎样:
假设您有一个便携式网络访问设备,您可以在该设备上使用互联网。如果我们仅使用 MAC 地址,任何传入数据包将如何找到您的便携式设备的位置。由于 MAC 地址仅提供固定的 48 位设备地址。 (最坏的情况是使用台式计算机并拥有 MAC 地址,但没有 IP 设施。将其与静态表结合起来,根据 MAC 地址找到您的预定义位置,但如果没有这些便携式设备,我们的生活就不完整,对吗?
)我们需要一些寻址方案来帮助我们在像互联网这样的大型便携式环境中进行寻址,因此 IP 的作用就显现出来了,其中地址是分层的,以提供更准确的地理位置。
MAC address is your device specific address. It has no relation with the geographical location, etc. you are in currently.
So it is difficult to route packet in an internetwork of portable devices especially.
How would it be:
Consider you have a portable network-accessing device with you on which you are using the internet. If we use only the MAC address, how would any incoming packet find the location of your portable-device. Since MAC address gives you only a fixed 48-bit device address. (The worst case scenario is using a desktop computer and having a MAC address without the IP facility. Coupling it with the static table to find your predefined location based on the MAC address, but our life is incomplete without these portable devices right?)
Thus we need some addressing scheme that can help us with addressing in a big and portable environment like internet, and thus the role of IP comes into picture, where address is hierarchal to provide a more geographically exact location.