netplan can't set broadcast address
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Netplan |
New
|
Undecided
|
Unassigned |
Bug Description
Spent a couple hours trying to use netplan recently, and it turns out it can't physically configure my interfaces. Oops.
OVH uses weird SDN floating IPs where each IP you get is a self-contained /32 (allows them to hand out full subnets without wasting IPs on router and broadcast addresses). For their setup, the broadcast address *must* be the public IP address itself (and the gateway is defined as a directly attached or on-link route).
Right now with a /32 IP, netplan defaults the broadcast address to 0.0.0.0.
As for fixing this on the netplan-side, netplan IP addresses are just a yaml list and not a yaml dict, so we can't easily attach a "broadcast" field to the existing IP list without also turning IPs into a field, which kills existing schemas.
Potential solutions:
If you see a /32, set the broadcast address to itself automatically (would this break other assumptions and/or configs? unsure).
Or, we'd need a new dict to bind explicit broadcast IP details to existing IP definitions like:
broadcasts:
- ip: 1.2.3.4
broadcast: 1.2.3.4
For now, I've skipped netplan and basically created my own mini-netplan in ansible to template the systemd network config with:
(using 2.2.2.2/32 as the host IP/network and 4.4.4.4 as the gateway IP)
ethernets:
interface: ens4
addresses:
- ip: 2.2.2.2/32
routes:
- to: 4.4.4.4/32
via: 4.4.4.4
on-link: true
- to: 0.0.0.0/0
via: 4.4.4.4
on-link: true
and here's the resulting systemd network config that must exist for the OVH networking to function:
[Match]
Name=ens4
[Network]
Address=2.2.2.2/32
[Address]
Address=2.2.2.2/32
Broadcast=2.2.2.2
[Route]
Destination=
Gateway=4.4.4.4
GatewayOnlink=true
[Route]
Destination=
Gateway=4.4.4.4
GatewayOnlink=true
I am also trying to use netplan on OVH. However I have found that the broadcast address being set to 0.0.0.0 doesn't seem to be a problem.
Instead I think the problem that I (and possibly you have) is getting the routes correctly set.
I started with something like this:
network:
addresses:
gateway4: 91.121.89.254
macaddress: 06:00:00:42:9b:44
nameserver s:
addresses:
search:
set- name: ens3
version: 2
ethernets:
ens3:
- 54.36.67.139/32
match:
- 213.186.33.99
- mydomain.com
However when the interface comes up, if I run `route -n` then I see no routing entries:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
Before Netplan, when using /etc/network/ interfaces I had to do some tricks to configure the routing as specifying `gateway` did not work:
iface ens3 inet static
dns-nameserver s 213.186.33.99
address 54.36.67.139
netmask 255.255.255.255
network 54.36.67.139
broadcast 5.196.205.132
post-up /sbin/route add 91.121.89.254 dev ens3
post-up /sbin/route add default gw 91.121.89.254
pre-down /sbin/route del 91.121.89.254 dev ens3
pre-down /sbin/route del default gw 91.121.89.254
dns-search mydomain.com
Although in some newer version of Ubuntu that seems to have been fixed and I can now just use ` gateway 91.121.89.254` instead of the post-up and post-down hooks.
After Netplan starts up with the config I provided above, if I manually run:
sudo route add 91.121.89.254 dev ens3
sudo route add default gw 91.121.89.254
then everything is working and I have network and Internet access. At that point `route -n` reports:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 91.121.89.254 0.0.0.0 UG 0 0 0 ens3
91.121.89.254 0.0.0.0 255.255.255.255 UH 0 0 0 ens3
Based on that information, I also tried the following Netplan config:
network:
addresses:
macaddress: 06:00:00:42:9b:44
nameserver s:
addresses:
search:
set- name: ens3
via: 0.0.0.0
via: 91.121.89.254
version: 2
ethernets:
ens3:
- 54.36.67.139/32
match:
- 213.186.33.99
- mydomain.com
routes:
- to: 91.121.89.254/32
- to: 0.0.0.0/0
Unfortunately this only seems to register one of the two routes for some reason?!?. So no network or Internet access with that second Netplan config, and now `route -n` reports:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
91.121.89.254 0.0.0.0 255.255.255.255 UH 0 0 0 ens3