LXC Project Part 1: Bridging the Connection

As I mentioned before, I’m looking at Linux Containers (LXC) to have a higher density virtualization. To get ready for that, I had to create a network bridge to allow the containers to be accessible on the network.

First I installed bridge-utils:

yum install bridge-utils -y

After that, I had to create the network script:

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

In there I placed:

DEVICE="virbr0"
BOOTPROTO="static"
IPADDR="192.168.1.35" #IP address of the VM
NETMASK="255.255.255.0"
GATEWAY="192.168.1.1" 
DNS1="192.168.1.7"
ONBOOT="yes"
TYPE="Bridge"

Then, since my ethernet on this machine is eth0

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

and added

BRIDGE="virbr0"

and after a

 

systemctl restart network

it was supposedly working. I was able to ping www.google.com. We’ll see what happens when I start installing LXC Containers.

Author: Eric Mesa

To find out a little more about me, see About Me