映射规则与例子
映射规则与例子
MAC = 01:00:5e + (IP 低 23 位)
224.0.0.5 -> 01:00:5e:00:00:05
239.255.255.250 -> 01:00:5e:7f:ff:fa
# Python 验证
import ipaddress
ip = int(ipaddress.IPv4Address('239.255.255.250'))
low23 = ip & 0x7FFFFF
print('01:00:5e:%02x:%02x:%02x' % ((low23>>16)&0xff,(low23>>8)&0xff,low23&0xff))
# 01:00:5e:7f:ff:fa32 路重合意味着网卡可能收到“别人的”组播帧,必须在 IP 层过滤:如 239.1.1.1 与 239.129.1.1 共享同一 MAC。