"Can not set default gateway on 'vmk0' because ip address unset.", vSphere Configuration Profile compliance check failure for the ESXi hosts.
search cancel

"Can not set default gateway on 'vmk0' because ip address unset.", vSphere Configuration Profile compliance check failure for the ESXi hosts.

book

Article ID: 403353

calendar_today

Updated On:

Products

VMware vSphere ESXi VMware vCenter Server

Issue/Introduction

  • Compliance check for the ESXi host with vSphere Configuration Profile (VCP) fails with errors below:

/host-specific/########-####-####-####-############/esx/network/vmknics/1/ip/ipv4_address
Can not set default gateway on 'vmk1' because ip address unset.

/profile/esx/network/net_stacks/0/routing_config/ipv4_default_gateway
Can not set default gateway '###.###.###.###' on netstack 'defaultTcpipStack', network unreachable.

/host-specific/########-####-####-####-############/esx/esx/network/vmknics/0/ip/ipv4_address
Can not set default gateway on 'vmk0' because ip address unset.

  • VMkernel adapters on the reference host do have correct IP settings, including the gateway.

Cause

The core configuration for the vSphere Configuration Profile is derived from a reference host, however specific network settings such as IP addresses need to be configured with host-specific  data in the configuration profile. This issue is observed when the individual host details are not explicitly defined within the configuration profile for the additional hosts being added or remediated.

Resolution

Follow the below steps to add the "host-specific" details in the Configuration Profiles:

  1. Login to the vCenter Server via SSH.
  2. Fetch host UUIDs from Database.

    /opt/vmware/vpostgres/current/bin/psql -U postgres -d VCDB -c "select id, dns_name, ip_address, uuid_bios from vpx_host"

    Sample result:
    id | dns_name | ip_address | uuid_bios
    ----+----------------+----------------+--------------------------------------
    12 | ESXI-FQDN | 192.XX.XX.XX | 8a######-####-e5##-d1##-aa##########
    16 | ESXI-FQDN | 192.XX.XX.XX | 95######-####-68##-02##-0f##########


  3. Export Current Desired State.
    • Navigate to the Cluster in vCenter.
    • Go to Configure -> Desired State -> Configuration.
    • Click EXPORT to download the current desired state as a JSON file.

  4. Edit the exported desired document to add "host-specific" configuration.
    • Open the exported JSON file using text editor.
    • Locate the section for host-specific configurations.
    • For each host intend to add or remediate, add or modify the host-specific entries to include the unique IP Address and subnet mask for the relevant vmkernel adapters (vmk0, vmk1, etc.). Ensure the UUIDs for each host are correct within this section.

      Sample configuration:

          "host-specific": {
              "8a######-####-e5##-d1##-aa##########": {               
                  "esx": {
                      "network": {
                          "vmknics": [
                              {
                                  "ip": {
                                      "ipv4_address": "###.###.###.###",
                                      "ipv4_subnet_mask": "255.255.255.0"
                                  },
                                  "device": "vmk0"
                              },
                              {
                                  "ip": {
                                      "ipv4_address": "###.###.###.###",
                                      "ipv4_subnet_mask": "255.255.255.0"
                                  },
                                  "device": "vmk1"
                              }
                          ],
                          "net_stacks": [
                              {
                                  "key": "defaultTcpipStack",
                                  "host_name": "hostname.example.com"
                              }
                          ]
                      }
                  }
              },
       "95######-####-68##-02##-0f##########": {     
                  "esx": {
                      "network": {
                          "vmknics": [
                              {
                                  "ip": {
                                      "ipv4_address": "###.###.###.###",
                                      "ipv4_subnet_mask": "255.255.255.0"
                                  },
                                  "device": "vmk0"
                              },
                              {
                                  "ip": {
                                      "ipv4_address": "###.###.###.###",
                                      "ipv4_subnet_mask": "255.255.255.0"
                                  },
                                  "device": "vmk1"
                              }
                          ],
                          "net_stacks": [
                              {
                                  "key": "defaultTcpipStack",
                                  "host_name": "hostname.example.com"
                              }
                          ]
                      }
                  }
              }
          }

  5. Import the Modified Document.
    • Navigate back to the Cluster -> Configure -> Desired State -> Configuration.
    • Click IMPORT and upload the modified JSON file.

  6. Remediate/Add Hosts.
    • Once the updated desired state is imported, proceed to remediate the existing hosts or add new hosts to the cluster, and the network configuration should now apply correctly.