0

I am configuring a PC network with netplan and the following configuration: only one ethernet device with MAC address 48:b0:2d:d3:d1:c4, and an USB-to-ethernet adapter.

I need the ethernet device (eth0) to have a static IP 192.168.0.50, and the usb-to-eth adapter (ethX) to have a static IP 192.168.1.50.

My netplan configuration is the following:

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: false
      dhcp6: false
      match:
        macaddress: 48:b0:2d:d3:d1:c4
      set-name: eth0
      optional: false
      addresses:
        - 192.168.0.50/24
      routes: 
        - to: default
          via: 192.168.0.1
          on-link: true
    eth1:
      dhcp4: false
      dhcp6: false
      optional: false
      addresses:
        - 192.168.1.50/24

However, after rebooting the system, the following configuration is set:

$ ip addr
3: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:e0:4c:68:00:2a brd ff:ff:ff:ff:ff:ff
5: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 48:b0:2d:d3:d1:c4 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.50/24 brd 192.168.1.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::4ab0:2dff:fed3:d1c4/64 scope link 
       valid_lft forever preferred_lft forever

networkd is setting to the device with mac address 48:b0:2d:d3:d1:c4 the eth1 name and the wrong IP, when it should be eth0 and IP 192.168.0.50.

I tried using also NetworkManager, but the result is the same.. That's why I changed to networkd in the first place.

I have checked also that NetworkManager service is off, and, indeed, it is disabled and off. Also, I have checked there are no rules on /etc/systemd/network.

What makes me wonder is why the eth0 seems to be DOWN.. Do you know what I am missing?

Thanks in advance!

1
  • Try not renaming it eth0 but eth2 and see if eth2 gets correctly configured? It could be that renaming eth1 to eth0 fails when eth0 already exists.
    – A.B
    Commented Mar 22, 2023 at 22:26

1 Answer 1

0

You assert that eth0 has MAC address 48:b0:2d:d3:d1:c4 in your configuration - but when your machine is rebooted it is seeing that the first NIC (eth0) has mac address 00:e0:4c:68:00:2a and hence is not using the address 192.168.0.50/24

If you really want eth0 to have that IP address, change the MAC address in your config. OTOH of you want the MAC address to match the IP address, swap the names eth0 and eth1 about in your config.

1
  • I was so confused and fixed with the idea of having matching ethX with the subnet 192.168.X.50, that I didn't think on changing the name of the device to something different than ethX. Thanks!
    – adiego73
    Commented Mar 23, 2023 at 12:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .