NAME

vicfg-vswitch - create and configure virtual switches and port groups


SYNOPSIS

 vicfg-vswitch [<connection_options>] 
    [ --add <switch_name> |
      --check <vswitch_name> |
      --delete <vswitch_name> |
      --get-cdp <vswitch_name> |
      --help |
      --link <physical_nic> <vswitch_name> |
      --list |
      --mtu <vswitch_name> |
      --set-cdp <vswitch_name> |
      --unlink <physical_nic> <vswitch_name> |
      --vihost <esx_host ]
 vicfg-vswitch [<connection_options>]
    [--add_pg <portgroup> <vswitch_name> |
     --check-pg <port_group> <vswitch_name> |
     --del-pg <port_group> <vswitch_name> |
     --help |
     --list |
     --vihost <esx_host |
     --vlan --pg <port_group> ]
 vicfg-vswitch [<connection_options>]
    [--add-dvp-uplink <adapter_name> --dvp <DVPort_id> <dvswitch_name> |
     --del-dvp-uplink <adapter_name> --dvp <DVPort_id> <dvswitch_name> |
     --help |
     --vihost <esx_host ]
 vicfg-vswitch [<connection_options>]
    [--add-pg-uplink <adapter_name> --pg <port_group> <vswitch_name> |
     --del-pg-uplink <adapter_name> --pg <port_group> <vswitch_name> |
     --help |
     --vihost <esx_host ]


DESCRIPTION

The vicfg-vswitch command adds or removes virtual switches or modifies virtual switch settings. A virtual switch is an abstracted network device. It can route traffic internally between virtual machines and link to external networks. The ESX Configuration Guide and the ESXi Configuration Guide discuss virtual switches, vNetwork Distributed Switches (vDS), port groups, and vDS port groups. The vSphere CLI manual presents some sample scenarios.

By default,each ESX/ESXi host has a single virtual switch called vSwitch0.


OPTIONS

--add | -a <switch_name>

Adds a new virtual switch.

--add-pg | -A <portgroup> <vswitch_name>

Adds a port group to the specified virtual switch.

--add-dvp-uplink | -P

Adds an uplink adapter to a distributed virtual port (DVP).

--add-pg-uplink | -M

Adds an uplink adapter to a port group (valid for vSphere 4.0 and later). This command fails silently if the uplink adapter does not exist.

--check | -c <vswitch_name>

Checks whether a virtual switch exists. Prints 1 if the switch exists and prints 0 otherwise. Use the virtual switch name, e.g. vSwitch0 or vSwitch1, to specify the virtual switch.

--check-pg | -C <port_group> <vswitch_name>

Checks whether the specified port group exists or not.

connection_options

Specifies the target server and authentication information if required. Run vicfg-vswitch --help for a list of all connection options.

--delete | -d <vswitch_name>

Deletes a virtual switch. Running the command with this option fails if any ports on the virtual switch are in use by VMkernel networks, vswifs, or virtual machines.

--del-pg | -D <port_group> <vswitch_name>

Deletes a port group from the virtual switch. Running the command with this option fails if the port group is in use, for example, by a virtual machine or a VMkernel network.

--del-dvp-uplink | -Q <adapter_name> --dvp <DVPort_id> <dvswitch_name> >

Deletes an uplink adapter from a port on a DVS (distributed virtual switch), also called vNetwork Distributed Switch (vDS). Valid for vSphere 4.0 and later.

--del-pg-uplink | -N <adapter_name> <port_group> <dvswitch_name> >

Deletes an uplink adapter from a port group. Valid for vSphere 4.0 and later.

--dvp | -V

Name of a distributed virtual port. Used in conjunction with other options. Valid for vSphere 4.0 and later.

--get-cdp | -b <vswitch_name>

Prints the current CDP (Cisco Discovery Protocol) setting for this virtual switch (valid for vSphere 4.0 and later).

--help

Prints a help message for each command-specific and each connection option. Calling the script with no arguments or with --help has the same effect.

--link | -L <physical_nic> <vswitch_name>

Adds an uplink adapter (physical NIC) to a virtual switch. Running the command with this option attaches a new unused physical network adapter to a virtual switch.

--list | -l

Lists all virtual switches and their port groups.

--mtu | -m <vswitch_name>

Sets the MTU (maximum transmission unit) of the virtual switch. This option affects all physical NICs assigned to the virtual switch.

--pg | -p <port_group>

Provides the name of the port group for the --vlan option. Specify ALL to set VLAN IDs on all port groups of a virtual switch.

--set-cdp | -B <vswitch_name> [down | listen | advertise | both]

Sets the CDP status for a given virtual switch (valid for vSphere 4.0 and later). To set, specify down, listen, advertise, or both.

--unlink | -U <physical_nic> <vswitch_name>

Removes an uplink adapter from a virtual switch. An uplink adapter corresponds to a physical Ethernet adapter to which the virtual switch is connected. If you remove the last uplink adapter, you lose physical network connectivity for that switch.

--vihost | -h <esx_host>

When you run a vSphere CLI command with the --server option pointing to a vCenter Server system, use --vihost to specify the ESX/ESXi host to run the command against.

--vlan | -v --pg <port_group>

Sets the VLAN ID for a specific port group of a virtual switch. Setting the option to 0 disables the VLAN for this port group. If you specify this option, you must also specify the --pg option.


EXAMPLES

The following examples assume you are specifying connection options, either explicitly or, for example, by specifying the server, user name, and password. Run vicfg-vswitch --help for a list of common options including connection options.

Add a new virtual switch:

 vicfg-vswitch <conn_options> -a <vswitch name>

Delete the virtual switch. This will fail if any ports on the virtual switch are still in use by VMkernel networks, vswifs, or virtual machines:

 vicfg-vswitch <conn_options> -d <vswitch name>

List all virtual switches and their portgroups:

 vicfg-vswitch <conn_options -l

Add an uplink adapter to a virtual switch:

 vicfg-vswitch <conn_options> -L <physical adapter name> <vswitch name>

Remove an uplink adapter from a virtual switch:

 vicfg-vswitch <conn_options> -U <physical adapter name> <vswitch name>

Check whether a virtual switch exists:

 vicfg-vswitch <conn_options> --check <vswitch name>

Add a new portgroup to the virtual switch:

 vicfg-vswitch <conn_options> -A <port group name> <vswitch name>

Delete a portgroup from the virtual switch:

 vicfg-vswitch <conn_options> -D <port group name> <vswitch name>

Check whether a port group exists:

 vicfg-vswitch <conn_options> -C <valid portgroup name> <vswitch name>

Add an uplink adapter to a port group:

 vicfg-vswitch <conn_options> -M <physical adapter name> -p <port group name> <vswitch name>

Remove an uplink adapter from a port group:

 vicfg-vswitch <conn_options> -N <physical adapter name> -p <port group name> <vswitch name>

Print the current CDP setting for the virtual switch:

 vicfg-vswitch <conn_options> --get-cdp <vswitch name>