Skip to content

Managing Network on KVM

Adding a Network Interface to an Existing Virtual Machine

You can add a network interface to an existing virtual machine via CLI, GUI, or by editing the XML configuration directly.

Run the following command, replacing vm-name with the name of your VM, interface-name with the name of the interface, and address with the MAC address of the interface you want to add:

sudo virsh attach-interface vm-name --model virtio \
--target macvTapDirect --type direct --source interface-name \
--config --live --managed --mac address

  1. Open Virtual Machine Manager either from the Application Launcher or by running the virt-manager command in your CLI. A new window will open.

  2. Select the VM that you want to edit and click the Open button. A new window will open.

  3. Click the light bulb icon (Show virtual hardware details). Then click the Add Hardware button in the bottom-left corner. A new window will open.

  4. Click Network in the menu on the left.

  5. In the Network source drop-down menu, select Macvtap device. The Device name field will appear.

  6. Type your host interface name into the Device name field.

  7. Type your host interface MAC address into the MAC address field.

  8. In the Device model drop-down menu, select virtio.

  9. Click Finish.

Click on the newly created device in the left menu of the Virtual Hardware Details window and make sure that the Link state field shows a selected checkbox next to "active".

Add the following lines to your XML configuration file:

<interface type="direct">
.
.
.
  <source dev="target-interface" mode="passthrough"/>
  <model type="virtio"/>
.
.
.
</interface>

Network Bridges

Network bridges allow multiple virtual machines to communicate using the same physical network card.

A virtual bridge configuration will be dependent on the environment that it needs to work in. VSI recommends following the steps described in the Configuring and managing networking guide by Red Hat Enterprise Linux on how to configure a network bridge on your Linux machine.

To use a network bridge interface when creating a VM, you can specify the following --network option on the virt-install command:

--network=bridge:bridge-name,mac=bridge-interface-mac,model='virtio-net'

To add a network bridge to an existing virtual machine, perform the steps listed in Adding a Bridge Interface to an Existing KVM Virtual Machine.

Adding a Bridge Interface to an Existing KVM Virtual Machine

Attention

Some network configuration changes may require TCP/IP, LAN Failover, or VLAN definitions reconfiguration. It is recommended to record the VM NIC configuration before adding, removing, or changing NICs. See Next Steps for more information.

You can add a bridge interface to an existing virtual machine via CLI, GUI, or by editing the XML configuration.

Run the following command, replacing vm-name with the name of your VM and bridge-name with the name of the bridge interface:

sudo virsh attach-interface --type bridge --source bridge-name --model e1000e vm-name

  1. Open Virtual Machine Manager either from the Application Launcher or by running the virt-manager command in your CLI. A new window will open.

  2. Select the VM that you want to edit and click the Open button. A new window will open.

  3. Click the light bulb icon (Show virtual hardware details). Then, click the Add Hardware button in the bottom-left corner. A new window will open.

  4. Click Network in the menu on the left.

  5. In the Network source drop-down menu, select Bridge device.

  6. Type your bridge interface name into the Device name field.

  7. Type your bridge interface MAC address into the MAC address field.

  8. In the Device model drop-down menu, select the model type that suits your system needs.

  9. Click Finish.

Click on the newly created device in the left menu of the Virtual Hardware Details window and make sure that the Link state field shows a selected checkbox next to "active".

Add the following lines to your XML configuration file, specifying the name of the configured bridge interface and your value for the MAC address:

<interface type='bridge'>
    <mac address='52:54:00:46:eb:6f'/>
    <source network='bridge-name'/>
    <model type='e1000e'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

Note

Make sure that the bus and mac address values are unique within a single VM configuration.

Next Steps

After the network configuration change, you may need to reconfigure TCP/IP, LAN Failover, or VLAN definitions.

  1. Boot OpenVMS and issue MCR LANCP SHOW CONFIGURATION (or SHOW CONFIGURATION/USERS), comparing the adapter types and MAC addresses against the VM NIC configuration.

  2. Adjust your applications (TCP/IP, LAN Failover, VLAN definitions) to use the correct network adapters.

    For information on how to do so, refer to the System Manager’s Manual Volume 2: Tuning, Monitoring, and Complex Systems.