First Step: Setting up Network Bridge After Installation
CyberPanel Virtual Machine Manager installer ask 4 important question before it starts installation:
- IP Address.
- Interface Name.
So what happens in the background? Normally Centos store network files in
/etc/sysconfig/network-scripts/ If your interface name is eth0 (as provided in installation process) then your network file will look like
/etc/sysconfig/network-scripts/ifcfg-eth0, this file will contain your server network configurations. However this does not work in virtualized environment. We need to create a bridge so that virtual machines can have public connectivity. Let see how this interface file looks like before CyberPanel does anything
BOOTPROTO=static DEFROUTE=yes DEVICE=eth0 GATEWAY=192.168.1.1 HWADDR=32:99:c3:5f:5b:3f IPADDR=192.168.1.2 NETMASK=255.255.255.255 ONBOOT=yes TYPE=Ethernet USERCTL=no
This is how your network file will look like, there can be slight differences on various platforms but more or less they look same.
We will now discuss how the files will look like after CyberPanel set up the bridge, please note that various providers have their own way of setting up network. Some providers use bonding, while others have custom configurations such as OVH. For starter we will see basic configs on a normal network set up.
Network files after CyberPanel set up Bridge
DEVICE=<Interface Name> TYPE=Ethernet BOOTPROTO=none ONBOOT=yes NM_CONTROLLED=no BRIDGE=virbr0
DEVICE="virbr0" BOOTPROTO="static" IPADDR="<IP Address>" NETMASK="<Netmask>" GATEWAY="<Gateway>" DNS1=184.108.40.206 ONBOOT="yes" TYPE="Bridge" NM_CONTROLLED="no"
These are only two files that CyberPanel will set up or modify, in a normal environment this will work and after CyberPanel installation you just need to run
systemctl restart network for your bridge to get up. CyberPanel does not restart network during installation because if network goes down you will loose connectivity to your server, these files are configured and you can restart the network later or configure the files according to your platform.
What if Network Bonding is used?
Some providers use Network Bonding to give you a better network experience. Before running installation you need to know what is the name of active bond which you can use in your bridge and pass on to the installation script as a Interface Name. Run
ip a command to see the name of active bond, normally it is bond0. Before installation you don’t need to do anything, just pass this bond name to installation script when you are asked about Interface Name. So once the installation is completed, you need to create an extra file : /etc/modprobe.conf
Paste following in the file:
alias bond0 bonding options bond0 miimon=100 mode=1 max_bonds=2
And restart the network, if everything is fine your bridge will start working. If it does not work, you can ask your provider on specific instructions to create bridge on top of bonded network. You can also search online about how to set up network bridge on top of network bond to get insight into this topic.
Network Setup on OVH Servers
OVH have given their own specific instruction on how to set up Network Bridge on their servers, you can read it here. However in our tests, the default configuration of CyberPanel worked with OVH, and only the network restart bring the bridge up, but if it fails for you, read OVH guide to configure network bridge on your server. Make sure to always name your bridge virbr0, which is what CyberPanel expects it to be.
However with OVH we need to assign virtual mac to IP Addresses, we will discuss this in our next document.
Your next step is to create IP Pool, so that you can start creating virtual machines.