TECHIES WORLD

For Techs.... Techniques.... Technologies....

Linux

How to configure bridge network Centos7

This article explains the detailed steps for configuring network bridge in Centos7 server.

Step1: Login to the server

Step2: CentOS 7 comes with bridging module loaded on system boot by default. We can check the same by below command.

#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, run the following command and load it.

#modprobe --first-time bridge

Step3: Install the bridge-utils package

#yum install bridge-utils -y

Step4: Create the bridge configuration file.

#vi /etc/sysconfig/network-scripts/ifcfg-virbr0

Step5: Update the following line to this new file.

DEVICE="virbr0"
BOOTPROTO="static"
IPADDR="ipaddress"
NETMASK="netmask"
GATEWAY="gateway"
DNS1="resolver"
ONBOOT="yes"
TYPE="Bridge"
NM_CONTROLLED="no"

Here we need to replace,

ipaddress - server ipaddress
netmask - netmask id
gateway - gateway address
resolver - nameserver ipadress

Step6: Open the existing network adaptor configuration file.

#vi /etc/sysconfig/network-scripts/ifcfg-eth0

Step7: Modify it as like below.

DEVICE=eth0
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
BRIDGE=virbr0

Step8: Restart the network

#systemctl restart network

That's all…

Leave a Reply