Hello,
I'm running a Windows Web Server in KVM and I'm trying to create a network bridge so I can make the virtual machine available to external machines. By default, KVM creates its own bridge, 192.168.122.1. This device acts as a virtual router for the virtual machines and will grant them IP addresses in this range. However, I want my machine to lease external addresses.
This is the guide I'm following: http://www.dedoimedo.com/computers/kvm-bridged.html
That's about all you need to do.
ifconfig eth0 0.0.0.0
ifconfig eth1 0.0.0.0
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
dhclient br0
Basically it's almost working except for this issue:
The moment I do brctl addif br0 eth0
my host loses internet connection and only the VM gets internet.
It becomes visible and everything, but I need both the host and the VM to have internet connection.
If I type brctl delif br0 eth0
, then only the host has internet connection and the VM doesn't.
What am I doing wrong?
Thanks.
Try adding something like this to your /etc/network/interfaces file:
auto br0
iface br0 inet manual
bridge_ports eth0
bridge_stp off
bridge_fd 0.0
You'll either need to restart the system or just restart the networking service, then you should be able to see the bridge in KVM, so set it as the interface for your VM and your VM should be on the same network as the host machine.
I am using Fedora 25, I don't have an /etc/network/interfaces
However keep in mind that I have enabled the bridge for KVM and KVM does use it.
As I said when I run brctl addif br0 eth0
, KVM becomes visible to all machines in the network and its internal IP shows in the router settings - 192.168.1.4, however when that happens, my host loses internet connection and only KVM has internet connection.
Screenshot: KVM Bridge
Instead of using 'shared device' in KVM set it to 'bridge br0' (if it's there) and see if that helps
Lol, when I was doing this:
ifconfig eth0 0.0.0.0
ifconfig eth1 0.0.0.0
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
dhclient br0
... I forgot to ifconfig vibr0 down
and then brctl delif vibr0 vnet0
and then brctl addif br0 vnet0
eth1 is a placeholder for vnet0 in this case. Now it seems to work.
@Dexter_Kane
KVM doesn't seem to show br0 unless you add it to the network configuration file. Since this is just for temporary testing purposes brctl will do fine. Thank you for your help.
1 Like