linux下面有关于route的配置文件么
1个回答
展开全部
[root@localhost root]# cat /etc/sysconfig/network-scripts/ifup-routes
#! /bin/bash
#
# adds static routes which go through device $1
if [ -z "$1" ]; then
echo $"usage: ifup-routes <net-device>"
exit 1
fi
# Older format
if [ -f "/etc/sysconfig/network-scripts/route-$1" ]; then
while read line; do
/sbin/ip route add $line
done < "/etc/sysconfig/network-scripts/route-$1"
fi
if [ -n "$2" -a "$2" != "$1" ]; then
if [ -f "/etc/sysconfig/network-scripts/route-$2" ]; then
while read line; do
/sbin/ip route add $line
done < "/etc/sysconfig/network-scripts/route-$2"
fi
fi
# Red Hat network configuration format
CONFIG="/etc/sysconfig/networking/devices/$1.route"
[ -f $CONFIG ] || CONFIG="/etc/sysconfig/networking/devices/$2.route"
[ -f $CONFIG ] || exit 0
. $CONFIG
routenum=0
while [ "x$(eval echo '$'ADDRESS$routenum)x" != "xx" ]; do
eval `ipcalc -p $(eval echo '$'ADDRESS$routenum) $(eval echo '$'NETMASK$routenum)`
line="$(eval echo '$'ADDRESS$routenum)/$PREFIX"
if [ "x$(eval echo '$'GATEWAY$routenum)x" != "xx" ]; then
line="$line via $(eval echo '$'GATEWAY$routenum)"
fi
line="$line dev $1"
/sbin/ip route add $line
routenum=$(($routenum+1))
done
#! /bin/bash
#
# adds static routes which go through device $1
if [ -z "$1" ]; then
echo $"usage: ifup-routes <net-device>"
exit 1
fi
# Older format
if [ -f "/etc/sysconfig/network-scripts/route-$1" ]; then
while read line; do
/sbin/ip route add $line
done < "/etc/sysconfig/network-scripts/route-$1"
fi
if [ -n "$2" -a "$2" != "$1" ]; then
if [ -f "/etc/sysconfig/network-scripts/route-$2" ]; then
while read line; do
/sbin/ip route add $line
done < "/etc/sysconfig/network-scripts/route-$2"
fi
fi
# Red Hat network configuration format
CONFIG="/etc/sysconfig/networking/devices/$1.route"
[ -f $CONFIG ] || CONFIG="/etc/sysconfig/networking/devices/$2.route"
[ -f $CONFIG ] || exit 0
. $CONFIG
routenum=0
while [ "x$(eval echo '$'ADDRESS$routenum)x" != "xx" ]; do
eval `ipcalc -p $(eval echo '$'ADDRESS$routenum) $(eval echo '$'NETMASK$routenum)`
line="$(eval echo '$'ADDRESS$routenum)/$PREFIX"
if [ "x$(eval echo '$'GATEWAY$routenum)x" != "xx" ]; then
line="$line via $(eval echo '$'GATEWAY$routenum)"
fi
line="$line dev $1"
/sbin/ip route add $line
routenum=$(($routenum+1))
done
Storm代理
2023-08-29 广告
2023-08-29 广告
"StormProxies是全球大数据IP资源服务商,其住宅代理网络由真实的家庭住宅IP组成,可为企业或个人提供满足各种场景的代理产品。点击免费测试(注册即送1G流量)StormProxies有哪些优势?1、IP+端口提取形式,不限带宽,I...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询