[Bug 1836695] Re: Netplan ignores static routes when using DHCP

2019-09-27 Thread Dan Streetman
@pedersen-larserik, @zagarin, can either of you could test your netplan
config on 19.10 (Eoan) to verify things work for you there?

** Description changed:

+ [impact]
+ 
+ a systemd-networkd configuration that uses ipv4 dhcp but ignores the
+ dhcp-provided route, and instead sets up a static route, and also does
+ not include a static ipv4 address, fails to actually create the static
+ route.
+ 
+ This is due to networkd attempting to set up the static route before the
+ dhcp ipv4 address is assigned, and the kernel does not allow creation of
+ the route before setting up corresponding ipv4 address.
+ 
+ this results in a network that does have the dhcp-provided ipv4 address,
+ but is missing both its dhcp-provided route (because networkd is
+ configured to ignore it) and the static route (because networkd was not
+ able to create it).
+ 
+ [test case]
+ 
+ (remove or unconfigure netplan, so it will not conflict with this manual
+ networkd configuration)
+ 
+ create a networkd config file, e.g.:
+ 
+ $ cat /etc/systemd/network/10-eth0.network 
+ [Match]
+ Name=eth0
+ 
+ [Network]
+ DHCP=ipv4
+ 
+ [Route]
+ Destination=10.0.0.0/8
+ Gateway=10.202.51.1
+ 
+ [DHCP]
+ UseRoutes=false
+ 
+ 
+ then *reboot* the system, and check that the static route was not applied:
+ 
+ $ ip r
+ 10.202.51.0/24 dev eth0 proto kernel scope link src 10.202.51.254 
+ 
+ 
+ note that because networkd does not remove ipv4 addresses that it manages 
(including dhcpv4 addresses), restarting networkd after the initial boot
+ will correctly create the static route, e.g.:
+ 
+ ubuntu@lp1836695-b:~$ ip r
+ 10.202.51.0/24 dev eth0 proto kernel scope link src 10.202.51.254 
+ ubuntu@lp1836695-b:~$ sudo systemctl restart systemd-networkd
+ ubuntu@lp1836695-b:~$ ip r
+ 10.0.0.0/8 via 10.202.51.1 dev eth0 proto static 
+ 10.202.51.0/24 dev eth0 proto kernel scope link src 10.202.51.254 
+ 
+ [regression potential]
+ 
+ adjusting how networkd works always carries the risk of breaking
+ networking.
+ 
+ TBD detailed regression potential after analyzing fix.
+ 
+ [other info]
+ 
+ original description:
+ 
+ --
+ 
+ 
  Consider the following setup:
  
  network:
-   version: 2
-   renderer: networkd
-   ethernets:
- ens4:
-   dhcp-identifier: mac
-   dhcp4: yes
-   dhcp4-overrides:
- use-dns: no
- use-ntp: no
- send-hostname: no
- use-hostname: no
- use-routes: no
-   routes:
-   - to: 10.0.0.0/8
- via: 10.50.0.1
-   optional: true
+   version: 2
+   renderer: networkd
+   ethernets:
+ ens4:
+   dhcp-identifier: mac
+   dhcp4: yes
+   dhcp4-overrides:
+ use-dns: no
+ use-ntp: no
+ send-hostname: no
+ use-hostname: no
+ use-routes: no
+   routes:
+   - to: 10.0.0.0/8
+ via: 10.50.0.1
+   optional: true
  
  Thus I only need to get the IP address by DHCP, then add some static
  routes. This setup doesn't work. Apparently `routes` keyword only works
  when using static addresses.

** Summary changed:

- Netplan ignores static routes when using DHCP
+ systemd fails to setup static routes at boot when using DHCP

** Also affects: systemd (Ubuntu Bionic)
   Importance: Undecided
   Status: New

** Also affects: systemd (Ubuntu Eoan)
   Importance: High
   Status: New

** Also affects: systemd (Ubuntu Disco)
   Importance: Undecided
   Status: New

** Changed in: systemd (Ubuntu Eoan)
   Status: New => Fix Released

