You may find easily the IP address and route details of a VMware ESXi through the command-line interface. Use the command esxcli to find the details of IP addresses and routes.
IP Address and Route Details in VMware ESXi
- Login to VMware vSphere ESXi host as a superuser or root.
- Run the esxcli network ip interface list command to get the network card details.
[root@dbappweb_esxi:~] esxcli network ip interface list vmk0 Name: vmk0 MAC Address: 54:9f:35:22:1b:14 Enabled: true Portset: vSwitch0 Portgroup: Management Network Netstack Instance: defaultTcpipStack VDS Name: N/A VDS UUID: N/A VDS Port: N/A VDS Connection: -1 Opaque Network ID: N/A Opaque Network Type: N/A External ID: N/A MTU: 1500 TSO MSS: 65535 Port ID: 33554436
- Run the esxcli network ip interface ipv4 get command to get the IP address details.
[root@dbappweb_esxi:~] esxcli network ip interface ipv4 get Name IPv4 Address IPv4 Netmask IPv4 Broadcast Address Type Gateway DHCP DNS ---- ------------ ------------- -------------- ------------ ------- -------- vmk0 10.65.26.80 255.255.255.0 10.65.26.255 STATIC 0.0.0.0 false
- Run the esxcli network ip route ipv4 list command to get the route details.
[root@dbappweb_esxi:~] esxcli network ip route ipv4 list Network Netmask Gateway Interface Source ---------- ------------- ---------- --------- ------ default 0.0.0.0 10.65.26.4 vmk0 MANUAL 10.65.26.0 255.255.255.0 0.0.0.0 vmk0 MANUAL
- To display the default gateway of VMkernel, run the esxcfg-route command.
[root@dbappweb_esxi:~] esxcfg-route VMkernel default gateway is 10.65.26.4
- Run the esxcfg-route -h command to display the options which can be used with this command to get more details.
[root@dbappweb_esxi:~] esxcfg-route -h esxcfg-route [ ] | can be specified in 3 ways: * As a single argument in / format * Or as a pair. * Or as 'default' -a|--add Add route to the VMkernel, requires (described above) and gateway IP address -d|--del Delete route from the VMkernel. Requires (described above) -l|--list List configured routes for the VMkernel -n|--neighbor-list Show Neighbor Cache entries for the VMkernel -f|--family or Address family to work on. Defaults to V4. -N|--netstack Netstack Instance -r|--restore Restore route setting to configured values on system start. (INTERNAL USE ONLY) -h|--help Show this message. If no options are specified then it will print the default IPv4 gateway. The default IPv4 gateway can be set directly as : esxcfg-route Examples: To add a route to 192.168.100.0 network through 192.168.0.1 esxcfg-route -a 192.168.100.0/24 192.168.0.1 or esxcfg-route -a 192.168.100.0 255.255.255.0 192.168.0.1 To set the VMkernel default gateway of 192.168.0.1 esxcfg-route 192.168.0.1 or esxcfg-route -a default 192.168.0.1 To delete a 192.168.100.0 route from the VMkernel: esxcfg-route -d 192.168.100.0/24 192.168.0.1 To view the IPv4 ARP table: esxcfg-route -n To add a route to 2001:10:20:253::/65 network through 2001:10:20:253::1 esxcfg-route -f V6 -a 2001:10:20:253::/65 2001:10:20:253::1 To set the VMkernel default gateway of 2001:10:20:253::1 esxcfg-route -f V6 -a default 2001:10:20:253::1 To delete a 2001:10:20:253:: route from the VMkernel: esxcfg-route -f V6 -d 2001:10:20:253::/65 2001:10:20:253::1 To view the IPv6 Neighbor cache: esxcfg-route -f V6 -n
Last Updated: August 21, 2020
Related Posts
- Install VMware tools on RHEL through command line
- Failed to start the virtual machine. Module DiskEarly power on failed.
- VMware ESXi Host Upgrade from Version 5.5 to 6.5
- Change Guest OS Version of a VM on VMware ESXi
- Upgrade VM Compatibility Level of Virtual Machines in VMware ESXi
- How to find system info, processor info, cache info, memory info etc from ESXi host CLI
- How to Change the Default Gateway for VMware vSphere ESXi