问题原文
原帖链接 · Konrads · CC BY-SA 3.0
I want to set a specific ethernet MAC address for an interface using UDEV rules. I have the following rule:
SUBSYSTEM=="net", ACTION=="add", ATTRS{serial}=="50B123", ATTR{address}="00:22:33:44:55:AA", NAME="yolo0"
The rule matches and the interface is renamed to "yolo0" however the hw ether address remains unchanged from the one pre-set by the manufacturer. I can change the mac address manually of course using:
ifconfig yolo0 hw ether ..00:22:33:44:55:AA
已采纳解答
原帖链接 · datenwolf · CC BY-SA 4.0
You can use udev PROGRAM rules for that, by making the appropriate call to ip link set … address …. Like this:
/etc/udev/rules.d/10-network-persistent-custom-mac-address.rules
SUBSYSTEM=="net", ACTION=="add", ATTRS{serial}=="50B123", PROGRAM="/sbin/ip link set %k address 00:22:33:44:55:AA"
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