** Changed in: systemd (Ubuntu Eoan)
   Importance: High => Medium

** Changed in: systemd (Ubuntu Bionic)
   Importance: Undecided => Medium

** Changed in: systemd (Ubuntu Bionic)
   Status: New => In Progress

** Changed in: systemd (Ubuntu Bionic)
 Assignee: (unassigned) => Dan Streetman (ddstreet)

** Changed in: systemd (Ubuntu Disco)
   Importance: Undecided => Medium

** Changed in: systemd (Ubuntu Disco)
   Status: New => In Progress

** Changed in: systemd (Ubuntu Disco)
 Assignee: (unassigned) => Dan Streetman (ddstreet)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1836695

Title:
  systemd fails to setup static routes at boot when using DHCP

To manage notifications about this bug go to:
https://bugs.launchpad.net/netplan/+bug/1836695/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1836695] Re: Netplan ignores static routes when using DHCP

2019-08-21 Thread Lars Erik Pedersen
Hi. I did som further investigation here, and I think I've figured out
what happens in networkd here.

Aug 21 10:54:45 nettest1 systemd-networkd[5463]: ens3: Removing address: 
2001:700:1d00:ec00:5054:ff:fe49:4bc9/64 (valid for 4w 2d)
Aug 21 10:54:46 nettest1 systemd-networkd[5463]: ens3: Removing address: 
10.212.128.84/24 (valid for 11h 57min 54s)
Aug 21 10:54:46 nettest1 systemd-networkd[5463]: Sent message type=signal 
sender=n/a destination=n/a path=/org/freedesktop/network1/link/_32 
interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=17 
reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Aug 21 10:54:46 nettest1 systemd-networkd[5463]: Sent message type=signal 
sender=n/a destination=n/a path=/org/freedesktop/network1 
interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=18 
reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Aug 21 10:54:46 nettest1 systemd-networkd[5463]: ens3: Routing policy rule 
configured
Aug 21 10:54:46 nettest1 systemd-networkd[5463]: ens3: Could not set route: 
Network is unreachable
Aug 21 10:54:46 nettest1 systemd-networkd[5463]: ens3: Routes set
Aug 21 10:54:46 nettest1 systemd-networkd[5463]: ens3: Adding address: 
10.212.128.84/24 (valid for 12h)
Aug 21 10:54:46 nettest1 systemd-networkd[5463]: Sent message type=signal 
sender=n/a destination=n/a path=/org/freedesktop/network1/link/_32 
interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=19 
reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Aug 21 10:54:46 nettest1 systemd-networkd[5463]: Sent message type=signal 
sender=n/a destination=n/a path=/org/freedesktop/network1 
interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=20 
reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Aug 21 10:54:46 nettest1 systemd-networkd[5463]: ens3: Configured

Basically it seems like networkd does the following on "netplan apply":
1) Remove every address
2) Add routes - which of course will fail with "network is unreachable" because 
the interfaces don't have an address yet
3) Adding the addresses

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1836695

Title:
  Netplan ignores static routes when using DHCP

To manage notifications about this bug go to:
https://bugs.launchpad.net/netplan/+bug/1836695/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1836695] Re: Netplan ignores static routes when using DHCP

2019-08-20 Thread Mathieu Trudel-Lapierre
Since netplan only does writing configuration to be consumed by the
backends like systemd, this would actually be a systemd bug;
reassigning.

I thought that worked though, in some setups, especially with use-
routes: false as it was being done in the config above.

Nevertheless, it needs investigation. I expect we could see the routes
are being installed, then ripped out after systemd-networkd gets an
address from DHCP.

** Also affects: systemd (Ubuntu)
   Importance: Undecided
   Status: New

** Changed in: netplan
   Status: New => Invalid

** Changed in: systemd (Ubuntu)
   Importance: Undecided => High

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1836695

Title:
  Netplan ignores static routes when using DHCP

To manage notifications about this bug go to:
https://bugs.launchpad.net/netplan/+bug/1836695/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs