ESX 3.5 – 5 critical vmware esx cli network commands

Posted on Updated on

I found this really cool article today… It’s not my work, but it is a great reference…

5 Critical VMware ESX CLI Network Troubleshooting Commands
by David Davis, vExpert, VCP, CCIE 9369 – December 23, 2008

Have you ever made a change to your VMware ESX Server Network configuration using the Virtual Infrastructure (VI) Client and then lost communications with the server? If you had to go to the ESX Service console to troubleshoot the virtual network configuration, would you know the commands to do it? In this article, you will learn the 5 most critical ESX CLI commands you need to know to troubleshoot networking issues.
#1) service network restart
The service X restart command is an excellent command that allows you to restart any service running on your ESX Server. In our case, we are using the network keyword to restart network services. This is the command you should run after making changes to your ESX networking configuration. You can also do network start or network stop. This brings down all network interfaces, then brings up the interfaces configured to start at boot.

#2) ifconfig
The second command is ifconfig. Similar to the Windows command, ipconfig, this command is used to view the status of all network interfaces on the system. However, it can do a lot more than just view an interface, it can reconfigure interfaces, bring them down, or back up. You can change the IP address of your interfaces with ifconfig.

#3) esxcfg-vswif
Next, we have the ESX command that allows you to view the status of or reconfigure the VMware Service console network interface. That SC network interface is called “vswif” and the first interface is always “vwsif0”. To view the status of it, you can use the -l (L for list)
#4) esxcfg-vswitch
The fourth command on the list is the esxcfg-vswitch command. This command is used to view the status of or reconfigure the VMware virtual switches (called vswitch). These vswitches are used to connect the physical NIC in the server (called vmnic) to the ESX port groups (such as the “Service Console” and the “VM Network” port groups). To view the status of your vswitches, you can use the -l (L for list) command, like this:

#5) esxcfg-nics
Lastly, we have the esxcfg-nics command. This command is used to view the status of or reconfigure the VMware Physical Network interface cards that are installed in the physical server. These physical NICs are called “vmnic” and they start with “vmnic0”. The vmnics are connected to vswitches to connect the physical network to the virtual networks.
To view the status of your vmnics, you can use the -l (L for list) command,
Believe me, there was a time that I was stuck at the ESX service console interface, trying to resolve a networking issues, and struggling to find the right commands to do it. I hope that you will save this URL or print this article to keep it handy the next time you are in a similar situation because that know that these 5 commands can help you get out of any VMware ESX Server networking configuration or troubleshooting issue.

ESX 3.5 – Change the default gateway

Posted on Updated on

From the command prompt enter
Netstat –nr — this Command will help you to id the actual gateway address

You now need to change your default gateway, you can do this by editing the network file located at /etc/sysconfig/network. To do this at the command prompt, follow the steps below.

“cd /etc/sysconfig”
“vi network”

Then while in vi, go to the location of the default gateway using the arrow keys.
Hit “i” which will perform an insert and change the default gateway to your liking.
Hit the escape key twice to exit insert mode.
type “:wq” to write (i.e save) and quit.

ESX 3.5 – Remove a PortGroup

Posted on Updated on

During the graphical installation of ESX 3.5 there is a single checkbox that states “Create Network for Virtual Machines” Usually I uncheck this box and create a new vSwitch for VM’s

However, if you don’t uncheck this box it will create the portgroup “VM Network” on the same vSwitch as the “Service Console” port group. If you run vCenter Server it’s easy enough to repair, however here is how it’s done from the console level…

Here is how you remove it from command line…

Esxcfg-vswtich –l –Show all the vSwitches and associated portgroups
Esxcfg-vswtich vSwitch0 –D “VM Network” – Actually Removes it

Here is the actual output…

ESX 3.5 – Change a VLAN Tag on a PortGroup

Posted on Updated on

I setup 4 ESX servers the other day and the wrong vlan tag was entered. MyLAN admin is out of the office, so I have two choices… One Bug him like crazy (Calls and Emails) or two wait till he returns to change the VLAN tag
I like Option 3 – Change the VLAN tag myself…
I found this here and it work perfectly…

Check which vSwitch the Service Console is on (and the name of the Service Console) with esxcfg-vswitch -l
To remove the vlan id completely, just set it to 0 (in case you have set it by accident on an access port)
esxcfg-vswitch vSwitch0 -v 0 -p “Service Console”
To set a vlan id on the service console (in case you forgot to define this during the installation)
esxcfg-vswitch vSwitch0 -v X -p “Service Console” (enter the vlan number where X is)

Here is my actual output (VLAN tags have been changed to protect the innocent!)

ESX 3.5 – NTP Time Server Restart

Posted on Updated on

I found the following commands to work really well when you need to restart your NTP sevice on your ESX server.

Logon to the console level..

Commands >> Effect
# service ntpd restart >> Restart the service.
# chkconfig –level 345 ntpd on >> Enable the NTP daemon to autostart when the server is rebooted.
# hwclock –systohc >> Set the local hardware clock to the NTP synchronized local system time.

#hwclock –show {Press Enter} << Shows you the current clock
Fri 23 Apr 2010 08:17:41 AM MST -0.989683 seconds

ESX 3.5 – Partitions

Posted on Updated on

I get asked this question many times… what are the best practices for partitions with ESX 3.5.

Here are the settings that I use…

Setting primary partitions
Best practices state that the following partitions should be made “Primary” partitions:
Table 3 – Primary Partitions
Mount Point Partition Type Size in MB
/boot ext3 100 MB
/ ext3 2048 MB
N/A swap 1600 MB

This can be accomplished by selecting each of the aforementioned partitions (one at a time) and clicking the “Edit” button. The configuration options for that partition/file system will be brought up. Select (turn on) the checkbox option near the bottom of the box labeled “Force to be a primary partition”. Do this for each of 3 file systems listed above, clicking “OK” after fixing each file system.

Configuring partitions
The following table adheres to VMware best practices:

Extended Partitions
Mount Point Partition Type Size in MB
/var ext3 4096 MB
/tmp ext3 1024 MB
/opt ext3 2048 MB
/home ext3 1024 MB
vmkcore 100 MB
N/A vmfs Remaining space

VMware KB: Enhanced VMotion Compatibility (EVC) processor support

Posted on Updated on

Check out this great article on EVC… lots of great information and links!

VMware KB: Enhanced VMotion Compatibility (EVC) processor support: “Enhanced VMotion Compatibility (EVC) processor support

Enhanced VMotion Compatibility (EVC) simplifies VMotion compatibility issues across CPU generations. EVC automatically configures server CPUs with Intel FlexMigration or AMD-V Extended Migration technologies to be compatible with older servers. After EVC is enabled for a cluster in the VirtualCenter inventory, all hosts in that cluster are configured to present identical CPU features and ensure CPU compatibility for VMotion. The features presented by each host are determined by selecting a predefined EVC baseline. VirtualCenter does not permit the addition of hosts that cannot be automatically configured to be compatible with the EVC baseline.”

ESX / ESXi 4.0 Whitebox HCL

Posted on Updated on

I found this cool link to whitebox with your ESX servers.. check it out!
Thanks to a fellow VMUG User (Vlad N)

ESX / ESXi 4.0 Whitebox HCL: “Motherboards and unsupported servers that work with ESX 4.0 and / or ESXi 4.0 Installable
Lasted updated – 2010.02.02″