17.10 netplan config with bridge
Solution 1
your configuration could look like this:
network:
version: 2
renderer: networkd
ethernets:
enp10s0:
dhcp4: false
bridges:
br0:
interfaces: [enp10s0]
dhcp4: true
parameters:
stp: false
forward-delay: 0
Solution 2
Here's my config that's very similar to above. This worked for me with 18.04 LTS:
network:
version: 2
ethernets:
enp5s0f0:
dhcp4: true
enp5s0f1:
dhcp4: true
bridges:
br0:
interfaces: [enp5s0f0]
dhcp4: true
optional: true
Solution 3
Here is a yaml that I just completed on mine to get bridge working. This was a headache to do for me, because I am terrible with Linux. This is on Ubuntu Server 18.04 LTS, but I am a bit confused, because the .yaml is "50-cloud-init.yaml", but I didn't do the cloud install, just the normal server. Maybe that is normal, but it didn't seem to match up with the naming convention I was finding in tutorials. Side note, while this DOES work on my server, I am having a HELL of a time with KVM. The machine SHOWS running in virsh, but it sits there with the CPU pegged, isn't pingable, but doesn't give errors. In 14.04, it JUST WORKED. I am tempted to downgrade.
After you completed the .yaml changes, you can verify them, then apply them with the following commands:
sudo netplan --debug generate
sudo netplan apply
Note any errors you get start from the top left corner, including commented out lines. starting with Line 0, and column 0.
network:
version: 2
renderer: networkd
ethernets:
switchports:
# all cards on second PCI bus;
# unconfigured by themselves, will be added to br0 below
match:
name: enp1*
mtu: 4400
bridges:
# the key name is the name for virtual (created) interfaces;
# no match: and set-name: allowed
br0:
# IDs of the components; switchports expands into multiple interfaces
interfaces: [switchports]
addresses: [172.16.5.20/24]
gateway4: 172.16.5.1
nameservers:
addresses: [172.16.5.2]
parameters:
forward-delay: 0
stp: false
Related videos on Youtube
Bryan Brown
Updated on September 18, 2022Comments
-
Bryan Brown over 1 year
Ok I just did a new install with 17.10 and trying to get my KVM up and running and can't figure out how to config the network. Here's what my old interfaces file looked like
auto lo iface lo inet loopback auto enp10s0 iface enp10s0 inet manual auto br0 iface br0 inet dhcp bridge_ports enp10s0 bridge_stp off bridge_fd 0 bridge_maxwait 0
This has worked for years, but not I can't get my KVM instance to start because it's telling me br0 doesn't exist. I've tried a few things I've found with netplan, but nothing has made a difference.
-
Bryan Brown over 6 yearsPerfect! Thanks. One more question. What is now the correct way to restart the network? /etc/init.d/networking is no longer available.
-
user754230 over 6 yearsto apply changes you made in /etc/netplan/*.yaml, you can run
netplan apply
- more inf o at wiki.ubuntu.com/Netplan -
rajat banerjee almost 6 yearsI'm using 18.04 LTS, and the above YAML yields: $ netplan apply Error in network definition //etc/netplan/50-cloud-init.yaml line 0 column 8: expected mapping
-
user38537 almost 6 yearsIs your KVM host machine on enp5s0f1? I added your "bridges" stanza verbatim (but changed to eno1 for my server) to my netplan config, rebooted, and the host machine had no connectivity.
-
AlanObject over 5 yearsI see a problem here. You have DHCP configured port enp5s0f0 and also made it a member of your bridge. The bridge should get the DHCP session because it's port br0 is the one that gets the IP address.
-
cqcallaw almost 5 yearsI think the indentation for this code block is fouled up; it looks like everything after the first line should be indented. Can someone with more familiarity with netplan + YAML confirm?