Skip to contentSkip to conversation

Add support for ethernet point-to-point connections configured via DHCP

PATCH In review Gerd von Egidy 3 participants 4 messages Mar 5, 2015 – Jun 3, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add support for ethernet point-to-point connections configured via DHCP

When current dracut receives an ip with netmask of 255.255.255.255 via DHCP, setting the also supplied default gateway fails (because it is obviously not within the netmask).

The setup with a netmask of /32 is quite common in colocation datacenters where you don't want the machines of two different customers to directly talk to each other. At least two of the biggest colocation providers in Germany (1&1 and Strato) do it that way. NetworkManager supports this kind of setup and the dhclient-scripts of several distributions too.

In this patch I have implemented a simple approach very similar to what is found in Debian. The dhclient-script from Fedora uses a more sophisticated approach, but that relies on the ipcalc utility which would introduce a dependency on Fedora-initscripts for dracut.

---
 modules.d/40network/dhclient-script.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
modules.d/40network/dhclient-script.sh +7 -1
index 50f1985..98352ec 100755
@@ -43,7 +43,13 @@ setup_interface() {
         valid_lft ${lease_time} preferred_lft ${lease_time} \
         dev $netif
 
-    [ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
+    if [ -n "$gw" ] ; then
+        if [ "$mask" == "255.255.255.255" ] ; then
+            # point-to-point connection => set explicit route to gateway
+            echo ip route add $gw dev $netif > /tmp/net.$netif.gw
+        fi
+        echo ip route replace default via $gw dev $netif >> /tmp/net.$netif.gw
+    fi
 
     [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
     if  [ -n "$namesrv" ] ; then
Signature · 1 line
1.9.3
#1 lore raw
Quoted 10 lines · On Thursday 05 March 2015 12:07:57 Gerd von Egidy wrote:

When current dracut receives an ip with netmask of 255.255.255.255 via DHCP, setting the also supplied default gateway fails (because it is obviously not within the netmask).

The setup with a netmask of /32 is quite common in colocation datacenters where you don't want the machines of two different customers to directly talk to each other. At least two of the biggest colocation providers in Germany (1&1 and Strato) do it that way. NetworkManager supports this kind of setup and the dhclient-scripts of several distributions too.

Quoted 4 lines

In this patch I have implemented a simple approach very similar to what is found in Debian. The dhclient-script from Fedora uses a more sophisticated approach, but that relies on the ipcalc utility which would introduce a dependency on Fedora-initscripts for dracut.

any comments or questions about this one?

I'd prefer if this could be merged into dracut upstream.

Kind regards,

Gerd

#3 lore raw
In reply to Gerd von Egidy

Hi Harald,

thank you for merging my patch into master.

Could you also merge it into the RHEL-7 branch so it will be released with 7.2 or 7.3? Or do you prefer if I open a bug in Bugzilla for that?

It fixes a regression from RHEL 6 which could be network-installed with a dhcp configured point-to-point connection.

Thank you.

Kind regards,

Gerd