1

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?

1

I believe it only changes the MAC address that gets reported to the external connection. Running ifconfig locally will always give you the interface's real MAC address.

1

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 :)

1

I had the same problem that Netplan didn't override the MAC address on Ubuntu Server 18.04, although I used a match clause as described in the netplan reference before setting the new MAC address.

The workaround was to create a separate systemd link configuration under /etc/systemd/network/10-override-mac.link to override the MAC address of the NIC and configure the rest via netplan.

[Match]
MacAddress=52:54:00:6b:3c:58

[Link]
MACAddress=52:54:00:6b:3c:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.