3

I'm preparing for RHCE using the official redhat course-ware. The chapter that introduces the concept of bridging only tells you the commands used to configure a software bridge. The practical implementation is not explained at all.

I know that software bridges are primarily used for connecting virtual machines to the network. But the commands given in the book do not describe how any virtual machines are being connected.

The following steps are mentioned to create a software bridge:

  1. Create a bridge using nmcli and assign it an IP address.

    nmcli con add type bridge con-name br0 ifname br0
    nmcli con mod br0 ipv4.addresses 192.168.0.100/24
    
  2. Attach physical interrfaces to this bridge.

    nmcli con add type bridge-slave con-name br0-port1 ifname eth1 master br0
    nmcli con add type bridge-slave con-name br0-port2 ifname eth2 master br0
    

Here eth1 and eth2 are both actual NICs. How will this be used for virtual machines? The main purpose of software bridges is enable networking in a virtualized environment.

But how do we configure this? How do we attach the virtual NICs of the guest OS to the bridge of host OS?

4

When you create a virtual machine and provision virtual network interfaces inside it, each virtual network interface gets a corresponding network interface in the host. For example, with Xen, you'd end up with eth0 inside a virtual machine corresponding to vif0.0 (or something like that) in the host, etc. As you bring up virtual machines, you can see interfaces added in your host.

You can then hook up these host network interfaces in various ways depending on your requirements: to a br0-style software bridge, to an Open vSwitch, to a physical interface... Hypervisors can take care of this themselves, depending on their configuration; for example, Xen systems' default setup connects their vif interfaces to virbr0 (at least, it used to!). But you can disable this if you wish, and use the same commands as you've used for your physical interfaces:

nmcli con add type bridge-slave con-name br0-port3 ifname vif0.0 master br0
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.