How to create a Bridge for virtualizor

Bridge configuration for virtualizor on CentOS 7/RHEL 7

By default CentOS 7 comes with a bridge or (Bridge) module loaded at system startup. We can use the following command to verify if the module is loaded or not.

# modinfo bridge
filename:       /lib/modules/3.10.0-327.el7.x86_64/kernel/net/bridge/bridge.ko
alias:          rtnl-link-bridge
version:        2.3
license:        GPL
rhelversion:    7.2
srcversion:     905847C53FF43DEFAA0EB3C
depends:        stp,llc
intree:         Y
vermagic:       3.10.0-327.el7.x86_64 SMP mod_unload modversions
signer:         CentOS Linux kernel signing key
sig_key:        79:AD:88:6A:11:3C:A0:22:35:26:33:6C:0F:82:5B:8A:94:29:6A:B3
sig_hashalgo:   sha256

If the module is not loaded, we can use the following command to load it.

# modprobe --first-time bridge

In the next step we are going to install bridge-utils to control the network adapters with the following command.

# yum install bridge-utils -y

In the following steps we will create a backup copy of the configuration of our network,

We position ourselves in the configuration directory of our network and with the command (ls -la) we display the contents of the directory.

[root@rd ~]# cd /etc/sysconfig/network-scripts
[root@rd network-scripts]# ls -la
total 240
drwxr-xr-x. 2 root root  4096 Sep 27  2019 .
drwxr-xr-x. 6 root root  4096 Sep 27  2019 ..
-rw-r--r--  1 root root     0 Jul 13  2018 .bash_history
-rw-r--r--  1 root root   105 Apr 16 12:43 ifcfg-eth0
-rw-r--r--  1 root root   254 Mar 29  2019 ifcfg-lo
lrwxrwxrwx  1 root root    24 Sep 27  2019 ifdown -> ../../../usr/sbin/ifdown
-rwxr-xr-x  1 root root   654 Mar 29  2019 ifdown-bnep
-rwxr-xr-x  1 root root  6532 Mar 29  2019 ifdown-eth
-rwxr-xr-x  1 root root   781 Mar 29  2019 ifdown-ippp
-rwxr-xr-x  1 root root  4540 Mar 29  2019 ifdown-ipv6

We create a copy of the configuration file of our network with the command (cp) in my case the configuration file is: ifcfg-eth0

# cp ifcfg-eth0 ifcfg-eth0.backup

We create another copy with which we are going to configure our network bridge or (Bridge), we can create it with the name of our preference in my case (viifbr0).

# cp ifcfg-eth0 ifcfg-viifbr0

We edit the configuration file of our network to check or add the following lines in green.

# nano ifcfg-eth0
TYPE=Ethernet
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.25
NETMASK=255.255.255.0
GATEWAY=192.168.1.250
DNS1=8.8.8.8
NM_CONTROLLED=no
BRIDGE=viifbr0

Now we edit the configuration file of our network bridge or (Bridge).

# nano ifcfg-viifbr0
DEVICE="viifbr0"
BOOTPROTO="static"
IPADDR=192.168.1.25
NETMASK=255.255.255.0
GATEWAY=192.168.1.250
DNS1=8.8.8.8
ONBOOT="yes"
TYPE="Bridge"
NM_CONTROLLED="no"

Finally we restart our network for the changes to take effect.

# systemctl restart network

We check the network settings on our system with the following command.

[root@rd]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
inet6 fe80::56a0:50ff:fe87:d67b  prefixlen 64  scopeid 0x20<link>
ether 54:a0:50:87:d6:7b  txqueuelen 1000  (Ethernet)
RX packets 2242429  bytes 169737536 (161.8 MiB)
RX errors 0  dropped 0  overruns 0  frame 0
TX packets 4936688  bytes 7150969708 (6.6 GiB)
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
device memory 0xcfa00000-cfa1ffff

viifbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
inet 192.168.1.25  netmask 255.255.255.0  broadcast 192.168.1.255
inet6 fe80::56a0:50ff:fe87:d67b  prefixlen 64  scopeid 0x20<link>
ether 54:a0:50:87:d6:7b  txqueuelen 1000  (Ethernet)
RX packets 851891  bytes 44865433 (42.7 MiB)
RX errors 0  dropped 0  overruns 0  frame 0
TX packets 805711  bytes 2185612862 (2.0 GiB)
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

If you have any questions, please feel free to contact Picaraza Domains Ltd support team 24/7/365.
Was this answer helpful?

Related Articles

What is Virtualizor?

Virtualizor panel It is a management system for VPS or virtual systems with a set of tools with...

Features of the Virtualizor VPS manager

The main features of the Virtualizor VPS manager Powerful control panel Virtualizor is a...