Systemd-networkd generated configuration is wrong when both ipv4 and ipv6 addresses are used

Bug #2003363 reported by Showfom
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
High
Unassigned

Bug Description

We install the latest cloud-init 22.4.2-2, re-generating the new profile and the new network config file for systemd-networkd is something like

root@arch /etc/systemd/network # cat 10-cloud-init-eth0.network
[Address]
Address=192.0.2.2/24

[Address]
Address=2001:db8::2/48

[Match]
MACAddress=ea:3a:ec:46:79:8e
Name=eth0

[Network]
DHCP=no
DNS=8.8.8.8 8.8.4.4

[Route]
Gateway=192.0.2.1
Gateway=2001:db8::1

Only IPv6 is working, IPv4 is not working, there's no default route for IPv4, we need to change to

[Route]
Gateway=192.0.2.1

[Route]
Gateway=2001:db8::1

Don't know if this is a bug from cloud-init or systemd-networkd

The old bug https://bugs.launchpad.net/cloud-init/+bug/1973724?comments=all

Revision history for this message
James Falcon (falcojr) wrote :

Looks like cloud-init needs to specify multiple route sections as well.

https://www.freedesktop.org/software/systemd/man/systemd.network.html
"Specify several [Route] sections to configure several routes."

Changed in cloud-init:
status: New → Triaged
importance: Undecided → High
assignee: nobody → James Falcon (falcojr)
Revision history for this message
James Falcon (falcojr) wrote :

Showform, actually, it looks like this behavior has already been fixed, but is not yet released upstream. Please see https://github.com/canonical/cloud-init/pull/1868 .

Changed in cloud-init:
assignee: James Falcon (falcojr) → nobody
status: Triaged → Fix Committed
Revision history for this message
Showfom (showfom) wrote :

James, thanks, we will wait for the next release :D

BTW, I'm Showfom, not Showform.

Revision history for this message
Brett Holman (holmanb) wrote :

Showfom

If you would like to test this unreleased fix, it should be possible on Arch Linux using the following patch against the 22.4.2-2 PKGBUILD. I think you'll need to build this with makepkg --skipchecksums, since this pulls directly from the tip of main.

```
diff --git a/repos/community-any/PKGBUILD b/repos/community-any/PKGBUILD
index 0c4dd72..eac1ae5 100644
--- a/repos/community-any/PKGBUILD
+++ b/repos/community-any/PKGBUILD
@@ -28,7 +28,7 @@ backup=(
   etc/cloud/cloud.cfg.d/05_logging.cfg
 )
 source=(
- $pkgname-$pkgver.tar.gz::https://github.com/canonical/cloud-init/archive/refs/tags/$pkgver.tar.gz
+ ${pkgname-$pkgver}::git+https://github.com/canonical/cloud-init.git
   $pkgname-22.1-lib_dir.patch
 )
 sha512sums=('b7d4629205ef2b184786908a3f922d635c811fed8f468649b1a892e93fbcbd54bc9eb366a49ceefb33acd32de1fc8d1a9a34c577c3b9d77825deb5f24e4fe18e'
@@ -37,18 +37,18 @@ b2sums=('9208053502f641da760dc3983838a7eddaad83ce18a8edd0f34437e3df0407a0370fcf4
         '4e03bd647ca9e1bc3d9c507824d43e4013a20d5bbcb7215755b427d0c7ded9ee48dbfb9faaae703ab2d519aee7c48a40277603c8f874347b574b7ac2b1e1a9fd')

 prepare() {
- cd $pkgname-$pkgver
+ cd $pkgname
   # we use /usr/lib
   patch -Np1 -i ../$pkgname-22.1-lib_dir.patch
 }

 build() {
- cd $pkgname-$pkgver
+ cd $pkgname
   python -m build --wheel --no-isolation
 }

 check() {
- cd $pkgname-$pkgver
+ cd $pkgname
   pytest -vv
 }

@@ -56,7 +56,7 @@ package() {
   local _file
   local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")

- cd $pkgname-$pkgver
+ cd $pkgname
   python -m installer --destdir="$pkgdir" dist/*.whl
   # NOTE: due to limitations with PEP517, files are installed to site-packages,
   # not to the correct global locations (e.g. /etc and /usr), so we remove them
```

Brett Holman (holmanb)
Changed in cloud-init:
status: Fix Committed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.