Network Configuration

  1. Creation of Virtual bridge to access Virtual machines outside the Host machines
  2. Creation of Host only network.

1. Creating virbr20 on Host Machine

Add the following configuration to your Netplan YAML file located at /etc/netplan/configure-00.yaml:

bridges:
    virbr20:
      dhcp4: yes
      interfaces:
        - eno1
  • interfaces: eno1: Specifies that eno1 (replace with your actual physical interface name if different) is the physical interface providing internet access to the virtual bridge.

Applying the Configuration After saving your changes to /etc/netplan/configure-00.yaml, apply the configuration using the following command:

sudo netplan apply

Finally, verify that these two interfaces are created in the host machine.

Example output is

interfaces

2. Creating virbr20 Interface

Create the XML Configuration File (virbr20.xml):

Create a file named virbr20.xml with the following content:

<network>
  <name>virbr20</name>
  <uuid>00000000-0000-20E1-0000-0a01E1000002</uuid>
  <forward mode='bridge'/>
  <bridge name='virbr20'/>
</network>

Apply the Network Configuration:

Use the appropriate command to define and start the network using the XML file. you would use:

sudo virsh net-define virbr20.xml
sudo virsh net-autostart virbr20

Verify the Interface:
Check if virbr20 is created and active using the ip addr command or a tool specific to your virtualization setup:

virsh net-list --all

3. Creating virho10 Interface (Host-Only Network)

Create the XML Configuration File (virho10.xml):

Create a file named virho10.xml with the following content. Adjust IP addresses, DHCP settings, MAC addresses, DNS settings, and other parameters as necessary:

Create a file named ‘virho10.xml’

<network trustGuestRxFilters='no'>
  <name>virho10</name>
  <uuid>00000000-0000-0000-0000-0a02C1000001</uuid>
  <bridge name='virho10' stp='on' delay='0' macTableManager='libvirt'/>
  <mtu size='9000'/>
  <mac address='0a:01:b1:00:00:02'/>
  <domain name='srv001.panchayatseva.net' localOnly='yes'/>
  <dns enable='yes'>
    <forwarder addr='8.8.8.8'/>
    <txt name='srv001.panchayatseva.net' value='syhydsrv001'/>
  </dns>
  <ip address='10.20.0.0' netmask='255.255.248.0'>
    <dhcp>
      <range start='10.20.0.100' end='10.20.7.254'>
        <lease expiry='1' unit='hours'/>
      </range>
    </dhcp>
  </ip>
</network>

Apply the Network Configuration using the above mentioned process

Verify the Interface

ip addr show virho10

The example output is,

virho10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc noqueue state UP group default qlen 1000
    link/ether 0a:01:b1:00:00:02 brd ff:ff:ff:ff:ff:ff
    inet 10.20.0.0/21 brd 10.20.7.255 scope global virho10
       valid_lft forever preferred_lft forever