Help Center> Bare Metal Server> Best Practices> Virtualization> Hyper-V on BMS> Configuring the vNIC for the Service VM

Configuring the vNIC for the Service VM

This section uses CentOS 7 as an example to describe how to configure a network for the VM. Assume that the user-defined network segment is 172.168.0.0 and the IP address of the VM is 172.168.0.10. The procedure is as follows:

  1. Log in to the VM OS.
  2. Run the ifconfig command to query the NIC used by the current VM.
  3. Assume that the name of the NIC obtained in 2 is eth0. Run the following command to open the /etc/sysconfig/network-scripts/ifcfg-eth0 file:

    vim /etc/sysconfig/network-scripts/ifcfg-eth0

    Edit the file as follows:

    USERCTL=no
    ONBOOT=yes
    BOOTPROTO=static
    DEVICE=eth0
    TYPE=Ethernet
    IPADDR=172.168.0.10
    GATEWAY==172.168.0.1
    NETMASK=255.255.255.0
    MTU=8888
  4. Run the systemctl restart network command to restart the VM network to make the network configuration take effect.
  5. Run the following commands to disable the firewall:

    systemctl disable firewalld

    systemctl stop firewalld

  6. Edit the /etc/resolv.conf file and configure DNS.
    nameserver 114.114.114.114

After the preceding operations are complete, the service VM can communicate with ECSs in the same VPC. You can run the ping command to verify the communication. If you have obtained a NAT gateway and bound an EIP to it, the VM can communicate with the Internet.