KVM Bridge Network Interface Setup
I am running a RHEL 7.4 Server that hosts a number of RHEL servers on KVM. I wanted these virtual machines to be on the same network as all my other devices in the home, so setting up a KVM bridge network interface on my hyper-visor host was needed. I already had KVM installed and the virtual machines running, so I just needed to make some adjustment to the network interfaces.
Network setup
From the command line, change directory to
cd /etc/sysconfig/network-scripts.
You will want to edit the configuration file of your current interface.
Mine is ifcfg-enp2s0f0, so issue the command
vim ifcfg-enp2s0f0
then delete the unneeded lines leaving only what is in the after section.
Before
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=none IPADDR=192.168.1.40 PREFIX=32 GATEWAY=192.168.1.1 DNS1=192.168.1.40 DOMAIN=den.therootuser.com DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=enp2s0f0 UUID=08e74e93-ea1e-4f2e-bde9-d263109a9bc1 ONBOOT=yes DEVICE=enp2s0f0
After
TYPE=Ethernet BOOTPROTO=none DEFROUTE=yes NAME=enp2s0f0 ONBOOT=yes DEVICE=enp2s0f0 BRIDGE=virbr0
We then need to create the configuration file for our virbr0 interface.
vim ifcfg-virbr0
TYPE="Bridge" BOOTPROTO="none" DEFROUTE="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_FAILURE_FATAL="no" NAME="virbr0" DEVICE="virbr0" ONBOOT="yes" IPADDR="192.168.1.40" PREFIX="24" GATEWAY="192.168.1.1" DNS1="192.168.1.40" DOMAIN="den.therootuser.com" IPV6_PEERDNS="yes" IPV6_PEERROUTES="yes" IPV6_PRIVACY="no" DELAY=0
Adjusting the VM side
After this is done, we can do some cleanup on the KVM side of things. Run the command virt-manager, then from the menu choose, EDIT / CONNECTION DETAILS. You will then go to virtual networks, and delete the default network. You can verify your virtual bridge is in place under Network Interfaces.
If you have already built VMs as I have, you’ll need to change the network device on the VM. Change the Network source to be Bridge virbr0: Host device enp2s0f0.
This should get you up and running. You can then either have your RHEL servers obtain IPs via DHCP from your main network, or set them up with static IPs. My two VM’s were setup statically and given the IPs of 192.168.1.41, and 192.168.1.42. I then added this information into the DNS server on the main RHEL IDM server.
If you run into any problems or have any questions, feel free to reach out and I’ll do what I can to help out.
Cheers,
Ivan Windon
1 Response
[…] you got yourself a spiffy new team. Bridges are fairly similar and just as easy via nmcli. However, where it because a little more tricky is […]