VMware Cloud Community
admin
Immortal
Immortal

bind vmnic to vSwitch

I have my host running with ESX 3.5 and 5 network ports showing the uplink. They are named as vmnic0 to vmnic4. When I try to remove the unlink vmnic0 from vSwtich0 it shows as no such uplink. But I could see vmnic0 to vmnic4 when i give esxcfg-nics -l.

Below given is output.

esxcfg-vswitch -U vmnic0 vSwitch0

No such uplink

esxcfg-vswitch -L vmnic1 vSwitch0

Segmentation Fault

Can someone tell me how to fix this problem?

Thanks!

Reply
0 Kudos
13 Replies
RParker
Immortal
Immortal

What does ifconfig show?

Also are you sure that the vmnic1 doesn't belong to another switch already?

Also what is the output of esxcfg-vswitch -l

Reply
0 Kudos
benbjamin24
Enthusiast
Enthusiast

I've ran into the same problem, it occured after I was trying to add a 2 pnics to a vswitch and it crashed. now i can't do anything with this vswitch. I haven't tried to delete the switch and recreate it but that might be next step.

when i run the command esxcfg-vswitch -l it shows that no nics are connected.

later

b

Ben VCP
Reply
0 Kudos
NTurnbull
Expert
Expert

What does your esx.conf show for the vswitches? Look for the lines:

/net/vswitch/child[0000]/name = "vSwitch0" For the child is the ID of each vswitch

/net/vswitch/child[0000]/teamPolicy/uplinks[0000]/pnic = "vmnic0"

/net/vswitch/child[0000]/uplinks/child[0000]/pnic = "vmnic0"

Does the configuration in the esx/conf match what is shown in VC?

Thanks,

Neil

Thanks, Neil
Reply
0 Kudos
p2k
Enthusiast
Enthusiast

I have the same problem. Here the relevant lines from esx.conf:

/net/vswifs/vswif0 = "/etc/sysconfig/network-scripts/ifcfg-vswif0"

/net/vswitch/child[0000]/beacon/enable = "false"

/net/vswitch/child[0000]/beacon/threshold = "1"

/net/vswitch/child[0000]/beacon/timeout = "1"

/net/vswitch/child[0000]/capabilities/ChecksumOffload = "true"

/net/vswitch/child[0000]/capabilities/ScatterGatherTx = "true"

/net/vswitch/child[0000]/capabilities/TcpSegmentationOffload = "true"

/net/vswitch/child[0000]/capabilities/VlanTag = "true"

/net/vswitch/child[0000]/capabilities/VlanUntag = "true"

/net/vswitch/child[0000]/cdp/status = "listen"

/net/vswitch/child[0000]/name = "vSwitch0"

/net/vswitch/child[0000]/numPorts = "64"

/net/vswitch/child[0000]/portgroup/child[0000]/name = "Service Console"

/net/vswitch/child[0000]/portgroup/child[0000]/vlanId = "33"

/net/vswitch/child[0000]/portgroup/child[0001]/name = "VM Network"

/net/vswitch/child[0000]/portgroup/child[0001]/vlanId = "33"

/net/vswitch/child[0000]/securityPolicy/forgedTx = "true"

/net/vswitch/child[0000]/securityPolicy/macChange = "true"

/net/vswitch/child[0000]/securityPolicy/promiscuous = "false"

/net/vswitch/child[0000]/shapingPolicy/enabled = "false"

/net/vswitch/child[0000]/teamPolicy/linkCriteria/beacon = "ignore"

/net/vswitch/child[0000]/teamPolicy/linkCriteria/fullDuplex = "ignore"

/net/vswitch/child[0000]/teamPolicy/linkCriteria/minSpeed = "10"

/net/vswitch/child[0000]/teamPolicy/linkCriteria/pctError = "ignore"

/net/vswitch/child[0000]/teamPolicy/maxActive = "2"

/net/vswitch/child[0000]/teamPolicy/notifySwitch = "true"

/net/vswitch/child[0000]/teamPolicy/reversePolicy = "true"

/net/vswitch/child[0000]/teamPolicy/rollingRestoration = "false"

/net/vswitch/child[0000]/teamPolicy/team = "lb_ip"

/net/vswitch/child[0000]/teamPolicy/uplinks[0000]/pnic = "vmnic1"

/net/vswitch/child[0000]/uplinks/child[0001]/pnic = "vmnic1"

I also see the SegFault when I want to add another nic:

# esxcfg-vswitch -L vmnic0 vSwitch0

Segmentation fault

Reply
0 Kudos
Texiwill
Leadership
Leadership

Hello,

Please run the following:

esxcfg-vmknics -l

esxcfg-nics -l

esxcfg-vswitch -l

Are you trying to reassign something already assigned? The above commands will tell us what ESX sees in your host and how they are currently assigned.


Best regards,
Edward L. Haletky
VMware Communities User Moderator
====
Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education.
Blue Gears and SearchVMware Pro Blogs -- Top Virtualization Security Links -- Virtualization Security Round Table Podcast

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
Reply
0 Kudos
pborkstrom
Contributor
Contributor

Has anyone found a solution for this?

esxcfg-vswif -l

vswif0 Service Console 192.168.1.4 255.255.255.0 192.168.1.255 true false

esxcfg-vmknic -l

vmk2 VMkernel 1.2.3.6 192.168.1.5 255.255.255.0 192.168.1.255 00"2a:65:8a"ff 1500 40960 true

