How can I enable or disable an Ethernet interface in Linux?

How can I enable or disable an Ethernet interface in Linux?


The ifup and ifdown commands can be used respectively to activate and deactivate a NIC interface. You must have an ifcfg file in the /etc/sysconfig/network-scripts directory for these commands to work.

Here is an example for interface eth0:

To shutdown eth0:
[root@linux etc]# ifdown eth0

To enable eth0:
[root@linux etc]# ifup eth0

To make the change permanent, modify the interface config in the /etc/sysconfig/network-scripts directory. It will be named ifcfg-[interface], i.e. ifcfg-eth0 for Ethernet 0.

Open the file in your favorite editor and change:

ONBOOT=yes

to

ONBOOT=no

No comments:

Post a Comment