|
|
712866 |
From aa5313ca0e17bb08dd0629c3f9385672408caceb Mon Sep 17 00:00:00 2001
|
|
|
712866 |
From: Will Woods <wwoods@redhat.com>
|
|
|
712866 |
Date: Thu, 28 Aug 2014 13:44:47 -0400
|
|
|
712866 |
Subject: [PATCH] do 'ip route replace default' instead of 'add'
|
|
|
712866 |
|
|
|
712866 |
When you define the gateway for an interface, dracut sets it up with:
|
|
|
712866 |
|
|
|
712866 |
ip route add default via $gw dev $netif
|
|
|
712866 |
|
|
|
712866 |
If a default route is already set (e.g. if you have multiple NICs), this
|
|
|
712866 |
will fail with the message "RTNETLINK answers: File exists".
|
|
|
712866 |
|
|
|
712866 |
So, if your first NIC isn't usable as a default route
|
|
|
712866 |
|
|
|
712866 |
Using "ip route replace default" instead allows ifup/dhclient-script to
|
|
|
712866 |
correctly change the default route to the new interface.
|
|
|
712866 |
---
|
|
|
712866 |
modules.d/40network/dhclient-script.sh | 2 +-
|
|
|
712866 |
modules.d/40network/ifup.sh | 2 +-
|
|
|
712866 |
2 files changed, 2 insertions(+), 2 deletions(-)
|
|
|
712866 |
|
|
|
712866 |
diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
|
|
|
5c6c2a |
index ba05250d..885303a2 100755
|
|
|
712866 |
--- a/modules.d/40network/dhclient-script.sh
|
|
|
712866 |
+++ b/modules.d/40network/dhclient-script.sh
|
|
|
712866 |
@@ -45,7 +45,7 @@ setup_interface() {
|
|
|
712866 |
valid_lft ${lease_time} preferred_lft ${lease_time} \
|
|
|
712866 |
dev $netif
|
|
|
712866 |
|
|
|
712866 |
- [ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
|
|
712866 |
+ [ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
|
|
|
712866 |
|
|
|
712866 |
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
|
|
|
712866 |
if [ -n "$namesrv" ] ; then
|
|
|
712866 |
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
|
|
|
5c6c2a |
index 43e84a2c..67b1d9f8 100755
|
|
|
712866 |
--- a/modules.d/40network/ifup.sh
|
|
|
712866 |
+++ b/modules.d/40network/ifup.sh
|
|
|
712866 |
@@ -145,7 +145,7 @@ do_static() {
|
|
|
712866 |
ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
|
|
|
712866 |
fi
|
|
|
712866 |
|
|
|
712866 |
- [ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
|
|
712866 |
+ [ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
|
|
|
712866 |
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
|
|
712866 |
|
|
|
712866 |
return 0
|