set MTU in different network confs

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2023-10-06 11:16:13 +02:00
committed by Jonathon Anderson
parent 2f9ec8103e
commit f4ae168f5a
5 changed files with 32 additions and 7 deletions

View File

@@ -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

View File

@@ -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 -}}

View File

@@ -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}}

View File

@@ -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 }}

View File

@@ -15,6 +15,9 @@ Source: {{ $source }}
{{ if $netdev.Type -}}
<link-type>{{ $netdev.Type }}</link-type>
{{ end -}}
{{ if $netdev.MTU -}}
<mtu>{{ $netdev.MTU }}</mtu>
{{ end -}}
<control>
<mode>boot</mode>
</control>