When you add a new NIC to a VM instance, QEMU only presents this NIC to the system, but this NIC cannot correctly be identified. To view this new NIC, run lspci. The following are the two methods to correctly identify the NIC when you run the operating system of the VM instance:
- Method 1: Restart the VM instance. After restarting the VM instance, you will automatically obtain the NIC information.
- Method 2: Manually configure the NIC without the need to restart the VM instance.
Procedure
- Reference /etc/sysconfig/network-scripts/ifcfg-eth0 in the VM instance, and add the ifcfg-eth1 configuration file to the new eth1 NIC.
- Go to the ifcfg-eth1 configuration file of eth1, and set the required parameters. For example:
After setting, run[root@VM-web ~]# cd /etc/sysconfig/network-scripts/ [root@VM-web network-scripts]# vim ifcfg-eth1 ... TYPE=Ethernet BOOTPROTO=dhcp NAME=eth1 DEVICE=eth1 ONBOOT=yes ...:wqto save and exit this setting. - Run
systemctl restart networkto restart the network to take effect. Hence, this NIC can be correctly identified.