Stay Connected
Posts tagged vlan
ESX: esxcfg-vswitch and special vlan switch
Jun 12th
If you need to create 5 or more of Virtual Port groups on a vSwtich and you don’t want to use the VI client than logon on the service console and run the commands below.
For creating a new Virtual Port Group use:
Assigning a special VLAN to this a Virtual Port Group:
With these two simple commands I was able to push my sh script and create same “Networking” configuration on dozen of my ESX servers.
[root@ESX-02 root]# esxcfg-vswitch -A VLAN283 vSwitch0
[root@ESX-02 root]# esxcfg-vswitch -A VLAN284 vSwitch0
[root@ESX-02 root]# esxcfg-vswitch -A VLAN285 vSwitch0
[root@ESX-02 root]# esxcfg-vswitch -A VLAN299 vSwitch0
[root@ESX-02 root]# esxcfg-vswitch -A VLAN220 vSwitch0
[root@ESX-02 root]# esxcfg-vswitch -v 282 -p VLAN282 vSwitch0
[root@ESX-02 root]# esxcfg-vswitch -v 283 -p VLAN283 vSwitch0
[root@ESX-02 root]# esxcfg-vswitch -v 284 -p VLAN284 vSwitch0
[root@ESX-02 root]# esxcfg-vswitch -v 285 -p VLAN285 vSwitch0
[root@ESX-02 root]# esxcfg-vswitch -v 299 -p VLAN299 vSwitch0
[root@ESX-02 root]# esxcfg-vswitch -v 220 -p VLAN220 vSwitch0
esxcfg-vswitch [options] [vswitch[:ports]]
-a|–add Add a new virtual switch.
-d|–delete Delete the virtual switch.
-l|–list List all the virtual switches.
-L|–link=pnic Set pnic as an uplink for the vswitch.
-U|–unlink=pnic Remove pnic from the uplinks for the vswitch.
-M|–add-pg-uplink Add an uplink to the list of uplinks for a portgroup
-N|–del-pg-uplink Delete an uplink from the list of uplinks for a portgroup
-p|–pg=portgroup Specify a portgroup for operation
Use ALL to set VLAN IDs on all portgroups
-v|–vlan=id Set vlan id for portgroup specified by -p
0 would disable the vlan
-c|–check Check to see if a virtual switch exists.
Program outputs a 1 if it exists, 0 otherwise.
-A|–add-pg=name Add a new portgroup to the virtual switch.
-D|–del-pg=name Delete the portgroup from the virtual switch.
-C|–check-pg=name Check to see if a portgroup exists. Program
outputs a 1 if it exists, 0 otherwise.
-B|–set-cdp Set the CDP status for a given virtual switch.
To set pass one of “down”, “listen”, “advertise”, “both”.
-b|–get-cdp Print the current CDP setting for this switch.
-m|–mtu=MTU Set MTU for the vswitch.
-r|–restore Restore all virtual switches from the configuration file
(FOR INTERNAL USE ONLY).
-h|–help Show this message.
VMWare ESX3i Cisco CDP protocol L2 overview
Feb 6th
Cisco Discovery Protocol (CDP) allows ESX Server 3 administrators to determine which Cisco switch port is connected to a given vSwitch. When CDP is enabled for a particular vSwitch, you can view properties of the Cisco switch (such as device ID, software version, and timeout) from the VI Client. You can use the service console command-line interface to enable CDP.
Using this information and without going to the server room and locating the network cable in the rack I was able to configure the interface on the switch real time.
The switchport should be set as trunk and for security reasons also configure the allowed vlan’s.
interface GigabitEthernet0/15
description ** ESX-01 Trunk port LAN **
switchport trunk allowed vlan 1,200
switchport mode trunk
spanning-tree portfast
!
Hyper-V and Cisco VLAN config
Jan 16th
Configure the Cisco switch port with the allowed vlans. In my example I installed the Hyper-V box in the default 1 vlan and I have separated vlan 2200 for my lab environment.
Login into the Cisco Switch, go into privileged mode and open the configuration terminal. Enter or paste the configuration below.
interface GigabitEthernet0/1
description ** Uplink to Hyper-V windows box **
switchport trunk allowed vlan 1,2200
switchport mode trunk
spanning-tree portfast
!
In the Virtualization Management console I configured and installed new guest partition with Windows Server 2003. There seems to be an issue with the current vm additions and my setup so the nic controller is not working. I removed current nic controller and added legacy network adapter.
In the legacy network adapter, check enable virtual LAN identification and enter the VLAN ID. Click ok or Apply the configuration.
This is really cool feature now integrated with Hyper-V. ESX supported VLAN’s for while and Microsoft is catching up now in the upcoming release of their hyper visor product.

