Ubuntu – Netplan not spoofing MAC as expected

networkingUbuntuubuntu-18.04

I'm trying to set a different MAC address on one of my interfaces, but my attempts following the netplan documentation result in no change. This is on Ubuntu 18.04.

network:
    ethernets:
        enp10s0:
            addresses: []
            dhcp4: true
            optional: true
            routes:
                - to: 0.0.0.0/0
                  via: 10.0.0.1
        enp5s0:
            addresses: []
            dhcp4: true
            macaddress: aa:bb:cc:ff:ff:ff
            optional: true
            routes:
                - to: 239.0.0.0/8
                  via: 10.10.0.1
    version: 2

After running netplan generate and netplan apply, and also rebooting, there is no change to the macaddress of enp5s0

enp10s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.227  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::7285:c2ff:fe53:119c  prefixlen 64  scopeid 0x20<link>
        ether 70:85:c2:53:11:9c  txqueuelen 1000  (Ethernet)
        RX packets 3623  bytes 1557193 (1.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3066  bytes 291335 (291.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp5s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 68:05:ca:61:a8:fc  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 34  memory 0xfd4c0000-fd4e0000

What have I missed?

Best Answer

All right, I had the same problem but I finally got fixed by adding a match keyword in my script, my MAC address was 4c:ed:fe:32:de:22 and I had to specify it before changing it or forcing it. (I also added a renderer which is networkd)

network:
    renderer: networkd
    ethernets:
        eno1:
            addresses: []
            dhcp4: true
            optional: true
        enp1s0:
            match:
                 macaddress: 4c:ed:fe:32:de:22
            macaddress: de:de:de:de:de:de
            dhcp4: no
            dhcp6: no
            addresses: [172.30.0.58/24, ]
            gateway4: 172.30.0.254
            nameservers:
                addresses: [208.67.222.222, 208.67.220.220]
    version: 2

I sincerely hope this helps you buddy :)