Create an (IP alias / secondary administration network) on VMware ESXi

    

For some reasons, I need to create a secondary administration network on my ESXi servers. As I don’t need the routing stuff, I thought I’d create IP aliases as I would do with any UNIX server. But on the ESXi, it is just no possible, AFAIK.

The solution is to create another VMkernel port, used for management, on the ESXi. As I don’t want to use any extra hardware, I’ll create the portgroup in the existing vSwitch. Here’s how.

For the fun, and because I only had access to the ESXi shell by that time, I created the secondary VMkernel port using the CLI. Connect to the ESXi via SSH and have a look at the actual configuration:

  # esxcfg-vswitch -l
  Switch Name      Num Ports   Used Ports  Configured Ports  MTU     Uplinks   
  vSwitch0         128         6           128               1500    vmnic0,vmnic1
  
    PortGroup Name        VLAN ID  Used Ports  Uplinks   
    VM Network            0        2           vmnic0,vmnic1
    Management Network    0        1           vmnic0,vmnic1
  
  # esxcfg-vmknic -l
  Interface  Port Group/DVPort   IP Family IP Address                              Netmask         Broadcast       MAC Address       MTU     TSO MSS   Enabled Type                
  vmk0       Management Network  IPv4      192.168.0.62                            255.255.255.0   192.168.0.255   00:0c:29:1d:80:05 1500    65535     true    STATIC              

Let’s create the new VMkernel port group in the current vSwitch:

  # esxcfg-vswitch -A "VPN Network" vSwitch0
  # esxcfg-vswitch -l
  Switch Name      Num Ports   Used Ports  Configured Ports  MTU     Uplinks   
  vSwitch0         128         6           128               1500    vmnic0,vmnic1
  
  PortGroup Name        VLAN ID  Used Ports  Uplinks   
  VPN Network           0        0           vmnic0,vmnic1
  VM Network            0        2           vmnic0,vmnic1
  Management Network    0        1           vmnic0,vmnic1

Then, just assign the VMkernel IP to the new portgroup:

  # esxcfg-vmknic -a -i 10.15.5.62 -n 255.255.255.0 "VPN Network"
  # esxcfg-vmknic -l
  Interface  Port Group/DVPort   IP Family IP Address                              Netmask         Broadcast       MAC Address       MTU     TSO MSS   Enabled Type                
  vmk0       Management Network  IPv4      192.168.0.62                            255.255.255.0   192.168.0.255   00:0c:29:1d:80:05 1500    65535     true    STATIC              
  vmk1       VPN Network         IPv4      10.15.5.62                              255.255.255.0   10.15.5.255     00:50:56:7f:8e:58 1500    65535     true    STATIC              

The ESXi can now be managed either via vmk0 and/or vmk1.
Using the vSphere Client, here’s what we see:

Beware that “(…) Only 1 VMkernel port is allowed per subnet on a vSwitch in ESX/ESXi.” One has tested setting DHCP on the secondary interface and it just wrapped the ESXi. In such case, either restore default IP settings from the console or use the following command, from console shell:

  # esxcfg-vmknic -d -p "VPN Network"

Source: Configuring a VMkernel port and enable vMotion via command line