2

I am trying to simulate disconnecting the network cable from a pi.

So how do I invoke this? I've tried ifdown / ifup in various different forms.

When I say simulate, you may ask yourself on what level. All, the system must behave as though there has been a break at layer 1 OSI(physical).

Now maybe I sound a bit too stringent in my question, I don't want to go touching drivers and anything on the kernel level.

What I have so far is this, and my ultimate question is: I have a console cable to my cisco router. It has a switch EHWIC card, to which my pi is connected, to one of the ports.

From pi in terminal:

sudo ifconfig eth0 down
sudo ifconfig eth0 up

And the router reports the interface goes down on layer 3 and layer 2. and then up again. Is this the closest I am going to get?

0
2

Is this the closest I am going to get?

Going about it this way, yes. The up/down state of a network interface may change as the consequence of a layer 1 event, but it obviously isn't in itself. It's a data link/network layer concern.

I would look into powering off the ethernet controller, which is also the USB controller:

Disable LAN9512

Glancing through /sys on a B+ running a current kernel (4.9.30+) it looks like this stuff has changed a bit; look in /sys/devices/platform/soc/20980000.usb; buspower and bussuspend are writable. The problem then is how to input to the Pi with the USB and ethernet turned off.

1
  • this sounds like a feasible solution for me actually. It's a power down and up I am looking for and it can be controlled with a delay in between. Thank you for your reply, power off the USB controller, I never looked at that way :)
    – JamesGohl
    Jul 9 '17 at 18:27
1

I seriously doubt there is a way to simulate a physical break using software only. You will probably have to resort to disconnecting the physical cable or installing smell kind of physical switch in the cable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.