Static ipv4 on Debian 12 with netplan

Hello,

I managed to configure everything in bridge mode (IPv4/6) and static, well, not exactly. I'm scratching my head with this oddity.

In short, if I activate DHCP on eno3, yet still use static configuration on br0, everything seems to work. But that seems rather messy. If after that, I remove the dhcp config and "apply", things continue to work (I don't know if this would stop working at some point though).

However, if I have all dhcp settings set to false, and reboot, IPv4 does not route. I can ping my own public IPv4 from the server, I can ping the router, but I can't ping outside. It almost feels as if using static configuration seems to upset the router.

There is no difference with the output of `netplan status --all` regardless of the settings/reboots etc.

This is the config that should work with `dhcp4: false` in en03 instead of `true`. I'm obviously missing something, but I have no clue what.


network:
version: 2
ethernets:
eno3:
dhcp4: true
dhcp6: false

bridges:
br0:
interfaces: [eno3]
addresses:
- IPV4/24
- IPV6/64
- IPV6-2/64
routes:
- to: default
via: IPV4.254
on-link: true
- to: IPV6/128
via: '::'
- to: default
via: IPV6:ff:ff:ff:ff
mtu: 1500
nameservers:
addresses:
- 2001:41d0:3:163::1
- 213.186.33.99
parameters:
stp: true
forward-delay: 4
dhcp4: false
dhcp6: false

Edit: If I use the exact same configuration under `eno3` (without the bridge parameters of course) it all works fine.

Hello,

What kind of service do you have (VPS ? baremetal ?) ?

Why are you using a bridge ?
And why do you keep the DHCP on true ?

Cordially, Janus57

Hello Janus57,

It's a bare metal dedicated server.

I'm using a bridge for virtual machins.

Sorry for not being clear about the DHCP setting, it's supposed to be false, of course, the issue is that when it is false, IPv4 does not work.

Hello,


I'm using a bridge for virtual machins.

you don't use a hypervisor ?

As for the file, for me it should be something like that :
<br />network:<br /> version: 2<br /> ethernets:<br /> eno3:<br /> dhcp4: false<br /> dhcp6: false<br /><br /> bridges:<br /> br0:<br /> macaddress: mm:mm:mm:mm:mm:mm #same as eno3<br /> interfaces: [eno3]<br /> addresses:<br /> - IPV4/24<br /> - IPV6/64<br /> - IPV6-2/64<br /> routes:<br /> - to: default<br /> via: #infos in OVH manager<br /> on-link: true<br /> - to: default<br /> via: #infos in OVH manager<br /> mtu: 1500<br /> nameservers:<br /> addresses:<br /> - 2001:41d0:3:163::1<br /> - 213.186.33.99<br /> parameters:<br /> stp: true<br /> forward-delay: 4<br /> dhcp4: false<br /> dhcp6: false<br />
but i don't have available bare metal server to test

Note : don't you have to enable "net.ipv4.ip_forward=1" & "net.ipv6.conf.all.forwarding=1" ?

Cordialement, Janus57


br0:
macaddress: mm:mm:mm:mm:mm:mm #same as eno3


This seems to work. When I did `netplan apply`, only ipv4 worked. But on reboot, both work out of the box. :)

As for "net.ipv4.ip_forward=1" & "net.ipv6.conf.all.forwarding=1", you might be right, I'll check that out tomorrow. That said, when testing earlier this week, I was able to import a VM, give it its own IPv4 and that worked. My current (old) server does have those parameters, so seems about right.

Thanks for your help, I think I now get it. Using DHCP on eno3 gave access to the IP matched to the authorized MAC, when restarting the network afterwards, the bridge worked because it was setup with eno3.

Cheers, I'm ready to call this a good day.

BTW, I am using libvirt. It's not all prepackaged, so, next step is installing all that (again, as testing earlier worked). Thanks again for your help. :slight_smile:

Hello,


BTW, I am using libvirt. It's not all prepackaged, so, next step is installing all that (again, as testing earlier worked). Thanks again for your help. :slight_smile:

interesting, i prefer using a hypervisor like ProxMox which simplifies all this step (using a nice GUI or API) and migration from server to server are easier and more consistent from my standpoint

Cordialement, Janus57