Rate This Document
Findability
Accuracy
Completeness
Readability

Configuring the VM NIC Configuration File

Modify the VM NIC configuration file to enable network communication for the VM. If the SR-IOV solution is used, you need to manually generate a VM NIC configuration file by referring to this section.

  1. Check the VM NIC name.
    ip a

  2. Create a configuration file.
    • If the SR-IOV solution is adopted in Configuring the Host Network, run the following commands to create a network configuration file:
      nmcli connection add ifname enp1s0 con-name enp1s0 type ethernet
      cd /etc/sysconfig/network-scripts/
      ls

      As shown in the following figure, the VM NIC configuration file is created.

    • If the bridge mode is adopted in Configuring the Host Network, a network configuration file is automatically generated on the VM. The file name is the same as the NIC name in the ip a command output. In this case, skip this step.

    If possible, you are advised to use the SR-IOV solution, which provides better computing performance and shorter latency.

  3. Log in to the VM and configure IPADDR, NETMASK, GATEWAY, and DNS for the VM. Ensure that ONBOOT is set to yes.

    The VM and host share the values of NETMASK, GATEWAY, and DNS. IPADDR can be customized. Confirm with the network administrator to ensure that the IP address does not conflict with other IP addresses on the LAN.

    vi ifcfg-enp1s0

    If the configuration file contains the content in the red box in the following figure, delete the content.

  4. Reload network connections. You are advised to run the commands in the shell of virt-manager. If you perform remote operations through SSH, connections will be interrupted due to network configuration modification.
    virt-manager

    nmcli connection reload
    nmcli connection down enp1s0
    nmcli connection up enp1s0

  5. Ping the gateway and check whether the configuration takes effect over SSH remote connection. The gateway can be queried in the configuration file of bridge br0.
    ping 192.168.20.1

    On any server in the same network segment, connect to the VM using ssh.

    ssh 192.168.20.150

    In this example, data communication with the VM inside the LAN of the server has been achieved. If you want to access the VM inside the LAN from an external VM, contact the network administrator to configure the external VM following server configurations inside the LAN.