esxcfg-nics -l

vmnic0 (link up)

vmnic1 (link up)

esxcfg-vswitch -l

vSwitch0 64 3 64 1500 (nothing in uplinks)

PortGroup Name

VMkernel 0 1 (no uplinks)

Service Console 0 1 (no uplinks)

Reply
0 Kudos
benbjamin24
Enthusiast
Enthusiast

I had to remove the old vswitch and then recreate the vswitch in the command line on the ESX host.

Ben

VCP

Ben VCP
Reply
0 Kudos
posix99
Contributor
Contributor

I had similar problems, always got "segment fault" no matter what i did. Tried to remove the port groups, deleting the vswitch without sucess.

The solution was to create a temporary vswif, then assign one of the vnics, a new static ip address.

Fixing the route table, to reflect the new ip address change (ie; remove the route the old ip had).

Creating a temporary vswitch and a temp portgroup.

Adding the vmnic as an uplink to the temp vswitch.

Checking IP connectivity with the public vlan (or other network you have).

Then open the infrastructure client on the administration machine, but this time pointing it to the temporary IP address.

Now, once you have control over the esx server, configure the original vswitch with the second (or other) vnic to have access once again.

After all that, move the temp vnic to the original vswitch, remove the temp ip, remove the temp vswitch.

A bit complicated, but that was the only way to solve it on my case, other than reinstalling esx from installation media :smileycool:

Reply
0 Kudos
pborkstrom
Contributor
Contributor

I made a post on Experts-Exchange and got a SWEET response. Here is the walkthrough - Delete Service Console, VMkernel portgroups (port groups), vSwitch, & rebuild it:

Delete your vswif and vmknic interfaces by using the following commands

esxcfg-vswif -d vwswif0 (or whatever it’s called)

esxcfg-vmknic -d vmk0 (or whatever it’s called)

Then delete your port groups

esxcfg-vswitch -D "VMKernel" (or whatever it’s called)

esxcfg-vswitch -D "Service Console" (or whatever it’s called)

Then delete your vswitches

esxcfg-vswitch -d vSwitch0 (or whatever it’s called)

Now you should have a 'blank' networking config.

Now run the reset options for

esxcfg-vswitch -r

esxcfg-vmknic -r

esxcfg-vswif0 -r

Verify everything is gone (esxcfg-vswitch/vmknic/vswif -l), then create everything again:

Create the vswitches

esxcfg-vswitch -a vSwitch0

esxcfg-vswitch -a vSwitch1

Create your port groups

esxcfg-vswitch -A "Service Console" vSwitch0

esxcfg-vswitch -A "VMKernel" vSwitch0

excfg-vswitch -A "ProdNet" vSwitch1

Now create the uplinks

esxcfg-vswitch -L vmnic0 vSwitch0

esxcfg-vswitch -L vmnic1 vSwitch1

If this all works with no issues, then run an esxcfg0vswitch -l to see what it looks like.

Now recreate the vswif interface

esxcfg-vswif -a vswif0 -p "Service Console" -i 192.168.1.4 -n 255.255.255.0

Now recreate the vmkernel interface

esxcfg-vmknic -a "VMKernel" -i 192.168.1.5 -n 255.255.255.0

Run esxcfg-vswitch -l to verify your vswitch config.

Lastly, associate uplinks to your vSwitches

esxcfg-vswitch -L vmnic0 vSwitch0

esxcfg-vswitch -L vmnic1 vSwitch1

Helped me a ton. Basically, you destroy what you have and rebuild it.

Reply
0 Kudos
pizmooz
Contributor
Contributor

In my experience this happens when you replace a NIC in a server. If the new NIC gets assigned the same vmnic # as the old NIC it corrupts the vswitch which that vmnic was uplinked to, and you cannot operate on it. As you said you are forced to destroy the vswitch and rebuild it. You can avoid this by unlinking the vmnic you are going to replace from it's respective vswitch before you shutdown. In fact any time you reorder or add devices to the PCI bus, I would unlink all vmnics from vswitchs, as there is a possibility that the vmnic enumeration could get jumbled. Since Unlinking/Linking is fairly painless this shouldn't be too big of a deal.

Reply
0 Kudos
pborkstrom
Contributor
Contributor

If you're like me, you can do this if you mess with the service console. I tried to assign the SC to another NIC in a different vSwitch w/o adding one and removing the old one. Either way, it's nice to have a quick guide handy to help get you up and running in a hurry.

Reply
0 Kudos
harunsahiner
Contributor
Contributor

I've applied the above command.. smooth running.

thanks ,

http://harunsahiner.blogspot.com
Reply
0 Kudos
admin
Immortal
Immortal

Excellent post -- keeping the proper order of these things straight while working in the cli can be maddening Smiley Happy

Two small things -- the esxcfg-vswtch -D <portgroup> commands also require the vSwitch as an arg: esxcfg-vswtch <vswitch> -D <portgroup>

And a typo: 'esxcfg-vswif0 -r' should be 'esxcfg-vswif -r'

My situation was odd -- I ran a fresh install of vSphere4 on a brand new machine.

For some reason the Service console came up 127.0.0.1 when I chose DHCP just to get through setup.

DHCP worked fine for the one I previously built - (otherwords, DHCP works) - just not the next two.

I ran your steps afterwards to reconfigure the whole mess using a static - worked like a champ.

Chris at Homeaway dawt calm

Reply
0 Kudos