Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
354 views
in Technique[技术] by (71.8m points)

networking - How can I mock remote network devices in Linux?

I am making a system that needs to be able to determine if a host is reachable or not by pinging it.

As part of a small end-to-end smoke test suite, I want to be able to bring up hosts and tear them down during the test suite, to test that my system responds correctly. Unfortunately, actually spinning up remote hosts and tearing them down is costly and extremely slow.

Is there any way I can mock this in Linux?

Bonus points if this doesn't require running the test suite as root.


My hope is that I can create a few virtual interfaces, assign arbitrary IP addresses for them and bring them up/down during the test to simulate hosts going down and coming back up. I should even be able to simulate open ports on the hosts using netcat, which would also be tremendously useful. I haven't had any luck figuring this out yet though (if it's even possible), I suspect my combined Google-fu and network engineering skill points are too low.

question from:https://stackoverflow.com/questions/65945767/how-can-i-mock-remote-network-devices-in-linux

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Depending on your network requirements I think Docker could fit your needs.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...