Create a bridge on CentOS 7.4 for KVM Virtualization on OVH/SoYouStart servers

in #virtualization7 years ago (edited)

This tutorial is designed for absolute beginners.

Setting up a bridge for network virtualization on OVH and SoYoustart servers has always caused problems for many. They both have specific but slightly different networking standards. Here i will explain how to build the bridge to allow multiple IP's to be used when creating virtual machines.

This guide is meant for CentOS 7.4 and applies to Virtualization environments like SolusVM, Virtualizor and Proxmox.

To start, i wanted to post this because nearly all the information i found online just simply didn't work and i was constantly losing network connection to my servers and having to change the ifcfg-eth0 file back to normal using rescue mode or completely reinstalling my server. With the help of both guides from SolusVM and Virtualizor i found out how to get my virtual network going perfectly every time.

Firstly we will be backing up our original ifcfg-eth0 file. Do this by using the following command in the server terminal.

root# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.bak


Now create the bridge file. In CentOS 7 it could be anything but must include ifcfg-viifbr0 - the last 6 here we are using viifbr0 but you could use whatever suits your network.

root# nano /etc/sysconfig/network-scripts/ifcfg-viifbr0


You will have an empty file that needs some information from the original ifcfg-eth0 file. Below is what your viifbr0 file should look like.

DEVICE=viifbr0 
BOOTPROTO=static 
IPADDR=91.121.70.32 
NETMASK=255.255.255.0 
GATEWAY=91.121.70.254 
ONBOOT=yes


If you are using nano use ctrl+x to exit then Y to save changes and close the file.

This is all that is needed in your bridge file. Just copy and paste the relevant fields across from eth0.

Gateways on OVH/SoYouStart always end in .254

Almost every guide will tell you to use a subnet of 255.255.255.255. Do not do this, you can set the subnet for each IP in your control panel instead and you will lose connectivity with your server when you restart networking

The key point here is to use the subnet 255.255.255.0, just like it is in eth0 but when adding your IP pool to your virtualization software make sure to choose 255.255.255.255 subnet.

Now we have to edit our original ifcfg-eth0 file with a few parts to ensure our server points to the bridge and not eth0.

Take out everything apart from what is here, it is not needed and will cause problems.

DEVICE=eth0
HWADDR=E0:CB:4E:8C:A9:A7
ONBOOT=yes
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6ADDR=2001:41d0:0001:7916::/64
BRIDGE=viifbr0


The main part is the hardware address. You can find this by using the ifconfig command. You need to use the hardware address of your main connection eg, eth0.

If you are using Virtualizor and your virtual network is set up you will need to stop that before you reboot your network.

root# service virtnetwork stop


Now we can go ahead and restart the network, if your SSH terminal hangs, you have done it wrong and need to use the rescue mode which i will explain later.

To finish, your network needs to restart. You can do this by

root# service network restart


You should get a notification saying "OK" this means your network bridge should now be set up but to be sure you can check by doing

ifconfig


Follow for more tutorials as i work my way through learning linux.

Thank you for reading

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 58085.08
ETH 2337.41
USDT 1.00
SBD 2.37