diff --git a/docs/how-to.md b/docs/how-to.md index 1b3c3d62..b4ca8b8d 100644 --- a/docs/how-to.md +++ b/docs/how-to.md @@ -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: 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.