Skip to content

Instantly share code, notes, and snippets.

@IvanCl4udio
Last active October 2, 2023 14:28
Show Gist options
  • Save IvanCl4udio/26888cd5c93cd35425a84b4759f9ad37 to your computer and use it in GitHub Desktop.
Save IvanCl4udio/26888cd5c93cd35425a84b4759f9ad37 to your computer and use it in GitHub Desktop.
How configure Bridge for KVM

How configure Bridge for KVM

  1. Show the connections with nmcli
sudo nmcli connection show

NAME               UUID                                  TYPE      DEVICE   
Conexão cabeada 1  f54c4eaa-528e-334f-855f-bcfe2417409a  ethernet  enp3s0f1 
CLARO_5G6A694C     075be154-f86f-4c4d-9bb0-225e38021be3  wifi      wlp2s0   
virbr0             cb1bf60e-e48b-4e76-8be7-38f1a4fc1eea  bridge    virbr0  
  1. Remove cabled connection
sudo nmcli connection delete f54c4eaa-528e-334f-855f-bcfe2417409a
  1. Create the following environment variables accordingly with your infrastructure.
BR_NAME="br10"
BR_INT="enp3s0f1"
SUBNET_IP="192.168.0.129/24"
GW="192.168.0.1"
DNS1="8.8.8.8"
DNS2="8.8.4.4"

4 . Create a new bridge

sudo nmcli connection add type bridge autoconnect yes con-name ${BR_NAME} ifname ${BR_NAME}
  1. Configure ip, gateway and dns
sudo nmcli connection modify ${BR_NAME} ipv4.addresses ${SUBNET_IP} ipv4.method manual
sudo nmcli connection modify ${BR_NAME} ipv4.gateway ${GW}
sudo nmcli connection modify ${BR_NAME} ipv4.dns ${DNS1} +ipv4.dns ${DNS2}
  1. Remove the automatic bridge that was created
sudo nmcli connection delete ${BR_INT}
  1. Create a bridge type slave
sudo nmcli connection add type bridge-slave autoconnect yes con-name ${BR_INT} ifname ${BR_INT} master ${BR_NAME}
  1. Show information about created bridge
sudo nmcli connection show
  1. Start bridge connection
sudo nmcli connection up br10
  1. Show all information about this new bridge
sudo nmcli connection show br10

Source: https://computingforgeeks.com/how-to-create-and-configure-bridge-networking-for-kvm-in-linux/ Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment