Put alias eth0 off in /etc/modprobe.conf. This will make sure that nothing in the system can use it ever. It won't even be able to be brought up manually.
As far as I know, the correct way is to simply turn it off using the "ONBOOT" directive and to achieve that through a script you can use the following line:
sed -i 's/^ONBOOT.*/ONBOOT=no/g' /etc/sysconfig/network-scripts/ifcfg-eth0 && service network restart
in case you have not found out yet...
ifconfig down or up. The old ifconfig command still allows you to do plumbing /bringing a interface up or down or other options. Use to be all there was to use when Redhat first came out.
One liner? How about this as root?
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 havelike MDMarra said but you also need to have
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 changeONBOOT=
tono
and you can delete the lines forIPADDR
andNETMASK
.After you copy the config file, you need to restart the
network
daemon.No need to restart the network daemon, especially if you have other network cards that are in use. You can just do a 'ifdown eth0'.
Put
alias eth0 off
in/etc/modprobe.conf
. This will make sure that nothing in the system can use it ever. It won't even be able to be brought up manually.As far as I know, the correct way is to simply turn it off using the "ONBOOT" directive and to achieve that through a script you can use the following line:
There is another one option for inexperienced people (like me). go at www.webmin.com download and install webmin.
configure your server via a web based environment.
in case you have not found out yet... ifconfig down or up. The old ifconfig command still allows you to do plumbing /bringing a interface up or down or other options. Use to be all there was to use when Redhat first came out.
sed -i 's/^ONBOOT.*/ONBOOT=no/g' /etc/sysconfig/network-scripts/ifcfg-eno2 && service network restart
For making it persistent.
chattr +i /etc/sysconfig/network-scripts/ifcfg-eno2