diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e9a9df9..8ec99151 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - New documentation for development environment (Vagrant) - Ability to duplicate an image with `wwctl container copy` or the API - New documentation for container duplication procedure +- Configure network device MTU in nework configuration scripts. #807 ### Fixed - Fix hard CPU architecture on proto's installation in the Makefile diff --git a/overlays/wwinit/etc/NetworkManager/system-connections/ww4-managed.ww b/overlays/wwinit/etc/NetworkManager/system-connections/ww4-managed.ww index fc3e9807..465565cf 100644 --- a/overlays/wwinit/etc/NetworkManager/system-connections/ww4-managed.ww +++ b/overlays/wwinit/etc/NetworkManager/system-connections/ww4-managed.ww @@ -20,12 +20,18 @@ autoconnect=true {{ if eq $netdev.Type "ethernet" -}} [ethernet] mac-address={{ $netdev.Hwaddr }} +{{ if $netdev.MTU -}} +mtu={{ $netdev.MTU }} +{{ end -}} {{ end -}} {{ end -}} {{ if eq $netdev.Type "infiniband" -}} [infiniband] transport-mode=datagram +{{ if $netdev.MTU -}} +mtu={{ $netdev.MTU }} +{{ end -}} {{ end -}} {{ if $netdev.IpCIDR -}} diff --git a/overlays/wwinit/etc/network/interfaces.d/default.ww b/overlays/wwinit/etc/network/interfaces.d/default.ww index 851dfd21..2d17b0d2 100644 --- a/overlays/wwinit/etc/network/interfaces.d/default.ww +++ b/overlays/wwinit/etc/network/interfaces.d/default.ww @@ -1,7 +1,19 @@ -auto {{.NetDevs.default.Device}} -allow-hotplug {{.NetDevs.default.Device}} -iface {{.NetDevs.default.Device}} inet static - address {{.NetDevs.default.Ipaddr}} - netmask {{.NetDevs.default.Netmask}} - gateway {{.NetDevs.default.Gateway}} - up ifmetric {{.NetDevs.default.Device}} 30 +{{- $host := .BuildHost }} +{{- $time := .BuildTime }} +{{- $source := .BuildSource }} +{{range $devname, $netdev := .NetDevs -}} +{{- $filename := print $devname }} +{{- file $filename }} +# This file is autogenerated by warewulf +# Host: {{ $host }} +# Time: {{ $time }} +# Source: {{ $source }} +auto {{$netdev.Device}} +allow-hotplug {{$netdev.Device}} +iface {{$netdev.Device}} inet static + address {{$netdev.Ipaddr}} + netmask {{$netdev.Netmask}} + gateway {{$netdev.Gateway}} + mtu {{$netdev.MTU}} + up ifmetric {{$netdev.Device}} 30 +{{- end}} diff --git a/overlays/wwinit/etc/sysconfig/network-scripts/ifcfg.ww b/overlays/wwinit/etc/sysconfig/network-scripts/ifcfg.ww index 53192fa5..c2cf4c95 100644 --- a/overlays/wwinit/etc/sysconfig/network-scripts/ifcfg.ww +++ b/overlays/wwinit/etc/sysconfig/network-scripts/ifcfg.ww @@ -11,6 +11,9 @@ TYPE={{ $netdev.Type }} DEVICE={{ $netdev.Device }} NAME={{ $devname }} +{{ if $netdev.MTU -}} +MTU={{ $netdev.MTU }} +{{ end -}} BOOTPROTO=static DEVTIMEOUT=10 IPADDR={{ $netdev.Ipaddr }} diff --git a/overlays/wwinit/etc/wicked/ifconfig/ifcfg.xml.ww b/overlays/wwinit/etc/wicked/ifconfig/ifcfg.xml.ww index 04135b0f..1afb0ea8 100644 --- a/overlays/wwinit/etc/wicked/ifconfig/ifcfg.xml.ww +++ b/overlays/wwinit/etc/wicked/ifconfig/ifcfg.xml.ww @@ -15,6 +15,9 @@ Source: {{ $source }} {{ if $netdev.Type -}} {{ $netdev.Type }} {{ end -}} + {{ if $netdev.MTU -}} + {{ $netdev.MTU }} + {{ end -}} boot