Скрипт с които можете да си смените default gateway
Ако сте мързеливи вижте този скрипт ![]()
# stupid script to change default gateway
# author t0d0r at linuxfan dot org
# vim:ts=4:sw=4:
primary_gateway='217.79.66.2'
secondary_gateway='10.210.0.1'
ping_cmd='/sbin/ping'
change_to() {
/sbin/route delete default
/sbin/route add default $1
}
current_gateway=`/usr/bin/netstat -rn | /usr/bin/grep default | /usr/bin/awk '{print $2}'`
${ping_cmd} -c 3 ${current_gateway} 2>&1 > /dev/null && is_ok=true
if [ "x_${current_gateway}" = "x_${primary_gateway}" ]; then
if [ "x${is_ok}" = "xtrue" ]; then
exit;
else
${ping_cmd} -c 3 ${secondary_gateway} 2>&1 > /dev/null \
&& change_to ${secondary_gateway}
exit;
fi
else
${ping_cmd} -c 3 ${primary_gateway} 2>&1 > /dev/null \
&& change_to ${primary_gateway}
exit;
fi
Все още няма връзки за обратно следене.