how to disable a NIC in centos
One liner? How about this as root?
echo "DEVICE=eth0" > /etc/sysconfig/network-scripts/ifcfg-eth0 && service network restart
It will remove the configuration for eth0 and replace it with something that is unconfigured.
In /etc/sysconfig/network-scripts/ifcfg-eth0
you need to have
ONBOOT=no
like MDMarra said but you also need to have
NM_CONTROLLED=no
or else the NetworkManager will boot the interface as it ignores the ONBOOT
setting. Unless you don't use NetworkManager but I think it is common.
In /etc/sysconfig/network-scripts/ifcfg-eth0
you need to change ONBOOT=
to no
and you can delete the lines for IPADDR
and NETMASK
.
After you copy the config file, you need to restart the network
daemon.