Hello, and welcome to today's video presentation on how to create a network bridge for KVM
on Oracle Linux 8.
This video highlights two of the ways to create a network bridge on Oracle Linux 8, which
KVM can use.
So let us get started.
Before creating the Network Bridge, it is essential to understand what a network bridge
does.
Working in the data-link layer (layer 2) of the Open Systems Interconnection (OSI) model,
a network bridge connects two separate networks and represents them as a single network.
The term bridging is the name given to the communication between these two networks.
A bridge, therefore, forwards the traffic or packets based on the attached hosts' MAC
address and implements packet forwarding in software.
Oracle Linux 8 supports implementing the software-based bridge feature and is capable of acting as
a virtual switch.
While there are several use cases for network bridging, this video will focus on using a
network bridge to connect KVM virtual machines to the same network as the host.
Now that we know a little bit about network bridges let us create a few.
For this demo, we will use a physical Oracle Linux 8 system pre-configured with the KVM
virtualization packages.
The installed and running libvirtd daemon creates a NAT network called default, which
is configured out of the box and associated with the virbr0 virtual bridge.
Additional details on configuring those items are available in our other Linux and KVM videos
linked in the description and at the end of this video.
The steps in this video apply to physical, and on-premise systems and not intended for
Oracle Cloud Infrastructure.
First, open a terminal on the KVM host.
Identify the available network interfaces on the KVM host by typing sudo ip addr.
If sudo prompts for a password, enter it.
The output shows the ethernet interface called ens5, as well as several other interfaces.
ens5 is the primary network interface (NIC) used in this host and the NIC to add to the
bridge.
With this information, we are ready to create a network bridge.
Using nmcli, a command-line tool for controlling NetworkManager and reporting network status,
get a list of the system's active network connections.
Type sudo nmcli conn show --active.
Next, create a network bridge by typing sudo nmcli conn add type bridge con-name br0 ifname
br0.
The nmcli command allows for the use of abbreviations for the options passed, provided they are
a unique prefix in the list or sequence of options used.
Next, set a static IPv4 address for the bridge network by typing the following series of
commands.
This step is optional and based on the configuration used by the system's primary network interface.
Further, the values passed will also vary according to the network environment.
As this demo environment leverages DHCP for the primary NIC, these commands do not apply.
Now, add the ethernet interface (ens5) to the bridge (br0) connection.
Type sudo nmcli conn add type ethernet slave-type bridge con-name bridge-br0 ifname ens5 master
br0.
Next, activate the bridge connection by typing sudo nmcli conn up br0.
Then deactivate the ethernet interface (ens5) by typing sudo nmcli conn down ens5.
Now get a list of the active network connections by typing sudo nmcli conn show --active.
The bridge connection should display in the list of active connections, and the ens5 device
should be gone.
Next, display the current bridge port configuration and flags by typing sudo bridge link show.
From the output, notice the ens5 interface, and the associated br0 setting is linked.
Display the new network bridge interface by typing ip add.
This command shows the DHCP network address assigned has transitioned from the primary
NIC (ens5) to the bridge (br0).
That completes the setup and configuration of a network bridge using nmcli.
In preparation to demo the next method, undo these steps and deactivate the bridge connection
just created and delete it.
Before deleting the bridge, first, activate the ethernet connection by typing sudo nmcli
conn up ens5.
Next, delete the bridge by typing sudo nmcli conn down br0.
Then type sudo nmcli conn del br0 and sudo nmcli conn del bridge-br0.
Verify the steps worked and get an updated list of the active network connections by
typing sudo nmcli conn show --active.
The output shows the network is back to the initial state when the demo initially started.
To learn more about nmcli, check out the manual page by typing man nmcli in the terminal.
The second method used to create a network bridge will be the Cockpit web console.
Navigate to the Cockpit web console for your host using a browser.
If connecting from the same host that runs Cockpit, enter the address localhost:9090
into the browser.
Otherwise, use the hostname or ip_address of the server.
Log in with the system credentials.
Ensure to check the box "Reuse my password for privileged task" as these steps require
elevated or sudo access.
From the navigation panel on the left, select Networking
The page will display a listing of the current system Interfaces.
Click the Add Bridge button on the right side of the Interfaces section.
A Bridge Settings panel will appear.
Set the Name field to br0 and check the box next to ens5 in the Ports list.
Optionally check the Spanning Tree Protocol (STP) box to turn on that feature.
Click the Apply button.
The new bridge now appears in the Interfaces list and was automatically activated.
To see details about the bridge, double-click the item.
The details page shows options to turn the bridge on and off, delete the bridge, add
and remove ports, as well as configure IPv4 and IPv6 static ip_addresses.
To return to the Interfaces list, click Networking in the navigation panel on the left.
With the bridge successfully created and activated, that completes this demo.
Thank you for watching this video and enjoy using KVM on Oracle Linux 8.
Please check our additional information on Oracle Linux 8 in the Oracle Linux 8 Documentation
or Oracle Linux Learning Library.