Created
August 14, 2018 11:20
-
-
Save rightson/fdac61958d82a88f6ec74cc4ffcecb3f to your computer and use it in GitHub Desktop.
A utility that can quickly set default gateway's metric to 0 or delete entire routing rule
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
op=$1 | |
iface=$2 | |
gateway=$3 | |
if [ -z "$op" ]; then | |
op=add | |
fi | |
if [ -z "$iface" ]; then | |
iface=eth1 | |
fi | |
if [ -z "$gateway" ]; then | |
gateway=172.20.10.1 | |
fi | |
cmd="sudo route $op -net default gw $gateway netmask 0.0.0.0 dev $iface metric 0" | |
echo $cmd | |
$cmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment