#!/bin/bash
while [ 1 ]
do
found_route=`ip route |grep -ci "$1"`
if [ $found_route -eq 0 ];then
route add -net $1 netmask $2 gw $3 dev $4
fi
sleep 30
done
使用./filename.sh 参数路由 参数掩码 参数网关 参数网卡
例如:./filename.sh 192.168.1.0 255.255.255.0 192.168.5.254 eth1