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:
- Log in to the VM OS.
- Run the ifconfig command to query the NIC used by the current VM.
- 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
- Run the systemctl restart network command to restart the VM network to make the network configuration take effect.
- Run the following commands to disable the firewall:
systemctl stop firewalld
- 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.
Last Article: Creating a Hyper-V VM
Next Article: Monitoring
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.