Score:1

Ubuntu 22.04 configure local IP via netplan (systemd-networkd)

mh flag
Utz

I have a server installed with Ubuntu 22.04, with two physical network interfaces - eno1 and eno2, and I configure these network interfaces with netplan (which uses systemd-networkd). eno1 is with link detected, and it is configured with dhcp, and eno2 is without link detected (which is OK), and it is configured with a local IP.

The problem: eno2 do not get a local IP address via netplan.

The files:

cat /etc/netplan/50-eno1.yaml 
network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: true
      dhcp6: false
-----------------------------
cat /etc/netplan/60-eno2.yaml 
network:
  version: 2
  renderer: networkd
  ethernets:
    eno2:
      addresses: [192.168.0.10/24]
      dhcp4: false
      dhcp6: false
      optional: true
-----------------------------
cat /run/systemd/network/10-netplan-eno1.network 
[Match]
Name=eno1

[Network]
DHCP=ipv4
LinkLocalAddressing=ipv6

[DHCP]
RouteMetric=100
UseMTU=true
-----------------------------
cat /run/systemd/network/10-netplan-eno2.network 
[Match]
Name=eno2

[Link]
RequiredForOnline=no

[Network]
LinkLocalAddressing=ipv6
Address=192.168.0.10/24

ifconfig:

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.1  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 aa::aaa:aaa:aaaa:aaaa  prefixlen 64  scopeid 0x20<link>
        ether bb:bb:bb:bb:bb:bb  txqueuelen 1000  (Ethernet)
        RX packets 1197608  bytes 75258702 (75.2 MB)
        RX errors 0  dropped 84445  overruns 0  frame 0
        TX packets 8120  bytes 1741477 (1.7 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xbbbbbb-bbbbbb  

eno2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether bb:bb:bb:bb:bb:bb  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 memory 0x9c900000-9c9fffff  

netplan --debug apply:

** (generate:169153): DEBUG: 09:57:10.149: starting new processing pass
** (generate:169153): DEBUG: 09:57:10.149: starting new processing pass
** (generate:169153): DEBUG: 09:57:10.149: We have some netdefs, pass them through a final round of validation
** (generate:169153): DEBUG: 09:57:10.149: eno2: setting default backend to 1
** (generate:169153): DEBUG: 09:57:10.149: Configuration is valid
** (generate:169153): DEBUG: 09:57:10.149: eno1: setting default backend to 1
** (generate:169153): DEBUG: 09:57:10.149: Configuration is valid
** (generate:169153): DEBUG: 09:57:10.149: Generating output files..
** (generate:169153): DEBUG: 09:57:10.149: openvswitch: definition eno1 is not for us (backend 1)
** (generate:169153): DEBUG: 09:57:10.149: NetworkManager: definition eno1 is not for us (backend 1)
** (generate:169153): DEBUG: 09:57:10.149: openvswitch: definition eno2 is not for us (backend 1)
** (generate:169153): DEBUG: 09:57:10.149: NetworkManager: definition eno2 is not for us (backend 1)
DEBUG:netplan generated networkd configuration changed, reloading networkd
** (process:169151): DEBUG: 09:57:14.520: starting new processing pass
** (process:169151): DEBUG: 09:57:14.520: starting new processing pass
** (process:169151): DEBUG: 09:57:14.520: We have some netdefs, pass them through a final round of validation
** (process:169151): DEBUG: 09:57:14.520: eno2: setting default backend to 1
** (process:169151): DEBUG: 09:57:14.520: Configuration is valid
** (process:169151): DEBUG: 09:57:14.520: eno1: setting default backend to 1
** (process:169151): DEBUG: 09:57:14.520: Configuration is valid
DEBUG:Merged config:
b''
DEBUG:no netplan generated NM configuration exists
** (process:169151): DEBUG: 09:57:14.527: starting new processing pass
** (process:169151): DEBUG: 09:57:14.527: starting new processing pass
** (process:169151): DEBUG: 09:57:14.527: We have some netdefs, pass them through a final round of validation
** (process:169151): DEBUG: 09:57:14.527: eno2: setting default backend to 1
** (process:169151): DEBUG: 09:57:14.527: Configuration is valid
** (process:169151): DEBUG: 09:57:14.527: eno1: setting default backend to 1
** (process:169151): DEBUG: 09:57:14.527: Configuration is valid
DEBUG:Merged config:
b''
DEBUG:Link changes: {}
DEBUG:netplan triggering .link rules for lo
DEBUG:netplan triggering .link rules for eno3
DEBUG:netplan triggering .link rules for eno4
DEBUG:netplan triggering .link rules for eno5
DEBUG:netplan triggering .link rules for eno6
DEBUG:netplan triggering .link rules for eno1
DEBUG:netplan triggering .link rules for eno2
** (process:169151): DEBUG: 09:57:14.673: starting new processing pass
** (process:169151): DEBUG: 09:57:14.673: starting new processing pass
** (process:169151): DEBUG: 09:57:14.673: We have some netdefs, pass them through a final round of validation
** (process:169151): DEBUG: 09:57:14.673: eno2: setting default backend to 1
** (process:169151): DEBUG: 09:57:14.673: Configuration is valid
** (process:169151): DEBUG: 09:57:14.673: eno1: setting default backend to 1
** (process:169151): DEBUG: 09:57:14.673: Configuration is valid
** (process:169151): DEBUG: 09:57:14.673: starting new processing pass
** (process:169151): DEBUG: 09:57:14.673: starting new processing pass
** (process:169151): DEBUG: 09:57:14.673: We have some netdefs, pass them through a final round of validation
** (process:169151): DEBUG: 09:57:14.673: eno2: setting default backend to 1
** (process:169151): DEBUG: 09:57:14.673: Configuration is valid
** (process:169151): DEBUG: 09:57:14.673: eno1: setting default backend to 1
** (process:169151): DEBUG: 09:57:14.673: Configuration is valid
DEBUG:Merged config:
b''

NOTE: When I run ip addr add 192.168.0.10/24 dev eno2 it works and I have an IP (pingable) on eno2. But I wish to have it with netplan.

Andrew Lowther avatar
jp flag
maybe `ignore-carrier` as described at https://unix.stackexchange.com/a/697946/561090
Utz avatar
mh flag
Utz
Yes!! it works. Thank you!
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.