Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

network-legacy: Support for static Wicked configuration #155

Open
wants to merge 4 commits into
base: SUSE/056
Choose a base branch
from

Conversation

tacerus
Copy link
Member

@tacerus tacerus commented Mar 29, 2022

Hi,

this introduces the ip=wicked-static cmdline option, allowing to apply a static network configuration from the full OS in the initramfs.

General remarks:

  • Changes to cmdline parameters are not ideal, as they go against the upstream concept of keeping dracut distribution agnostic - unfortunately I did not find an existing way to introduce a static backend - the existing functions and arguments seemed to only cover DHCP as well as static configuration passed using cmdline options.
  • I experimented with porting the XML schemas and libraries needed for native Wicked ifup functionality to the initramfs, however going the route with this patch, using the existing do_static functionality, seemed more lightweight.
  • Code style: I did not find any styling guides for dracut. The existing code seemed to be arbitrarily styled - for example in some places there is be a space before semicolons, in other places there isn't, and in some places variables are be quoted, in others they are not. Hence I picked a combination of what seemed like the most common style in the document.

Functionality remarks:

  • The implementation introduced with this patch only applies the first/primary interface address. Additional IP addresses (IPADDR_xxx) are not covered. I deemed the added complexity of iterating over additional addresses not crucial enough for now.
  • The implementation covers /etc/sysconfig/network/ifcfg-* and /etc/sysconfig/network/config files copied upon buildtime. I hope it is clear enough to a user who is reading the manpage, that changes to these files require a run of mkinitrd in order for them to be applied to the initramfs.

Testing remarks:
I tested this with the following sample /etc/sysconfig/network/ifcfg-enp1s0 files:

  • Test 1 (generated by YaST's LAN module):
IPADDR='192.168.5.14/24'
IPADDR_1='2a02:1748:f7df:9c80::aa1/64'
BOOTPROTO='static'
STARTMODE='auto'
LABEL_1='IPv6'
ZONE='public'
  • Test 2:
IPADDR='192.168.5.14'
PREFIXLEN='24'
IPADDR_1='2a02:1748:f7df:9c80::aa1/64'
BOOTPROTO='static'
STARTMODE='auto'
LABEL_1='IPv6'
ZONE='public'
  • Test 3:
IPADDR='192.168.5.14'
NETMASK='255.255.255.0'
IPADDR_1='2a02:1748:f7df:9c80::aa1/64'
BOOTPROTO='static'
STARTMODE='auto'
LABEL_1='IPv6'
ZONE='public'
  • Test 4:
IPADDR_1='192.168.5.14'
PREFIXLEN_1='24'
IPADDR='2a02:1748:f7df:9c80::aa1/64'
BOOTPROTO='static'
STARTMODE='auto'
LABEL_1='IPv4'
ZONE='public'

all of them in combination with the following /etc/sysconfig/network/config snippet:

NETCONFIG_DNS_STATIC_SEARCHLIST="home.lysergic.dev"
NETCONFIG_DNS_STATIC_SERVERS="192.168.5.1 2a02:1748:f7df:9c80::1"

I hope to have covered all relevant points.

Best,
Georg

Initialize basic hook to apply Wicked based static network configuration from an
installed system in a dracut based initramfs using cmdline
`ip=wicked-static`.

Signed-off-by: Georg Pfuetzenreuter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant