|
|
64b87c |
From 28be8992c3c1facfd80dfcc6afad951f33098783 Mon Sep 17 00:00:00 2001
|
|
|
64b87c |
From: Gerd von Egidy <gerd.von.egidy@intra2net.com>
|
|
|
64b87c |
Date: Thu, 5 Mar 2015 12:07:57 +0100
|
|
|
64b87c |
Subject: [PATCH] Add support for ethernet point-to-point connections
|
|
|
64b87c |
configured via DHCP
|
|
|
64b87c |
|
|
|
64b87c |
When current dracut receives an ip with netmask of 255.255.255.255 via DHCP,
|
|
|
64b87c |
setting the also supplied default gateway fails (because it is obviously not
|
|
|
64b87c |
within the netmask).
|
|
|
64b87c |
|
|
|
64b87c |
The setup with a netmask of /32 is quite common in colocation datacenters
|
|
|
64b87c |
where you don't want the machines of two different customers to directly talk
|
|
|
64b87c |
to each other. At least two of the biggest colocation providers in Germany
|
|
|
64b87c |
(1&1 and Strato) do it that way. NetworkManager supports this kind of setup
|
|
|
64b87c |
and the dhclient-scripts of several distributions too.
|
|
|
64b87c |
|
|
|
64b87c |
In this patch I have implemented a simple approach very similar to what is
|
|
|
64b87c |
found in Debian. The dhclient-script from Fedora uses a more sophisticated
|
|
|
64b87c |
approach, but that relies on the ipcalc utility which would introduce a
|
|
|
64b87c |
dependency on Fedora-initscripts for dracut.
|
|
|
64b87c |
|
|
|
64b87c |
Signed-off-by: Gerd von Egidy <gerd.von.egidy@intra2net.com>
|
|
|
64b87c |
(cherry picked from commit 99ccbc30dff9fa51dd3187dc10f8f632e5e54e4b)
|
|
|
64b87c |
---
|
|
|
64b87c |
modules.d/40network/dhclient-script.sh | 8 +++++++-
|
|
|
64b87c |
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
64b87c |
|
|
|
64b87c |
diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
|
|
|
1755ca |
index 7972af99..12e2869f 100755
|
|
|
64b87c |
--- a/modules.d/40network/dhclient-script.sh
|
|
|
64b87c |
+++ b/modules.d/40network/dhclient-script.sh
|
|
|
64b87c |
@@ -49,7 +49,13 @@ setup_interface() {
|
|
|
64b87c |
${lease_time:+valid_lft $lease_time} \
|
|
|
64b87c |
${preferred_lft:+preferred_lft ${preferred_lft}}
|
|
|
64b87c |
|
|
|
64b87c |
- [ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
|
|
|
64b87c |
+ if [ -n "$gw" ] ; then
|
|
|
64b87c |
+ if [ "$mask" == "255.255.255.255" ] ; then
|
|
|
64b87c |
+ # point-to-point connection => set explicit route to gateway
|
|
|
64b87c |
+ echo ip route add $gw dev $netif > /tmp/net.$netif.gw
|
|
|
64b87c |
+ fi
|
|
|
64b87c |
+ echo ip route replace default via $gw dev $netif >> /tmp/net.$netif.gw
|
|
|
64b87c |
+ fi
|
|
|
64b87c |
|
|
|
64b87c |
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
|
|
|
64b87c |
if [ -n "$namesrv" ] ; then
|