I'm running a custom built Linux machine, so not all Linux commands are available.
I execute network related commands, so I need to set a default gateway right before I run my command, then remove that gateway immediately afterward.
To do that I run all my commands in one line:
/sbin/route add default gw 10.10.10.10;my command;/sbin/route del default gw 10.10.10.10;
The problem is, for some reason I once found 2 default gateways on the same machine which caused all my commands to fail because even if I set my default gateway before running my test, it is still messed up and can't run my test.
So is there a way to remove ALL default gateways in one command ? I have a large amount of machines that are increasing and it won't be practical to plant a script on every machine. I need a command as simple as the following:
/sbin/route del all default;set my default gw;mycommand;/sbin/route del all default;
All I have found so far is a command to remove a default gateway but not all of them
/sbin/route del default
which won't work for me.
/sbin/route
help displays the following
/sbin/route --help
Usage: route [{add|del|delete}]
Edit the kernel's routing tables
Options:
-n Don't resolve names
-e Display other/more information
-A inet Select address family