I was installing a new ESX Host today, and before putting it into Production, I wanted to test that the Network Failover was working correctly.
Now instead of going over to the server and pulling out network cables, I started to think, there must be a way to do this (like all good administrators do) from the comfort of my desk.
Easiest would be – Log into the switch and shutdown the port. I agree, but what happens when your the Virtualization Team do not control the Physical network (my situation)? That was not an option.
I started to look if I could bring the interface down.
With regular Linux you would –
[[email protected] ~]# ifdown eth0 usage: ifdown <device name>
So that did not work! Pretty obvious why though… There is no eth0 interface.
[[email protected] ~]# ifconfig lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:784233 errors:0 dropped:0 overruns:0 frame:0 TX packets:784233 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:3017478364 (2877.6 Mb) ...:3017478364 (2877.6 Mb) vmnic0 Link encap:Ethernet HWaddr 00:1A:64:E5:31:38 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:6602129 errors:0 dropped:0 overruns:0 frame:0 TX packets:237757 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1130250120 (1077.8 Mb) ..es:195027359 (185.9 Mb) Interrupt:113 Memory:92000000-92012100 vmnic1 Link encap:Ethernet HWaddr 00:1A:64:E5:31:3A UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:505 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:303685 (296.5 Kb) TX bytes:0 (0.0 b) Interrupt:201 Memory:94000000-94012100 vswif0 Link encap:Ethernet HWaddr 00:50:56:4C:43:11 inet addr:188.8.131.52 Bcast:184.108.40.206 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2490053 errors:0 dropped:0 overruns:0 frame:0 TX packets:260404 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:664363188 (633.5 Mb) TX bytes:196222902 (187.1 Mb)
So I tried..
[[email protected] ~]# ifdown vmnic0 usage: ifdown <device name>
And that did not work either.
I did not want to shutdown the whole vSwitch – because then I would lose the connectivity (of course there is the possibility of creating the second Service Console – but this was not the case here)
The only way to do this is to manipulate the NIC’s directly. So what can you do with the physical NIC’s?
[[email protected] ~]# esxcfg-nics esxcfg-nics <options> [nic] -s|--speed <speed> Set the speed of this NIC to one of 10/100/1000/10000. Requires a NIC parameter. -d|--duplex <duplex> Set the duplex of this NIC to one of 'full' or 'half'. Requires a NIC parameter. -a|--auto Set speed and duplexity automatically. Requires a NIC parameter. -l|--list Print the list of NICs and their settings. -r|--restore Restore the nics configured speed/duplex settings (INTERNAL ONLY) -h|--help Display this message.**
So you cannot shut down the device, but you do the next best thing – set it to 10 Half-Duplex.
That will bring the port down.
[[email protected] ~]#esxcfg-nics -s 10 -d half vmnic2
And to bring it back up
[[email protected] ~]#esxcfg-nics -a vmnic2
Now unless there is a good reason – your ports should always be set to Auto-Negotiate, and in this casem when the nic was reset to auto – then it came back up without any issues.
The failover worked – so my experiment was successful.
Some might call it being a lazy Bum – I call it being a Good Administrator!!
Hope you enjoyed the ride!