[how-to]: fix documentation example (#1596)

- Related to #1534
This commit is contained in:
Saehej Kang
2026-05-28 15:45:41 -07:00
committed by GitHub
parent c5a8d7a802
commit f4f5925c08
+3 -6
View File
@@ -244,14 +244,11 @@ The MAC address must be in the format `XX:XX:XX:XX:XX:XX` (with colons or hyphen
container run --network default,mac=02:42:ac:11:00:02 ubuntu:latest
```
To verify the MAC address is set correctly, run `ip addr show` inside the container:
To verify the MAC address is set correctly, read the interface MAC directly from sysfs inside the container:
```console
% container run --rm --network default,mac=02:42:ac:11:00:02 ubuntu:latest ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff
inet 192.168.64.2/24 brd 192.168.64.255 scope global eth0
valid_lft forever preferred_lft forever
% container run --rm --network default,mac=02:42:ac:11:00:02 ubuntu:latest cat /sys/class/net/eth0/address
02:42:ac:11:00:02
```
If you don't specify a MAC address, `container` will generate one for you. The generated address has a first nibble set to hexadecimal `f` (`fX:XX:XX:XX:XX:XX`) in case you want to minimize the very small chance of conflict between your MAC address and generated addresses.