Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
349 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 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...