Tuesday, May 7, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 725  / 3 Years ago, sun, august 8, 2021, 1:07:23

I have two network cards on my computer. I want to create two net bridges with netplan to add this bridged networks to kernel based virtual machines (KVM). Both network cards are connected to the same router which has access to Internet.


I have the following network configuration using netplan:


network:
version: 2
renderer: networkd
ethernets:
eth-host0:
match:
macaddress: xxx:97:02
dhcp4: false
dhcp6: false
eth-host1:
match:
macaddress: xxx:08:61
dhcp4: false
dhcp6: false
bridges:
br0:
interfaces: [eth-host0]
addresses: [192.168.0.9/24]
gateway4: 192.168.0.1
mtu: 1500
nameservers:
addresses: [8.8.8.8]
parameters:
stp: true
forward-delay: 4
dhcp4: true
dhcp6: false
br1:
interfaces: [eth-host1]
addresses: [192.168.1.9/24]
gateway4: 192.168.0.1
mtu: 1500
nameservers:
addresses: [8.8.8.8]
parameters:
stp: true
forward-delay: 4
dhcp4: true
dhcp6: false

when I issue command


sudo netplan apply

I got the following error "Problem encountered while validating default route consistency.Please set up multiple routing tables and use routing-policy instead.
Error: Conflicting default route declarations for IPv4 (table: main, metric: default), first declared in br0 but also in br1"


If I delete default gateway, than apply passes but I do not have any networks on my virtual machine.


How do I properly configure two bridges on the same computer?


More From » networking

 Answers
5

I'm not a Netplan expert but you could try to remove the gateway4: 192.168.0.1 from br1 (but leave it on br0).


If that doesn't work, try to add this to br1:


routes:
- to: 0.0.0.0/0
via: 192.168.0.1
table: 101
routing-policy:
- from: 192.168.1.9/24
table: 101

BTW before running netplan apply run netplan generate. Then you will se the errors before applying. I have lost connections to the server a couple of times because of simple mistakes :-)


Often I also have to reboot for the changes to fully apply.


[#968] Monday, August 9, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
raldership

Total Points: 222
Total Questions: 115
Total Answers: 124

Location: North Korea
Member since Fri, Nov 4, 2022
2 Years ago
raldership questions
Sat, Nov 12, 22, 12:31, 2 Years ago
Wed, Sep 8, 21, 08:24, 3 Years ago
;