aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsysconfig/network-scripts/ifup-aliases8
-rwxr-xr-xsysconfig/network-scripts/ifup-ctc4
-rwxr-xr-xsysconfig/network-scripts/ifup-ippp7
-rwxr-xr-xsysconfig/network-scripts/ifup-plip2
-rwxr-xr-xsysconfig/network-scripts/ifup-plusb2
5 files changed, 9 insertions, 14 deletions
diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases
index 16005cbd..a647044f 100755
--- a/sysconfig/network-scripts/ifup-aliases
+++ b/sysconfig/network-scripts/ifup-aliases
@@ -143,9 +143,8 @@ function ini_env ()
function is_default_gateway ()
{
- LC_ALL=C /sbin/route -n \
- | awk '$1 == "0.0.0.0" && $2 == "'"$1"'" { found = 1; }
- END { exit found == 0; }'
+ LC_ALL=C /sbin/ip route ls default scope global \
+ | awk '$3 == "'"$1"'" { found = 1; } END { exit found == 0; }'
}
#
@@ -269,8 +268,7 @@ function new_interface ()
\( -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${DEVICE}" \) ]; then
# set up default gateway, if it isn't already there
if ! is_default_gateway "$GATEWAY"; then
- route add default gw ${GATEWAY} \
- ${METRIC:+metric $METRIC} ${DEVICE}
+ ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY} dev ${DEVICE}
fi
fi
diff --git a/sysconfig/network-scripts/ifup-ctc b/sysconfig/network-scripts/ifup-ctc
index 1a1aec5d..39d6a09c 100755
--- a/sysconfig/network-scripts/ifup-ctc
+++ b/sysconfig/network-scripts/ifup-ctc
@@ -40,13 +40,13 @@ while ! ping -w 30 -c 1 ${GATEWAY} &>/dev/null; do
done
if [ "${NETWORK}" != "" ] ; then
- route add -host ${GATEWAY} metric 1 ${DEVICE}
+ ip route add to ${GATEWAY} metric 1 dev ${DEVICE}
fi
if [ "${GATEWAY}" != "" ]; then
if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then
# set up default gateway
- route add default gw ${GATEWAY} ${METRIC:+metric $METRIC}
+ ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY}
fi
fi
diff --git a/sysconfig/network-scripts/ifup-ippp b/sysconfig/network-scripts/ifup-ippp
index 6ab69117..3ba93328 100755
--- a/sysconfig/network-scripts/ifup-ippp
+++ b/sysconfig/network-scripts/ifup-ippp
@@ -359,13 +359,10 @@ function addprovider()
if [ "$DIALMODE" = "auto" ] ; then
echo 1 > /proc/sys/net/ipv4/ip_dynaddr
if [ "$DEFROUTE" = "yes" ] ; then
- route del default >/dev/null 2>&1
if [ "$GATEWAY" = "0.0.0.0" ]; then
- route add default ${METRIC:+metric $METRIC} $DEVICE \
- >/dev/null 2>&1
+ ip route replace default ${METRIC:+metric $METRIC} dev ${DEVICE} >/dev/null 2>&1
else
- route add default gw $GATEWAY ${METRIC:+metric $METRIC} \
- >/dev/null 2>&1
+ ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY} dev ${DEVICE} >/dev/null 2>&1
fi
fi
fi
diff --git a/sysconfig/network-scripts/ifup-plip b/sysconfig/network-scripts/ifup-plip
index 7f4f521e..c3b9efa1 100755
--- a/sysconfig/network-scripts/ifup-plip
+++ b/sysconfig/network-scripts/ifup-plip
@@ -21,7 +21,7 @@ ip route add ${NETWORK} dev ${DEVICE}
if [ "${GATEWAY}" != "" ]; then
if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then
# set up default gateway
- route add default gw ${GATEWAY} ${METRIC:+metric $METRIC}
+ ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY}
fi
fi
diff --git a/sysconfig/network-scripts/ifup-plusb b/sysconfig/network-scripts/ifup-plusb
index 7f8f4649..ce5a0321 100755
--- a/sysconfig/network-scripts/ifup-plusb
+++ b/sysconfig/network-scripts/ifup-plusb
@@ -36,7 +36,7 @@ ip link set up dev ${DEVICE}
if [ "${GATEWAY}" != "" ]; then
if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then
# set up default gateway
- route add default gw ${GATEWAY} ${METRIC:+metric $METRIC}
+ ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY}
fi
fi