ESXi Hostname Management Guide

Overview

This guide covers changing ESXi hostnames and updating related configurations to maintain consistency across your homelab infrastructure.

Current vs. Target Configuration

Host IP Current Hostname Target Hostname Target FQDN
192.168.10.8 nuc1 esxi-nuc-01 esxi-nuc-01.lab.local
192.168.10.9 nuc2 esxi-nuc-02 esxi-nuc-02.lab.local
192.168.10.10 nuc3 esxi-nuc-03 esxi-nuc-03.lab.local

Domain vs. Hostname vs. FQDN

Understanding the Components

Hostname: Short name identifying the host

  • Example: esxi-nuc-01
  • Used for local identification

Domain Name: Network domain the host belongs to

  • Example: lab.local
  • Used for DNS hierarchy

FQDN (Fully Qualified Domain Name): Complete DNS name

  • Example: esxi-nuc-01.lab.local
  • Used for network services and certificates

Why Update Hostnames?

Benefits of Descriptive Hostnames

  1. Consistency: Matches naming convention used in SSH config
  2. Clarity: Immediately identifies the host type and number
  3. Documentation: Easier to reference in procedures and scripts
  4. Monitoring: Better identification in logs and alerts

Naming Convention

esxi-<hardware-type>-<number>

Examples:
- esxi-nuc-01, esxi-nuc-02, esxi-nuc-03
- esxi-ms-a2-01, esxi-ms-a2-02

Configuration Update Process

Step 1: Update Hostnames

Use the provided script to update all hostnames at once:

./scripts/update-esxi-hostnames.sh

This script will:

  1. Connect to each ESXi host via SSH
  2. Update the hostname using esxcli
  3. Verify the changes
  4. Provide next steps

Configure proper domain names and FQDNs:

# Use default domain (lab.local)
./scripts/update-esxi-domains.sh

# Or specify custom domain
./scripts/update-esxi-domains.sh homelab.local
./scripts/update-esxi-domains.sh markalston.net

This script will:

  1. Set proper domain name
  2. Configure FQDN
  3. Verify DNS configuration
  4. Provide DNS setup instructions

Manual Method

For individual hosts or manual verification:

# Connect to ESXi host
ssh root@192.168.10.8

# Check current hostname
hostname -s

# Update hostname
esxcli system hostname set --host=esxi-nuc-01

# Verify change
hostname -s

Post-Update Tasks

1. Update SSH Configuration

After changing hostnames, update your SSH config:

./scripts/deploy-esxi-ssh-keys.sh

This will regenerate SSH config entries with the new hostnames.

2. Update DNS Records (If Applicable)

If using internal DNS, update A records:

esxi-nuc-01.lab.local  → 192.168.10.8
esxi-nuc-02.lab.local  → 192.168.10.9
esxi-nuc-03.lab.local  → 192.168.10.10

3. Update vCenter Inventory

If hosts are managed by vCenter:

  1. In vSphere Client:
    • Navigate to Hosts and Clusters
    • Right-click each host
    • Select “Rename”
    • Update to match new hostname
  2. Or via PowerCLI:
    # Connect to vCenter
    Connect-VIServer -Server vcenter.lab.local
       
    # Rename hosts
    Get-VMHost -Name "nuc1*" | Set-VMHost -Name "esxi-nuc-01"
    Get-VMHost -Name "nuc2*" | Set-VMHost -Name "esxi-nuc-02"
    Get-VMHost -Name "nuc3*" | Set-VMHost -Name "esxi-nuc-03"
    

4. Update Documentation

Update any references in:

  • Network diagrams
  • Inventory spreadsheets
  • Backup scripts
  • Monitoring configurations
  • Documentation files

5. Update Backup References

The backup scripts should automatically use the new hostnames, but verify:

# Test VIB backup with new hostnames
./scripts/backup-esxi-vibs.sh

# Test config backup with new hostnames
./scripts/backup-esxi-config.sh

Verification

Check Hostname Resolution

# Test SSH connectivity with new hostnames
ssh esxi-nuc-01 "hostname -s"
ssh esxi-nuc-02 "hostname -s"
ssh esxi-nuc-03 "hostname -s"

Verify ESXi Configuration

# Check hostname in ESXi
ssh esxi-nuc-01 "esxcli system hostname get"

Expected output:

Domain Name: 
Fully Qualified Domain Name: esxi-nuc-01
Host Name: esxi-nuc-01

Check Network Services

Verify that network services still work:

  • Web UI access (https://192.168.10.8)
  • vCenter connectivity
  • Storage connections
  • Backup operations

Troubleshooting

Hostname Not Changed

If hostname doesn’t update immediately:

# Check hostname configuration
esxcli system hostname get

# Restart management services
/etc/init.d/hostd restart
/etc/init.d/vpxa restart

SSH Connection Issues

If SSH stops working after hostname change:

  1. Use IP address to connect
  2. Check SSH service status
  3. Regenerate SSH keys if needed

vCenter Communication Issues

If vCenter loses connectivity:

  1. Reconnect Host:
    • In vSphere Client
    • Right-click host → Connection → Connect
  2. Update Host Certificates (if required):
    # On ESXi host
    /sbin/generate-certificates
    /etc/init.d/hostd restart
    

Best Practices

Timing Considerations

  • Maintenance Window: Change hostnames during scheduled maintenance
  • VM Impact: No downtime required for VMs
  • vCenter: May show temporary warnings during change

Pre-Change Checklist

  • Backup current ESXi configuration
  • Document current network settings
  • Notify team of hostname changes
  • Plan rollback procedure

Rollback Procedure

If issues arise, revert hostnames:

# Example rollback for nuc1
ssh root@192.168.10.8 "esxcli system hostname set --host=nuc1"

Security Considerations

Certificate Implications

Hostname changes may affect:

  • SSL certificates
  • vCenter trust relationships
  • Host profiles

Access Control

Ensure hostname changes don’t affect:

  • User permissions
  • Service account access
  • Backup operations

Future Hostname Changes

Planned Additions

When adding MS-A2 hosts:

  • esxi-ms-a2-01 (192.168.10.100)
  • esxi-ms-a2-02 (192.168.10.101)

Maintenance Script

Consider creating a maintenance script for future hostname changes:

#!/bin/bash
# update-single-hostname.sh <ip> <new-hostname>
ssh root@$1 "esxcli system hostname set --host=$2"

Summary

Hostname updates improve infrastructure organization and consistency. The automated script simplifies the process while maintaining proper verification and documentation of changes.

Key benefits:

  • Improved clarity and documentation
  • Consistent naming across infrastructure
  • Better integration with monitoring and automation
  • Easier troubleshooting and maintenance

This project is for educational and home lab purposes.