We're running a CentOS 7 server, with KVM installed on top of it, and the host has 2 Ethernet interfaces attached to it (em1 and em2).
A new windows 7 VM was just created, and we wanted that specific machine to be connected to the office network (192.168.2.X), so we went with the bridge solution by creating a 'br0' interface, and bridging it with the physical interface 'em2'.
So even when assigning a static IP to the guest W7 VM through 'br0', it's not taking that particular IP, but a whole other one, plus from the guest side we were able to see other machines/devices on the same subnet, but it doesn't work the other way (physical machines can't ping VM), using the specified IP of 'br0' or the other IP.
so we are we missing ?
So here is a copy of the configuration files:
ifconfig em2
em2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 54:9f:35:02:b2:5a txqueuelen 1000 (Ethernet)
RX packets 4296203 bytes 5223242102 (4.8 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 655608 bytes 711971529 (678.9 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 17
ifconfig br0
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.34 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::569f:35ff:fe02:b25a prefixlen 64 scopeid 0x20<link>
ether 54:9f:35:02:b2:5a txqueuelen 0 (Ethernet)
RX packets 562034 bytes 36288591 (34.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 307114 bytes 1132593995 (1.0 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
/etc/sysconfig/network-scripts/ifcfg-em2
DEVICE=em2
NAME=em2
TYPE=Ethernet
HWADDR=54:9F:35:02:B2:5A
BOOTPROTO=none
ONBOOT=yes
BRIDGE=br0
/etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
NAME=br0
TYPE=Bridge
IPADDR=192.168.2.34
PREFIX=24
BOOTPROTO=none
ONBOOT=yes
DELAY=0
/etc/sysconfig/network
NETWORKING=yes
GATEWAY=192.168.2.1
ipconfig (guest machine)
IPv4 Address: 192.168.2.159
subnet mask: 255.255.255.0
Default Gateway: 192.168.2.1
brctl show br0
bridge name bridge id STP enabled interfaces
br0 8000.549f3502b25a no em2
vnet0
Best Answer
You don't seem to have an ipv4 address on
br0
. That will prevent your CentOS host from talking to the VM guest.I accept that your
ifcfg-br0
is set up for it, but it hasn't taken, and in any case I can see odd things in it (BOOTPROTO=none
?). Tryifdown br0; ifup br0
and see if that helps.If not, just enforce the address on the interface with
ifconfig br0 192.168.2.34 netmask 255.255.255.0 up
and see if that fixes things from a network standpoint, then we can discuss how to fix the config files.Do not set an ip address on
em2
. It would also be useful if you edited into your question the output ofbrctl show br0
.Edit: OK, good, we've got your ipv4 working, now we just need to fix your config files. Try this in
ifcfg-br0
:Then bounce the interface with
ifdown br0; ifup br0
, and if that works, try a reboot.