I am playing around with KVM and bridge network on a Debian 10 Host
Many tutorials tell to set the /etc/network/interfaces
to something like this:
# The primary network interface
auto eth0
iface eth0 inet manual # was dhcp with ip 192.168.188.30 before
# bridge interface for kvm
auto br1
iface br1 inet static
bridge_ports eth0
bridge_stp off
address 192.168.188.246
network 192.168.188.0
netmask 255.255.255.0
broadcast 192.168.188.255
gateway 192.168.188.1
dns-nameservers 8.8.8.8
Why iface eth0 inet manual
which makes the pc no longer available through 192.168.188.30
?
Gladly I can reach the pc over 192.168.188.246
now.
Even when I set eth0
back to iface eth0 inet dhcp
as long as the bridge network is defined I cannot reach the pc over 192.168.188.30
only 192.168.188.246
works.
What if I "apply" 192.168.188.246
to a KVM VM
. I assume I would lock my self out, since I have no way to reach the host pc - only the VM
(Did not test, scared, playing with remote sandbox)? If true, how can I be sure to always reach the host pc. Do I add another bridge br-host
with 192.168.188.xx
which will never be "applied" to a VM
?
Basically I don't get why the default eth0
needs to be shut off (manual).
Edit: just to make clear
works for 192.168.188.30
: dhcp
auto eth0
iface eth0 inet dhcp
# no bridge
works for 192.168.188.250
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.188.250
network 192.168.188.0
netmask 255.255.255.0
broadcast 192.168.188.255
gateway 192.168.188.1
dns-nameservers 8.8.8.8
# no bridge
does only work for 192.168.188.246
not 192.168.188.30
:
# The primary network interface
auto eth0
iface eth0 inet dhcp <----- still dhcp
# bridge interface for kvm
auto br1
iface br1 inet static
bridge_ports eth0
bridge_stp off
address 192.168.188.246
network 192.168.188.0
netmask 255.255.255.0
broadcast 192.168.188.255
gateway 192.168.188.1
dns-nameservers 8.8.8.8
does only work for 192.168.188.246
not 192.168.188.250
:
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.188.250
network 192.168.188.0
netmask 255.255.255.0
broadcast 192.168.188.255
gateway 192.168.188.1
dns-nameservers 8.8.8.8
# bridge interface for kvm
auto br1
iface br1 inet static
bridge_ports eth0
bridge_stp off
address 192.168.188.246
network 192.168.188.0
netmask 255.255.255.0
broadcast 192.168.188.255
gateway 192.168.188.1
dns-nameservers 8.8.8.8
EDIT 2
I had a missunderstanding. I thought the host is responsible for getting all the IP adresses which will then applied to the guests. I can just set the IP on the guest and it works. Now everything makes sense. Just had wrong assumption about bridge networks.