I have a task here where I need to write a script to disable one of my NIC when it checks certain event. Till now I am not able to find a way to do this, because, it should be persistent though restart of services as well as reboots.
I have tested putting it in rc.local, but it doesn't work.
Sorry for the delay, this is for RHEL 6.6, we want to suppress card for non DB machines, but can do it after building only. I don't want to do misconfiguration in ifcfg-eth* files. Any alternative approach would be better.
If boot time is good enough, udev may be a way to go, it can rename the device into something which does not match the entries in your network configuration. Make sure the network config is set to not automatically do DHCP on unknown devices.
Misconfiguration here, can look like: if I want to disable eth1 card, then I can empty ifcfg-eth1 file, and just keep DEVICE=eth1 , and then restart Network services.