跳转至

MAC 地址设置

名称

  mac

详细信息

类型 字节序列
DHCP 选项编号 不适用
ISC dhcpd 语法 hardware ethernet

示例

显示接口 "net0" 的 MAC 地址

  iPXE> show net0/mac
  net0/mac:hex = 52:54:00:12:34:56

把 MAC 地址传递给服务器端引导脚本

  iPXE> chain http://boot.ipxe.org/demo/boot.php?mac=${net0/mac}

为接口 "net0" 设置用户自定义 MAC 地址

  iPXE> ifclose net0
  iPXE> set net0/mac 02:00:69:50:58:45
  iPXE> ifopen net0

恢复接口 "net0" 的原始 MAC 地址

  iPXE> clear net0/mac

在 ISC dhcpd 中配置 DHCP 保留

  # in /etc/dhcpd.conf
  host example1 {
      hardware ethernet 52:54:00:12:34:56;
      fixed-address 192.168.0.100;
  }

描述

指定在所有收发的数据包中用于标识网络设备的 MAC 地址。

另请参阅

备注

通常情况下你不需要修改 MAC 地址。

只有在接口关闭时才应该修改 MAC 地址。你可以使用 ifcloseifopen 命令关闭和重新打开接口。

并非所有 iPXE 网卡驱动都支持设置用户自定义 MAC 地址。在不支持的网卡上,你可能会遇到意外行为,例如无法接收发往用户自定义 MAC 地址的数据包。

你可以使用 hexhyp 设置类型,以连字符("-")代替冒号(":")作为分隔符来获取 MAC 地址。例如:

 iPXE> echo ${net0/mac:hexhyp}
 52-54-00-12-34-56