Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ubuntu-server-builder opened this issue May 12, 2023 · 4 comments
Labels
launchpad Migrated from Launchpad priority Fix soon

Comments

@ubuntu-server-builder
Copy link
Collaborator

This bug was originally filed in Launchpad as LP: #2003363

Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = 2023-03-23T19:37:32.652814+00:00
date_created = 2023-01-19T16:51:14.931881+00:00
date_fix_committed = 2023-01-23T15:57:20.412189+00:00
date_fix_released = 2023-03-23T19:37:32.652814+00:00
id = 2003363
importance = high
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/2003363
milestone = None
owner = showfom
owner_name = Showfom
private = False
status = fix_released
submitter = showfom
submitter_name = Showfom
tags = []
duplicates = []

Launchpad user Showfom(showfom) wrote on 2023-01-19T16:51:14.931881+00:00

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

@ubuntu-server-builder ubuntu-server-builder added launchpad Migrated from Launchpad priority Fix soon labels May 12, 2023
@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user James Falcon(falcojr) wrote on 2023-01-23T14:29:58.803764+00:00

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."

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user James Falcon(falcojr) wrote on 2023-01-23T15:57:11.767725+00:00

Showform, actually, it looks like this behavior has already been fixed, but is not yet released upstream. Please see #1868 .

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Showfom(showfom) wrote on 2023-01-24T07:15:36.843116+00:00

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

BTW, I'm Showfom, not Showform.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Brett Holman(holmanb) wrote on 2023-01-24T13:49:43.919905+00:00

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
launchpad Migrated from Launchpad priority Fix soon
Projects
None yet
Development

No branches or pull requests

1 participant