Linux – Simulate ethernet cable unplugged on a remote machine while staying connected

iprouteiptableslinuxnetworking

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(?)

Best Answer

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
Related Question