Information Technology Reference
In-Depth Information
vicfg-vswitch --server < Hostname > --list
esxcfg-vswitch --server < Hostname > --list
By using this set of commands, you can perform common tasks needed for basic host
coni guration that would previously be done from the bash Service Console. For instance,
Listing 14.3 will perform the following:
Create a new vSwitch named vSwitch1.
Add vmnic1 as an uplink to the new vSwitch.
Create a new VM portgroup.
Add a VLAN to the new vSwitch.
Listing 14.3: Create a new vSwitch from vMA
# add a new vSwitch
vi-admin@vma01:~> vicfg-vswitch --server pod-1-blade-6.v12nlab.net -a vSwitch1
# add an uplink to the vSwitch
vi-admin@vma01:~> vicfg-vswitch --server pod-1-blade-6.v12nlab.net`
-L vmnic1 vSwitch1
# add a VM portgroup to the new vSwitch
vi-admin@vma01:~> vicfg-vswitch --server pod-1-blade-6.v12nlab.net -A ″VM-Public″
vSwitch1
# set the VLAN for the new portgroup
vi-admin@vma01:~> vicfg-vswitch --server pod-1-blade-6.v12nlab.net`
-v 10 -p ″VM-Public″ vSwitch1
Executing these commands, however, becomes tedious very quickly because you must con-
stantly enter the username and password to connect to the server. One workaround would be
to wrap the commands in a bash script and pass the username and password as parameters.
This is somewhat undesirable, however, because you are leaving credentials to your ESXi hosts
available to anyone who can log into your server. This is where the benei t of using vMA over a
standard host with the vCLI installed comes into play.
vMA has some additional functionality installed on it called fastpass . Fastpass allows you to
securely add ESXi hosts, and even vCenter servers, to your vMA once and connect to them with-
out a password during script execution. This allows you to treat the vMA's command line as you
would the native host. You must i rst initialize the host with fastpass to take advantage of this
feature. This is easily done:
vifp addserver < Hostname >
This command then prompts for the ESXi host's root password, connects to the host, and
adds two users to the host. These two users are used for executing commands. Should you
Search WWH ::




Custom Search