Bridged networking allows your VMs to receive an IP address from the DHCP server on your network instead of its internal one, which will allow you to communicate with your VMs from any other machine on your network.
Step 1 : To set up bridged networking, we’ll need to create a new interface on our server. Open up the /etc/netplan/01-network-manager-all.yaml file in your text editor with sudo.
cd /etc/netplan/ # make backup sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.orig sudo nano 01-network-manager-all.yam
Step 2 : Make sure you make a backup of the original Netplan configuration file, and then replace its contents with the following. Be sure to replace enp0s3 (the interface name) with your actual wired interface name if it’s different.
network: version: 2 renderer: networkd ethernets: enp1s0: dhcp4: false dhcp6: false bridges: br0: interfaces: [enp1s0] addresses: [192.168.1.16/24] gateway4: 192.168.1.1 nameservers: addresses: [188.8.131.52,184.108.40.206] parameters: stp: false forward-delay: 0 dhcp4: no dhcp6: no
Step 3 : After you make the change, you can apply the new settings immediately
sudo netplan apply
Configuring a virtual machine to use network bridge
If you have a virtual machine you’ve already created that you’d like to switch to utilize your bridged networking, you can use the following steps to convert it:
Step 1 : First, open virt-manager and double-click on your virtual machine. A new window with a graphical console of your VM will open.
Step 2 : The second button along the top will open the Virtual Hardware Details tab, which will allow you to configure many different settings for the VM, such as the CPU count, RAM amount, boot device order, and more.
Step 3 : Among the options on the left-hand side of the screen, there will be one that reads NIC and shows part of the virtual machine’s network card’s MAC address. If you click on this, you can configure the virtual machine to use your new bridge.
Step 4 : Under the Network source drop-down menu, select the option Specify shared device name. This will allow you to type an interface name in the Bridge name text box; Make sure that the Device model is set to virtio.
Step 5 : Finally, click on Apply. You may have to restart the virtual machine for the changes to take affect: