0

I'm a bit confused on how to setup a bridge for KVM on my Debian box that has three NICs in it. I've attached my current /etc/network/interface below. My goal here is to have a video surveillance server VM on the CAM LAN interface so I need just that interface bridged. I don't need the other two interfaces bridged.

Everything I'm seeing online deals with setting up a bridge using just one NIC. I can't seem to find anything that deals with multiple NICs on the same machine each having a different subnet. How would I go about bridging just the CAM LAN NIC and not breaking the networking already in place?

# The loopback network interface
auto lo
iface lo inet loopback

# Computer LAN
allow-hotplug enp3s0
iface enp3s0 inet static
    address 192.168.22.149
    netmask 255.255.255.0
    network 192.168.22.0
    broadcast 192.168.22.255
    gateway 192.168.22.1
    dns-nameservers 192.168.22.1 8.8.8.8

 # Cam LAN
 allow-hotplug enp1s0f1
 iface enp1s0f1 inet static
    address 192.168.2.50
    netmask 255.255.255.0
    post-up ip route add 192.168.2.0/24 dev enp1s0f1 src 192.168.2.50 table rt2
    post-up ip route add default via 192.168.2.1 dev enp1s0f1 table rt2
    post-up ip rule add from 192.168.2.50/32 table rt2
    post-up ip rule add to 192.168.2.50/32 table rt2

 # DMZ LAN
 allow-hotplug enp1s0f0
 iface enp1s0f0 inet static
    address 10.0.1.2
    netmask 255.255.255.0
    post-up ip route add 10.0.1.0/24 dev enp1s0f0 src 10.0.1.2 table rt3
    post-up ip route add default via 10.0.1.1 dev enp1s0f0 table rt3
    post-up ip rule add from 10.0.1.2/32 table rt3
    post-up ip rule add to 10.0.1.2/32 table rt3

Edit - So I have figured out how to manually add a bridge on the CLI. Its as follows:

# brctl addbr br0 # brctl addif br0 enp1s0f1 # ifconfig br0 up # dhclient br0

This successfully grabs an IP address on the CAM LAN interface from the upstream router which is correct. I can so assign a static (which is the ultimate end goal) with ifconfig br0 192.168.2.x netmask 255.255.255.0 up.

However, I can't figure out how to input this information into the /etc/network/interface file. I need the br0 bridge assigned to enp1s0f1 and I need them both to have static IPs.

1 Answer 1

0

Add a dummy interface. The reason is you want an interface with a fixed MAC address. The first interface that joins your bridge, gives the bridge it's MAC address (or the bridge adopts this MAC, however you want to read it).

auto virbr10-dummy
iface virbr10-dummy inet manual
pre-up /sbin/ip link add virbr10-dummy type dummy
up /sbin/ip link set virbr10-dummy address 52:54:00:f9:78:15

For KVM MAC addresses that don't clash, start them with 52:54:00

You then want to define your bridge

#Bridge definitions

auto virbr10 iface virbr10 inet static

bridge_ports virbr10-dummy

bridge_stp off

bridge_fd 0
address 192.168.2.50 netmask 255.255.255.0

gateway 192.168.2.1

post-up ip route add 192.168.2.x/32 via 192.168.2.1 #dev virbr10

Further info on jamielinux website but I have only just ported my configs from ubuntu18.04 to debian 10, so having trouble with the post-up routing part, and have temporarily put in a /etc/rc.local command until i work it out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.