当您有本地 IP 地址时,为什么我们需要 MAC 个地址

Why do we need MAC addresses when you have local IP addresses

据我了解,MAC 地址是 物理地址 仅在 LAN 中用于 识别设备
但是,本地 IP 地址 也可以识别本地网络上的设备,因为它是唯一的。 那么,当我们只能为 LAN 和 WAN 使用 IP 地址时,为什么还要费心包括 MAC 地址呢?
我知道这是 OSI 模型和一些协议的基础,但我的问题是 为什么首先要这样做?似乎需要通过网络发送额外的不必要数据,并且 MAC 地址可能会被欺骗。

让我给你一个简单的答案。当您与 WIFI 网络或以太网断开连接时,本地 IP 地址将动态更改。 (有时它不会改变,因为其他任何人都没有连接到网络来保留您最近的 IP)。所以 MAC address 是你的网卡的唯一地址。我们可以从中唯一地识别您的设备。不能改,现在也可以改了

要回答“为什么首先要这样做”,您需要了解需要解决的问题。

以太网寻址 的创建是为了寻址同一物理网络上的不同设备。根据拓扑,需要考虑不同的事情。

IP协议的发明主要是为了解决路由问题,从物理布局上引入一个抽象层,本地网络可能有:

The selection of address formats is a problem
between networks because the local network
addresses of TCP’s may vary substantially in format
and size. A uniform internetwork TCP address
space, understood by each GATEWAY and TCP, is
essential to routing and delivery of internetwork
packets.

来源:A Protocol for Packet Network Intercommunication

Why are dynamic IP addresses a problem ? For example routers have a routing table for MAC adresses. Why couldn't we make a dynamic routing table that would store local IP adresses and that would be updated upon connection / disconnection of a device ? Or maybe the problem is elsewhere, I'm a bit confused why the dynamic part is a problem.

数据包肯定可以通过 IP table 而不是 MAC table 到达目标设备,但是使用动态 IP,数据包最终可能会到达错误的设备(当旧设备离线并且新设备使用相同的 IP 时),新设备无法确定数据包是否是没有标识符的自身,这就是 MAC 进来的时候。