2

What's the difference between ifconfig eth0 down and physically unplugging eth0 cable? Do they mean the same thing to an application?

Edit:

I have an application that uses a specific interface let's say eth0 and it crashes if I do ifconfig eth0 down and then back ifconfig eth0 up. Ideally the application should resume but it crashes. On the other hand, if I just unplug the eth0 cable, the application is still running but there is no incoming data and if I plug the cable back again the data stream resumes. Also when I run ifconfig command (after unplugging the cable), the output of ifconfig still shows eth0 as up. However ifconfig eth0 downremoves the interface all together. One more thing, the routes are deleted as well incase of an ifconfig eth0 down but not in case of unplugging the cable. So I am guessing unplugging the cable physically is not the same as using the command ifconfig eth0 down. Correct me if I am wrong. Is there a way to simulate an ethernet cable being unplugged? Apart from adding a rule in iptables and dropping the traffic altogether.

umar14
  • 23
  • 1
  • 7

1 Answers1

1

Do both to a test host and see what happens. As IP packets are higher level than either of them, your connectivity may be impacted. Unless your host has interface level redundancy.


Administratively down is a thing for interfaces, including Linux. From https://www.kernel.org/doc/Documentation/networking/operstates.txt

Linux distinguishes between administrative and operational state of an interface. Administrative state is the result of "ip link set dev up or down" and reflects whether the administrator wants to use the device for traffic.

However, an interface is not usable just because the admin enabled it - ethernet requires to be plugged into the switch and, depending on a site's networking policy and configuration, an 802.1X authentication to be performed before user data can be transferred. Operational state shows the ability of an interface to transmit this user data.

Also, stop using ifconfig on Linux, it has been obsolete for almost two decades. As the documentation implies, ip command (iproute package) is what to use, it also has commands for the link level.

John Mahowald
  • 30,009
  • 1
  • 17
  • 32