> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/welcome/elastic-compute/networking/dhcp/03-primary-and-secondary-nic.md).

# Primary and Secondary vNICs

Both primary and secondary vNICs support DHCP, but the platform only answers — it never pushes. A vNIC gets an address only when the operating system inside the instance sends a DHCP request. Public images configure DHCP only on the primary vNIC; you configure secondary vNICs yourself inside the instance.

On this page, a secondary vNIC means an [elastic vNIC](https://docs.console.zenlayer.com/welcome/elastic-compute/networking/network-interface.md) attached to the instance.

## Support

| vNIC type      | DHCP supported by the platform | Public image default                      | What you need to do                                                    |
| -------------- | ------------------------------ | ----------------------------------------- | ---------------------------------------------------------------------- |
| Primary vNIC   | Yes                            | DHCP configured; address obtained at boot | Nothing                                                                |
| Secondary vNIC | Yes                            | Not configured                            | Enable DHCP for the vNIC inside the instance, or configure a static IP |

## Enable DHCP on a Secondary vNIC

After attaching a secondary vNIC, find its device name inside the instance (for example, `eth1` in the output of `ip link`), then use one of the methods below for your operating system. The examples assume the secondary vNIC is `eth1`; replace it with the actual device name.

**Ubuntu / Debian (Netplan)**: Create `/etc/netplan/60-eth1.yaml`, then run `netplan apply`.

```yaml
network:
  version: 2
  ethernets:
    eth1:
      dhcp4: true
      dhcp4-overrides:
        use-routes: false
```

**CentOS / Rocky / AlmaLinux (NetworkManager)**:

```bash
nmcli connection add type ethernet ifname eth1 con-name eth1 ipv4.method auto ipv4.never-default yes
nmcli connection up eth1
```

**Windows**: In **Network Connections**, open the **Internet Protocol Version 4 (TCP/IPv4)** properties of the secondary vNIC and select **Obtain an IP address automatically**. Windows enables DHCP on new network adapters by default, so usually no action is needed.

> **Note**: DHCP replies on a secondary vNIC also carry a default gateway. If both the primary and secondary vNICs accept a default route, the instance ends up with multiple default routes, which can break connectivity. As in the examples above, ignore the default route delivered to the secondary vNIC and add routes to specific CIDRs as needed.

## Use a Static IP

You can also skip DHCP and configure a static IP inside the instance. Make sure the IP, mask, and gateway match the vNIC's details in the console; otherwise the network won't work. Secondary private IPs on a vNIC are never delivered by DHCP and must always be configured inside the instance.
