I have verified the fix using systemd 252.5-2ubuntu3.1 from lunar-proposed:
The VM and test networks are already configured on my system:
nr@six:/t/tmp.jTS3wdPdT3$ virsh list
Id Name State
-----------------------------------
9 clean-lunar-amd64 running
nr@six:/t/tmp.jTS3wdPdT3$ virsh net-list
Name State Autostart Persistent
--------------------------------------------
default active yes yes
no-dhcp active no no
I have verified the fix using systemd 252.5-2ubuntu3.1 from lunar-proposed:
The VM and test networks are already configured on my system:
nr@six: /t/tmp. jTS3wdPdT3$ virsh list ------- ------- ------- -------
Id Name State
-------
9 clean-lunar-amd64 running
nr@six: /t/tmp. jTS3wdPdT3$ virsh net-list ------- ------- ------- ------- ------- --
Name State Autostart Persistent
-------
default active yes yes
no-dhcp active no no
nr@six: /t/tmp. jTS3wdPdT3$ virsh net-dumpxml --network default default< /name> 04260896- 2701-422d- 84e0-8e0df1122d b3</uuid> '52:54: 00:bd:9f: 3a'/> '192.168. 122.1' netmask= '255.255. 255.0'> 192.168. 122.2' end='192. 168.122. 254'/>
<network connections='2'>
<name>
<uuid>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address=
<ip address=
<dhcp>
<range start='
</dhcp>
</ip>
</network>
nr@six: /t/tmp. jTS3wdPdT3$ virsh net-dumpxml --network no-dhcp no-dhcp< /name> 2c047740- caab-4c90- 8421-70da6732a7 59</uuid> '52:54: 00:ac:12: 45'/> '172.16. 1.1' netmask= '255.255. 0.0'>
<network>
<name>
<uuid>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<bridge name='virbr1' stp='on' delay='0'/>
<mac address=
<ip address=
</ip>
</network>
Running the test case:
(Host)
nr@six: /t/tmp. jTS3wdPdT3$ virsh detach-interface clean-lunar-amd64 network
Interface detached successfully
(VM)
root@clean- lunar-amd64: /home/nr# apt-cache policy systemd security. ubuntu. com/ubuntu lunar-proposed/main amd64 Packages archive. ubuntu. com/ubuntu lunar-proposed/main amd64 Packages dpkg/status archive. ubuntu. com/ubuntu lunar/main amd64 Packages lunar-amd64: /home/nr# cat > /etc/systemd/ network/ 10-dhcp. network << EOF
systemd:
Installed: 252.5-2ubuntu3.1
Candidate: 252.5-2ubuntu3.1
Version table:
*** 252.5-2ubuntu3.1 500
500 http://
500 http://
100 /var/lib/
252.5-2ubuntu3 500
500 http://
root@clean-
[Match]
Name=en*
[Network] lunar-amd64: /home/nr# systemctl restart systemd-networkd
DHCP=yes
EOF
root@clean-
(Host)
nr@six: /t/tmp. jTS3wdPdT3$ virsh attach-interface clean-lunar-amd64 network no-dhcp
Interface attached successfully
(VM)
root@clean- lunar-amd64: /home/nr# networkctl
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
5 ens3 ether degraded configuring
2 links listed. lunar-amd64: /home/nr# /lib/systemd/ systemd- networkd- wait-online --any --timeout=10 lunar-amd64: /home/nr# networkctl
root@clean-
Timeout occurred while waiting for network connectivity.
root@clean-
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
5 ens3 ether degraded configuring
2 links listed.
(Host)
nr@six: /t/tmp. jTS3wdPdT3$ virsh attach-interface clean-lunar-amd64 network default
Interface attached successfully
(VM)
root@clean- lunar-amd64: /home/nr# /lib/systemd/ systemd- networkd- wait-online --any --timeout=0 lunar-amd64: /home/nr# echo $? lunar-amd64: /home/nr# networkctl
root@clean-
0
root@clean-
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
5 ens3 ether degraded configuring
6 ens9 ether routable configured
3 links listed.