8

I am working from home on remote embedded Linux machine "X" via ssh. It has one physical network card.

I need to simulate Ethernet cable unplugged condition on the same remote machine "X" , while stay connected/working on it.

req1. ~The network oriented applications on "X" will "believe" they're disconnected as if I was unplugging the card in production scenario.

req2. I will be able to continue my remote (SSH) session although the situation in req1.

The remote box "X" uses systemd to load userland. if that's relevant.

Although I can plug "X" using serial port to another computer, into which I can remote from home, it won't solve my problem.

I've read the (PSB) following articles but I can't seem to combine them all into working solution.

Thanks!

virtual tap/tun here: http://backreference.org/2010/03/26/tuntap-interface-tutorial/

iproute2 features: http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2

virtual interface aliasing: https://serverfault.com/questions/83234/how-do-i-create-a-linux-virtual- network-interface-alias-with-a-real-interface?rq=1

forward traffic: Forward traffic coming into dummy interface on to another interface(?)

11
  • 2
    You would need to establish firewall rules that block the connections that you wish to test while making sure not to block your own. May 14, 2016 at 23:28
  • 1
    @ReuelitBatPatish Have you had a look at network namespaces? lwn.net/Articles/580893 They're the perfect tool to do network tests like disconnection and the like.
    – lgeorget
    May 15, 2016 at 9:02
  • 2
    @ReuelitBatPatish: If your applications can distinguish between a disconnected cable and a connection blocked by the firewall, they're focusing on the wrong things. Jun 9, 2016 at 3:51
  • 2
    @ReuelitBatPatish: Your main problem is that you impose yourself unrealistic limitations. Keeping an active connection while the low level media status gets changed is plainly impossible (other than a kernel hack which would be quite complicated and would not reflect a normal system). Jun 9, 2016 at 5:10
  • 1
    Without physical access, you could schedule a batch of tests that you could start and would output the different results in a file. At the end of that script, you put rules to ensure you get your access back :) Jun 9, 2016 at 5:17

2 Answers 2

1

Use aliases look as best possible hit. But in this configuration only "interface down" situation can be simulated. Look impossible to clean simulate "Link down" situation.

For full test, management connection over serial port rather ssh can be used.

Your WS <-ssh-> Neighbor_to_testhost <-serial-> Test_Host
0

You don't say what kind of embedded device it is, but if it has an Intel IME then it might have IPMI which lets you connect on a different IP address and get a virtual serial connection.

If it's a tiny embedded device, you can usually run a cable from the JTAG header to a Raspberry Pi that you have configured as a terminal server with a USB to serial interface, ssh to the Raspberry Pi, then use e.g. 'screen /dev/ttyUSB0' to connect to the JTAG interface.

That way you can take the primary Ethernet down for real and test real-world results. Anything else and you'll miss circumstances that you can't simulate.

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.