7 Create or manipulate virtual switches using esxcli network vswitch or vicfg-vswitch. By default, each ESXi host has one virtual switch, vSwitch0. You can create additional virtual switches or manage existing switches. See Setting Up Virtual Switches and Associating a Switch with a Network Interface.
8 (Optional) Make changes to the uplink adapter using esxcli network vswitch standard uplink or vicfg-nics. See Managing Uplink Adapters.
9 (Optional) Use esxcli network vswitch standard portgroup or vicfg-vswitch to add port groups to the virtual switch. See Managing Port Groups with vicfg-vswitch.
10 (Optional) Use esxcli network vswitch standard portgroup set or vicfg-vswitch to establish VLANs by associating port groups with VLAN IDs. See Setting the Port Group VLAN ID with vicfg-vswitch.
11 Use esxcli network ip interface or vicfg-vmknic to configure the VMkernel network interfaces. See Adding and Modifying VMkernel Network Interfaces.A virtual switch models a physical Ethernet switch. You can manage virtual switches and port groups by using the vSphere Web Client (see the vSphere Networking documentation) or by using vSphere CLI commands.You can create a maximum of 127 virtual switches on a single ESXi host. By default, each ESXi host has a single virtual switch called vSwitch0. By default, a virtual switch has 56 logical ports. See the Configuration Maximums document on the vSphere documentation main page for details. Ports connect to the virtual machines and the ESXi physical network adapters.
■
■ You can connect the uplink adapter to the virtual switches by using vicfg-vswitch or esxcli network vswitch standard uplink. See Linking and Unlinking Uplink Adapters with vicfg-vswitch.This section discusses working in a standard switch environment. See Networking Using vSphere Distributed Switches for information about distributed switch environments.
1
2
a
b
c
d You can retrieve information about virtual switches by using ESXCLI or vicfg-vswitch. Specify one of the options listed in Connection Options in place of <conn_options>.You can retrieve information about virtual switches by using esxcli network vswitch commands.The command prints information about the virtual switch, which might include its name, number of ports, MTU, port groups, and other information. The output includes information about CDP settings for the virtual switch. The precise information depends on the target system. The default port groups are Management Network and VM Network.You can retrieve information about virtual switches by using the vcifg-vswitch command. Specify one of the options listed in Connection Options in place of <conn_options>.
■ Check whether vSwitch1 exists.The command prints information about the virtual switch, which might include its name, number of ports, MTU, port groups, and other information. The default port groups are Management Network and VM Network.You can add and delete virtual switches with ESXCLI and with vicfg-vswitch.You can add and delete virtual switches using the esxcli network vswitch standard namespace. Specify one of the options listed in Connection Options in place of <conn_options>.After you have added a virtual switch, you can set switch attributes (Setting Switch Attributes with esxcli network vswitch standard) and add one or more uplink adapters (Linking and Unlinking Uplink Adapters with ESXCLI).You cannot delete a virtual switch if any ports on the switch are still in use by VMkernel networks or virtual machines. Run esxcli network vswitch standard list to determine whether a virtual switch is in use.You can add and delete virtual switches using the --add|-a and --delete|-d options. Specify one of the options listed in Connection Options in place of <conn_options>.After you have added a virtual switch, you can set switch attributes (Setting Switch Attributes with vicfg-vswitch) and add one or more uplink adapters (Linking and Unlinking Uplink Adapters with vicfg-vswitch).You cannot delete a virtual switch if any ports on the switch are still in use by VMkernel networks, virtual machines, or vswifs. Run vicfg-vswitch --list to determine whether a virtual switch is in use.You can set the maximum transmission unit (MTU) and CDP status for a virtual switch. The CDP status shows which Cisco switch port is connected to which uplink. Specify one of the options listed in Connection Options in place of <conn_options>.
■ You can set the maximum transmission unit (MTU) and CDP status for a virtual switch. The CDP status shows which Cisco switch port is connected to which uplink. Specify one of the options listed in Connection Options in place of <conn_options>.
■ You can use esxcli network vswitch standard portgroup to check, add, and remove port groups. Specify one of the options listed in Connection Options in place of <conn_options>.Network services connect to virtual switches through port groups. A port group allows you to group traffic and specify configuration options such as bandwidth limitations and VLAN tagging policies for each port in the port group. A virtual switch must have one port group assigned to it. You can assign additional port groups. Specify one of the options listed in Connection Options in place of <conn_options>.You can use vicfg-vswitch to check, add, and remove port groups.The command returns 0 if the specified port group is associated with the virtual switch, and returns 1 otherwise. Use vicfg-vswitch --list to list all port groups.You can manage uplinks and port groups with ESXCLI and with vicfg-vswitch.If your setup includes one or more port groups, you can associate each port group with one or more uplink adapters (and remove the association). This functionality allows you to filter traffic from a port group to a specific uplink, even if the virtual switch is connected with multiple uplinks. Specify one of the options listed in Connection Options in place of <conn_options>.If your setup includes one or more port groups, you can associate each port group with one or more uplink adapters (and remove the association). This functionality allows you to filter traffic from a port group to a specific uplink, even if the virtual switch is connected with multiple uplinks. Specify one of the options listed in Connection Options in place of <conn_options>.You can set the port group VLAN ID with ESXCLI and with vicfg-vswitch.Run vicfg-vswitch -l to retrieve information about VLAN IDs currently associated with the virtual switches in the network.Run esxcli network vswitch standard portgroup list to list all port groups and associated VLAN IDs.You can manage uplink adapters, which represent the physical NICs that connect the ESXi host to the network by using the esxcli network nics or the vicfg-nics command. You can also use esxcli network vswitch and esxcfg-vswitch to link and unlink the uplink.You can use vicfg-nics to list information and to specify speed and duplex setting for the uplink.You can use esxcli network nic to list all uplinks, to list information, to set attributes, and to bring a specified uplink down or up.The following example workflow lists all uplink adapters, lists properties for one uplink adapter, changes the uplink’s speed and duplex settings, and brings the uplink down and back up. Specify one of the options listed in Connection Options in place of <conn_options>.You can narrow down the information displayed by using esxcli network nic get --nic-name=<nic>.
Name of the NIC to configured. Must be one of the cards listed in the nic list command (required).
■ aui – Select aui as the device port
■ bnc – Select bnc as the device port
■ fibre – Select mii as the device port
■ mii – Select mii as the device port
■ tp – Select tp as the device port
■ external – Set the transceiver type to external
■ internal – Set the transceiver type to internal Set Wake-on-LAN options. Not all devices support this option. The option value is a string of characters specifying which options to enable.
■ p – Wake on phy activity
■ u – Wake on unicast messages
■ m – Wake on multicast messages
■ b – Wake on broadcast messages
■ a – Wake on ARP
■ g – Wake on MagicPacket
■ s – Enable SecureOn password for MagicPacket
1 The portgroup nic array is [vmnic1, vmnic0, vmnic3, vmnic5, vmnic6, vmnic7] and active-uplinks is set to three uplinks (vmnic1, vmnic0, vmnic3). The other uplinks are standby uplinks.
2
3 The new uplinks override the old set. The NIC array changes to [vmnic3, vmnic5, vmnic6, vmnic7]. vmnic0 and vmnic1 are removed from the NIC array and max-active becomes 2.If you want to keep vmnic0 and vmnic1 in the array, you can make those NICs standby uplinks in the command that changes the active uplinks.The following example workflow lists an uplink adapter’s properties, changes the duplex and speed, and sets the uplink to autonegotiate its speed and duplex settings. Specify one of the options listed in Connection Options in place of <conn_options>.
2
3 Set vmnic2 to autonegotiate its speed and duplex settings.When you create a virtual switch using esxcli network vswitch standard add, all traffic on that virtual switch is initially confined to that virtual switch. All virtual machines connected to the virtual switch can talk to each other, but the virtual machines cannot connect to the network or to virtual machines on other hosts. A virtual machine also cannot connect to virtual machines connected to a different virtual switch on the same host.You can use the following commands to list, add, and remove uplink adapters. When you link using ESXCLI, the physical NIC is added as a standby adapter by default. You can then modify the teaming policy to make the physical NIC active by running the command esxcli network vswitch standard policy failover set.The uplink adapters are returned in the Uplink item.When you create a virtual switch using vicfg-vswitch --add, all traffic on that virtual switch is initially confined to that virtual switch. All virtual machines connected to the virtual switch can talk to each other, but the virtual machines cannot connect to the network or to virtual machines on other hosts. A virtual machine also cannot connect to virtual machines connected to a different virtual switch on the same host.You can manage VMkernel NICs with ESXCLI (see Managing VMkernel Network Interfaces with ESXCLI) and with vicfg-vmknic (see Managing VMkernel Network Interfaces with vicfg-vmknic).You can configure the VMkernel network interface for IPv4 (see To add and configure an IPv4 VMkernel Network Interface for IPv4) or for IPv6 (see To add and configure a VMkernel Network Interface for IPv6) with ESXCLI. In contrast to vicfg-vmknic, ESXCLI does not support enabling vMotion.You can add and configure an IPv4 VMkernel NIC with ESXCLI. Specify one of the options listed in Connection Options in place of <conn_options>.You can specify the MTU setting after you have added the network interface by using esxcli network ip interface set --mtu.
2 Configure the interface as an IPv4 interface. You must specify the IP address using - -ip, the netmask, and the name. For the following examples, assume that VMSF-VMK-363 is a port group to which you want to add a VMkernel network interface.
1 Run esxcli network ip interface add to add a new VMkernel network interface.You can specify the MTU setting after you have added the network interface by using esxcli network ip interface set --mtu.
2 Run esxcli network ip interface ipv6 address add to configure the interface as an IPv6 interface. You must specify the IP address using - -ip and the name. For the following examples, assume that VMSF-VMK-363 is a port group to which you want to add a VMkernel network interface.
■ --enable-dhcpv6: Enables DHCPv6 on this interface and attempts to acquire an IPv6 address from the network.
■ --enable-router-adv: Use the IPv6 address advertised by the router. The address is added when the router sends the next router advert.You can configure the VMkernel network interface for IPv4 (see To add and configure an IPv4 VMkernel Network Interface with vicfg-vmknic) or for IPv6 (see To add and configure an IPv6 VMkernel Network Interface with vicfg-vmknic). Specify one of the options listed in Connection Options in place of <conn_options>.
1 Run vicfg-vmknic --add to add a VMkernel network interface.You must specify the IP address by using - -ip, the netmask, and the name. For the following examples, assume that VMSF-VMK-363 is a port group to which you want to add a VMkernel network interface.You can later use --disable-vmotion to disable vMotion for this VMkernel network interface.
1 Run vicfg-vmknic --add to add a VMkernel network interface.You must specify the IP address by using - -ip, the netmask, and the port group name. For the following examples, assume that VMSF-VMK-363 is a port group to which you want to add a VMkernel network interface.
■ DHCPV6 – Use DHCP IPv6 address. The VMkernel supports DHCP only for ESX/ESXi 4.0 and later.
■ AUTOCONF – Use the IPv6 address advertised by the router. If you create a VMkernel network interface with AUTOCONF, an address is assigned immediately. If you add AUTOCONF to an existing vmknic, the address is added when the router sends the next router advert.You can later use --disable-vmotion to disable vMotion again.vicfg-vmknic <conn_options> - -unset-ip <X:X:X::/X> VMSF-VMK-363