Document navigation

Issue/Introduction

This article describes how to add multiple NICs to a VM instance. It applies to the initial diagnosis and resolution of similar issues in ZStack Cloud.

Environment

  • Product: ZCF
  • Component: Cloud
  • Version: 3.x-5.5.30

Symptoms

When creating a VM instance, you might attach multiple networks to it. In this case, the VM instance console displays multiple NICs but no IP addresses.

Possible causes

Each network corresponds to one NIC on a VM instance. Attaching a network to a VM instance is equivalent to connecting a physical NIC to a server. Therefore, ifconfig displays the eth devices. If no IP address is displayed, the NIC is not configured correctly.

Resolution

Create a configuration file for the new NIC based on the eth0 configuration file. The following example uses CentOS 7.2. Paths and files might differ in other Linux versions:

  1. Run the following commands in the console to copy the eth0 configuration file:
  # Replace eth0 with eth1 in the configuration file, and remove its UUID information
  cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1
  sed -i 's/eth0/eth1/g' /etc/sysconfig/network-scripts/ifcfg-eth1
  sed -i '/UUID*/d' /etc/sysconfig/network-scripts/ifcfg-eth1
  1. Restart the network for the configuration to take effect:
  /etc/init.d/network restart
  1. Run ifconfig. The newly added NIC now displays an IP address. If multiple networks are attached to the VM instance, repeat the preceding operations for each network.
How do I add multiple NICs to a VM instance? | 故障排查 · KB | ZStack Resource Center