Solaris NIC Failure module
Submitted by TuxInvader on Fri, 02/23/2007 - 17:43
Solaris network cards are configured using modules which can be loaded and unloaded using the ifconfig command. These are streams modules, not kernel modules and are interface specific. One of the coolest modules supplied is ldterm, which can be used to simulate a NIC failure. Really handy for testing failover in cluster environments. Especially when you're not physically able to pull the cable out yourself.
To see the list of modules loaded on a nic in the system you would use the command:
ifconfig <device> modlist
And you can expect output similar to:
0. arp
1. ip
2. <nic driver>
As you can see the only modules we have loaded (apart from the driver) are arp and ip. Solaris has quite a few modules which can be installed to do things QOS and Firewalling. The module we're interested in is ldterm though which enables you to effectively kill the nic. You need to add it immediately before the nic driver, and all it does is terminate the stream processing so that packets don't get processed past the nic driver. We insert the module with the following command:
ifconfig <device> modinsert ldterm@2
Once you've finished testing the failure you can remove the failure module with:
ifconfig <device> modremove ldterm@2
It's that simple. Remember it's a Streams module and not a kernel module. Also you will need to be able to remove the driver, so don't insert this module in your only interface when the server is 1000 miles away ;-) Not unless you have a cron job ready to remove the module once the test completes anyway!