VMware Cloud Community
cgwalsh
Contributor
Contributor
Jump to solution

configure vswitch from cli

I have a problem with reconfiguring a vswitch from cli.

I have looked at the KB article entitled

"Configuring vSwitch or vNetwork Distributed Switch from the command line in ESX/ESXi 4.x"

However, when i access the cli through tech support mode & type the comand

esxcfg-vswitch -U <vmnic> <vSwitch> #unlink an uplink

the command is not recognised!

the doc does not tell me if i need to be in another directory.

I am not very proficient with the OS.

Can someone help me out please?

Thanks

Colin

Reply
0 Kudos
1 Solution

Accepted Solutions
djciaro
Expert
Expert
Jump to solution

its esxcfg NOT esx-cfg

If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!

View solution in original post

Reply
0 Kudos
33 Replies
djciaro
Expert
Expert
Jump to solution

Could you copy the exact command that you entered please

using the esxcfg-vswitch command we can manage the vSwitch

the syntax for removing an uplink is:  -U|--unlink=pnic            Remove pnic from the uplinks for the vswitch.

first check you switch by using the following command

~ # esxcfg-vswitch -l
you should get an output indicating the name, number of ports, used ports, configured ports, the MTU size and the physical uplinks
example>
Switch Name      Num Ports   Used Ports  Configured Ports  MTU     Uplinks
vSwitch1              128              3                128                    1500    vmnic1

so if I wanted to remove vmnic1 from this switch I would use the following command>

esxcfg-vswitch -U vmnic1 vSwitch1

and if I wanted to add the link I would use the following command>

esxcfg-vswitch -L vmnic1 vSwitch1

If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!
cgwalsh
Contributor
Contributor
Jump to solution

Hi,

    Thanks for the reply, the problem i have now is that the host is disconnected from vCenter server.

I connected to vMA & i can see the switch but cannot access to make changes.

[vi-admin@onivma ~]$ vicfg-vswitch --sessionfile ~/myfile --vihost oniesx006.oni.co.uk -d vSwitch0
Unable to communicate with the remote host, since it is disconnected.

I am trying to connect via UCS manager to try the commands you posted again.

Colin

Reply
0 Kudos
rickardnobel
Champion
Champion
Jump to solution

cgwalsh wrote:

However, when i access the cli through tech support mode & type the comand

esxcfg-vswitch -U <vmnic> <vSwitch> #unlink an uplink

Which version of ESXi are you using? 4.0, 4.1 or 5.0?

If you lost access to the managment network you could also use the DCUI to connect a VMNIC to the vSwitch0 for management. That might be easier.

My VMware blog: www.rickardnobel.se
Reply
0 Kudos
cgwalsh
Contributor
Contributor
Jump to solution

ESXi 4.0

It is from DCUI that i have an issue with the commands.

i need to get connectivty restored to the host, although there are no VMs on there yet.

1869731.png

Reply
0 Kudos
djciaro
Expert
Expert
Jump to solution

its esxcfg NOT esx-cfg

If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!
Reply
0 Kudos
djciaro
Expert
Expert
Jump to solution

lets assume you have one physical nic on your ESX then that will be called vmnic0, if you have one vSwitch it will be called vSwitch0

so first check if you have an uplink

type esxcfg-vswitch -l  to list your vSwitch

if you have no vmnic or are missing the one that you want to use for the management network then you need to add it by using the following command:

esxcfg-vswitch -L vmnic0 vSwitch0      ----- replace 0 in vmnic0 with your vmnic and same for the switch replace 0 in vSwitch0 for your switch no.

If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!
Reply
0 Kudos
cgwalsh
Contributor
Contributor
Jump to solution

I feel a bit stupid now !

anyway, the problem i have is that i need to reassign both the vmnics to the exisitng dvswitch, to get connectivity back to the host.

using  the command esxcfg-vswitch -P <vmnic> -V <unused dvPort ID> <dvSwitch>  where do i find the value for the unused dvPort ID?

Thanks in advance!

Reply
0 Kudos
cgwalsh
Contributor
Contributor
Jump to solution

What i am trying to do is replace the dvswitch with a vswitch, so i can install the Nexus 1000v.

I have attached both of the vnics to the virtual switch, but cannot access it.

I think i am missing a vmkernel port on the vswitch.

So can i create the vmkernel for the vswitch via cli, or should i re-connect the vmnics to the dvswitch?

Reply
0 Kudos
djciaro
Expert
Expert
Jump to solution

To be honest i would offer the following piece of advice, try and understand how a standard vSwitch works before moving to to configure a dvSwitch, thats not meant to offend just a piece of advice, its like trying to run before you can walk.

to change uplinks to a dvSwitch you need to use the following command

esxcfg-vswitch -P <vmnic> -V <unused dvPort ID> <dvSwitch> #add a DVS uplink

for example

esxcfg-vswitch -P vmnic1 -V 1 dvSwitch-VMnetwork

If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!
cgwalsh
Contributor
Contributor
Jump to solution

struggling with the commands...

1869731_1.png

Reply
0 Kudos
djciaro
Expert
Expert
Jump to solution

Have a look at these

and this
If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!
Reply
0 Kudos
cgwalsh
Contributor
Contributor
Jump to solution

The dvswitch was configured & working.

The issue is that to install the Nexus 1000v the switches need to be standard not dv.

so what i was trying to do was create a standard switch & use that instead of the dvswitch.

however i forgot to create the vmkernel port in the management vlan (this is the same as the vlan interface on a switch as i undeerstand it) & have lost connectivity.

I need to get back onto the host via either the vswitch or dvswitch!

thanks

Reply
0 Kudos
djciaro
Expert
Expert
Jump to solution

can you post the results of

esxcfg-vswitch -l
If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!
Reply
0 Kudos
cgwalsh
Contributor
Contributor
Jump to solution

1869731_2.png

Reply
0 Kudos
cgwalsh
Contributor
Contributor
Jump to solution

OK i have the following vmkernel ports configured, i just need to get the assigned to the vswitch on both nics!

1869773.png

Reply
0 Kudos
djciaro
Expert
Expert
Jump to solution

ok so you have vmnic0 and vmnic1 connected to de dvSwitch and no uplinks for the management network on vSwitch1

if you want to use one of the 2 nics already in use then you need unlink from dvSwitch and add to vSwitch

esxcfg-vswitch -Q vmnicX -V <dvPort ID of vmnic> <dvSwitch> #unlink a DVS uplink

esxcfg-vswitch -L vmnicX vSwitch1

If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!
Reply
0 Kudos
cgwalsh
Contributor
Contributor
Jump to solution

i thought i done that, don't i need to add a vmkernel port to the vswitch next on vlan 55?

1869773_1.png

Reply
0 Kudos
cgwalsh
Contributor
Contributor
Jump to solution

i need to confirm the portgroup name for vlan 55, see the following

1869773_2.png

Reply
0 Kudos
djciaro
Expert
Expert
Jump to solution

I'd suggest you restore the stand switch and setup you dvSwitch again from the beginning with all of the steps clearly documented before starting.

Procedure
1 From the direct console, select Restore Standard Switch and press Enter.
If the host is already on a standard switch, this selection is grayed-out, and you cannot select it.
2 Press F11 to confirm.
If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!
Reply
0 Kudos