I am making a program that scrapes information from some web services. I want to test how my program reacts when it can't reach the web service, like if the web service is down or if the local computer has no internet access. Disconnecting my whole computer from the network every time I want to run a test is far too much work.
Is there a simple way to run a program under Linux with no network access?
A command like this would be awesome:
$ no_networking "ruby my_program.rb"
sleep 90 && ./myprogram
. then take down the network. if the machine is reached by network then before taking the network down for it, set up a sleep delayed command to restore the network or to reboot, in another screen. – Skaperen Mar 24 '15 at 12:41