Configure bridge interfaces between two network
On this article we will discuss about bridged network interface. Why we need this kind of facilities or why we use it. First of all we need this facility for various reasons. Depends on what we will design as a service. Before launching a service we must need to know what we are developing and what will the network path for this. If we require a bridged interface we can do it with one or more interfaces.
Suppose we need to put an outer IP to an internal IP. It is hard to make it work by directly putting the IP in internal network. So we have to pass this IP through another interface which has access to the external network. Now we have to make the interface bridged which have access to the outer network.
The basic use of bridged interface is to provide access to another network where a desired network cannot reach.
Now what are the most common uses for this technology!
This technology mostly used in case of KVM or other virtualization platform. Also this is a common technology used on cloud platform.
Let me describe a little about the process before showing the procedure. For creating this network interface we need to decide a device name, the device type will be bridge; it will have a MAC address for the hardware.
Let’s start the detailed work from here. First, run the below command to create a device interface.
# vi /etc/sysconfig/network-scripts/ifcfg-br00
We will get a blank editor on our terminal. Here we have to write the blow lines.
DEVICE=br00
TYPE=Bridge
HWADDR=00:0C:29:58:2C:95
ONBOOT=yes
BOOTPROTO=none
NM_CONTROLLED=no
DELAY=0
IPADDR=192.168.1.7
NETMASK=255.255.255.0
Now save and exit this file. Once this file is created properly, run the below command.
# systemctl restart network
After this command we have to check the network interfaces. For that we have to run the below command.
#ip addr
Here we will find a new interface named br00.
After that we have to configure the interface through which our desired connection will be obtained to our internal network. For that we have to configure the physical device. So that we will open the Ethernet interface and add a line at the end of the lines.
# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
Now we will see the below content in that file.
HWADDR=00:0C:29:58:2C:95
TYPE=Ethernet
NAME=enp0s3
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
USERCTL=no
NM_CONTROLLED=yes
IPV4_FAILURE_FATAL=no
ONBOOT=no
IPADDR=192.168.1.64
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.1
DNS2=8.8.8.8
Now at the end of the file we have to add the below line.
BRIDGE=br00
Also if we don’t use the physical interface for other networking reasons then we can remove the ip address from the interface.
Now once again we have to restart the network service and check the IP addresses once again. For that we have to run the below commands.
#systemctl restart network
#ip addr
Once the whole process is done, we can configure our internal network interface to access outer network for the desired connection. We just have to configure that by putting into the bridge interface.