How to physically shut off network interface in Linux (Redhat/Centos)

12,962

Solution 1

unfortunately it doesn't exist a general way in linux.

In the networking world it is very common to toggle a port "Cisco: shut / no shut, Juniper disable/enable" to identify or trigger autonegotiation.

In Linux you have to rely on the individual driver for your network card.

Solution 2

This works for my Intel I219-V (e1000e) card. No link light or anything, totally dead:

echo 1 > /sys/devices/pci0000:00/0000:00:1f.6/remove

But when I do the same for a realtek (r8169) card, it still has a link light.

It may be something you cannot control on certain cards or perhaps there's something in the driver code that can be tweaked if you're into such things. That would be my next step if I were really determined.

Share:
12,962

Related videos on Youtube

Mike S
Author by

Mike S

Updated on September 18, 2022

Comments

  • Mike S
    Mike S over 1 year

    Is there any way to shut off a network interface on a Linux box from the command line? By shut off, I mean to make the link power down as per a Cisco switch's "shutdown" command. ip, and ifconfig and even rmmod <driver> when used to bring a port down do not disconnect link; the device on the other end still sees a connection even when one disables a port using those utilities/methods.

    Technically, at a device level I'm sure it can be done because when I perform

    ip link set em1 down
    ip link set em1 up
    

    ...then during the "up" phase, the NIC does go off for about 3-4 seconds (as seen on a switch's port cabled to that NIC, and on the port's status LED).

    What I'm looking for is a command line utility that will perform the task. I have CentOS 7.2 on a Dell R610 using the onboard Broadcom nics.

  • DustWolf
    DustWolf almost 7 years
    Only seems to exist on very specific interfaces
  • Pablo Lalloni
    Pablo Lalloni about 5 years
    Thanks for this answer! Worked great for my Lenovo x230's ethernet NIC which was wasting much power on doing nothing.