Anaconda/Network

From FedoraProject

Jump to: navigation, search

Contents

Network enablement and network configuration

Two tasks:

Network enablement in installer

Configure and activate a network device to be used during installation, e.g. to get kickstart, packages, or for network-backed storage. The configuration can be supplied with boot parameters, or kickstart, or if needed user will be prompted to configure a device in UI. Network enablement can happen in loader or in stage 2:

Additional devices can be activated in GUI, using NetworkManager Connection Editor (nm-c-e) by checking Connect Automatically. Since RHEL 6 and Fedora 16, additional devices can be activated (in loader) using kickstart network option --activate (this can be needed e.g. when downloading packages from one NIC/subnet and having iSCSI target on separate NIC/subnet). Activation of additional devices for iSCSI in GUI can be done also by invoking nm-c-e from Advanced Storage Options dialog (since F17?/RHEL6.3)

Once the device is activated, it can't be reactivated with changed configuration (e.g. static configuration with fixed nameserver, see bug 504983). I want to offer this possibility in GUI which requires option to activate/disconnect a device on demand (see device activation). It can be worked around by editing configuration files.

Network configuration of target system

Can be done with kickstart or in GUI using nm-c-e. Undesirably, checking Connect Automatically in nm-c-e will activate the device after the configuration is saved (see ONBOOT side-effect). I am not aware of any problems caused by this side effect which is invisible to the user (Anaconda doesn't wait for NetworkManager activating the device), but I can imagine there might be some lurking.

As you can see, configuration of installer environment and target system is not separated. It is because using nm-c-e for enablement we have to use the same configuration files. At the end of installation the config files are copied to target system.

On Live CD, network is configured in Live CD environment using NetworkManager Applet on panel. We don't copy ifcfg files in this case as up to F14 NM didn't store configuration in ifcfg files by default. The situation may have changed in F15 with NM 0.9 (TODO bug numbers).

Modes of configuration

Boot options

These anaconda boot options can be used to enable network in loader (e.g. for getting kickstart, updates image, or for vnc): asknetwork, dhcpclass, dhcptimeout, dns, essid, ethtool, gateway, ip, ipv6, ksdevice, linksleep, mtu, netmask, nicdelay, noipv4, noipv6, wepkey, wpakey.

Kickstart

Kickstart network command can be used both to enable and configure devices. The behaviour has been changing in the course of adoption of NM.

For RHEL 6.0, Fedora 14, and later, devices that are supposed not to be activated in installer and have onboot option set will be activated just before downloading packages due to ONBOOT side-effect. We have no reports of problems caused by this, but in some cases activation of the device could cause change of routing table making packages inaccessible.

  1. http://git.fedorahosted.org/git/?p=anaconda.git;a=commit;h=1980e9d377aa6089ae96740cd85593ec18d5344d
  2. http://git.fedorahosted.org/git/?p=anaconda.git;a=commit;h=9767cb5fce174e8fcf28d06ad6f48384129a7cd4

Loader text UI

Serves for selection and/or configuration of a network device that should be enabled in loader. It is skipped if the information is provided via boot options or kickstart unless required by boot option asknetwork. Configuration options of this UI are a subset of nm-c-e which is used in GUI.

Once the device is successfully activated, there is no possibility to change its configuration in loader UI (see bug 504983).

Device selection:

Anaconda loader device selection.png

Configuration of selected device:

Anaconda loader device configuration.png

The IPv6 options correspond to following options of nm-c-e:

If both IPv4 and IPv6 configuration is enabled, failing IPv4 configuration of activated device means that activation is considered as failing overall (which corresponds to Require IPv4 addressing for this connection to complete checked in nm-c-e or IPV4_FAILURE_FATAL=yes in ifcfg file).

Static (Manual) configuration:

Anaconda loader static configuration.png


Anaconda GUI

When enabling network in stage 2, this device selection / network enablement confirmation dialog appears:

Anaconda GUI device selection.png

Selected device will then be configured using NetworkManager Connection Editor (nm-c-e):

Anaconda GUI nmce list.png

Anaconda GUI nmce device.png

nm-c-e is run as separate process. Anaconda should ensure that the selected device will be actually activated in installer.

More of target system network configuration (beyond the devices that has been enabled in installer and the configuration they used) can be done from hostname screen by clicking on Configure Network button:

Anaconda GUI configure network.png

The saved (target system) configuration will not be applied to device that have been already activated in installer environment. To achieve this, the device must be deactivated and reconnected which can be done only from shell in tty2, for example by editing of configuration files. See this issue for details.

On the other hand, the device which had not been activated yet will be activated by checking Connect Automatically.


Text mode UI

Rather limited compared to nm-c-e.

Anaconda tui device selection.png

Anaconda tui device configuration.png


Editing configuration files

Anaconda is communicating with NetworkManager mostly with ifcfg files (nm-c-e stores its configuration there too). It can be handy to edit them directly for debugging or as workaround solution. Files can be edited using shell in virtual terminal tty2 ([Ctrl][Alt][F2]). Their location is /etc/sysconfig/netwrok-scripts/ifcfg-<device name>. The configuration will be applied in installer after the device is disconnected (its ifcfg file is removed) and reactivated (an ifcfg file is copied back to its location with ONBOOT=yes set). So configuration of active device for installer environment can be changed this way:

mv /etc/sysconfig/network-scripts/ifcfg-eth0 /tmp
vi /tmp/ifcfg-eth0
mv /tmp/ifcfg-eth0 /etc/sysconfig/network-scripts

In F16 (where a NM bug was fixed) just editing the ifcfg file (instead of removing an copying/creating) should do the trick.

We should consider adding nmcli to install image.

At the end of the installation, ifcfg files are copied to target system tree to directory /mnt/sysimage/etc/sysconfig/network-scripts.

Selection of device to be enabled in installer

This is behaviour in rhel6-branch which should go into rawhide soon (but probably not into F15):

Wireless

Passing SSID and WEP key with boot parameters or kickstart is supported in Fedora 14. Other methods of authentication can be set in GUI using nm-c-e, although there are some issues with AP selection which could be solved with integration of NetworkManager Applet or its substitute.

Vrata Podzimek is working on WPA support for kickstart and boot options (wireless activation in loader). Patches are on a-d-l and should go to F16.

Status updates can be found in comments of bug 473803 or on feature page Support wireless networking during installation.

IPv6

Configuration files

We'd like to let NM do the most of the job where possible. We have to bear in mind minimal installs without NM.

/etc/sysconfig/network

Written by anaconda.

NetworkManager can update it with HOSTNAME with SaveHostname method.

/etc/sysconfig/network-scripts/ifcfg-*

Basic files are written by anaconda in loader, updated in loader if activating device, updated in stage2 if configuring device in ks, updated with nm-c-e in GUI. For wireless the * should be replaced with SSID, not device name.

/etc/sysconfig/network-scripts/key-*

Created by NM when configuring wireless, copied to target system.

/etc/dhcp/dhclient-<DEVICE NAME>.conf

NM merges it into its dhclient file. Anaconda writes only vendor-class-identifier option based on network --dhcpclass kickstart setting. Used to write also host-name for network --bootproto=dhcp --hostname=<HOSTNAME>, but it is handled by NM and DHCP_HOSTNAME written by anaconda into ifcfg file. Should we copy the file on target system? Probably yes - bug 476364. Yes, we set dhcp timeout for NM in the file (from dhcptimeout boot option).

/etc/hosts

Anaconda doesn't touch it. AFAIK, NetworkManager updates it based on host-name dhcp option (for assigned IP and 127.0.0.1).

/etc/resolv.conf

Anaconda doesn't touch it, it is generated by NetworkManager.

/etc/udev/rules.d/70-persistent-net.rules

Anaconda copies the file generated by udev to target system. It is possible that we shouldn't do it as we don't change it and the file is generated on boot by udev anyway (bug 652499).

Bugs and issues

DVD install and ONBOOT

DVD install defaults to ONBOOT=no leaving networking down after reboot - bug 498207. This is rather sore issue. Only devices enabled during install will have set ONBOOT=yes by default. For other devices, the setting has to be configured. Default was changed in F16 - for non-ks installs if network was not enabled during install set ONBOOT=yes for first (non-wireless) device with link detected.

This differs from RHEL 5 where a device is preconfigured to be activated automatically in network screen. This network configuration screen has been replaced by nm-c-e in RHEL 6 in par with transition to NetworkManager. Without the screen we have no easy option to make user acknowledge/confirm the default by going to next screen, so imposing the default is more debatable. Also, checking "Connect Automatically" in nm-c-e has a side-effect of activating the device (unlike the corresponding choice in rhel 5 network configuration screen)

Missing GUI pieces

Fedora feature: Anaconda/Features/NetworkReconfiguration

Missing functionality that NetworkManager Applet or, since F15 control center offers:

Currently it can be worked around only by editing configuration files.

Use cases:

Related bugs: bug 592856, 504983, 635239, 688527 (rhel6-branch), 697066, 705023.

Places in the GUI where access to network (re-)configuration (regardless of whether the network is enabled or not) would be useful.

I was exploring various approaches:

http://rvykydal.fedorapeople.org/anaconda_gnome_control_center_network.ogg

There are some issues I came accross (see http://rvykydal.fedorapeople.org/anaconda-gnome-control-center-network.png for reference)

1) Add single-panel mode option to g-c-c where [All Settings] button is removed, making only network configuration accessible.

2) Add device description to g-c-c panel, see there is only 'Wired' and MAC address currently.

3) Add window decoration button ([X]) to be able to close the window/app.

4) nm-applet is needed to provide user secrets agent service, though the applet itself will not be exposed anywhere in anaconda UI - it will only provide dialogs for authentication etc.. We need to open a session in ConsoleKit for anaconda (and pull ConsoleKit into the image). In master, running ConsoleKit service kills NetworkManager, seems to hit https://bugzilla.redhat.com/show_bug.cgi?id=703734.

5) [Options] button is sensitive only if the device is active while we want to configure also other devices in anaconda, see https://bugzilla.redhat.com/show_bug.cgi?id=704119#c2

6) Size of the image - something to be explored yet. In my initial tests I added control-center package, nm-applet (negligible), commented out removal of some files from ConsoleKit package (required by nm-applet). This made change of about 8-9 MB, but there are definitely opportunities to make it better (painfully).

Minimal installation

That is, without NetworkManager.

Back and Retry in loader in poor state

Given we are aiming to get rid of loader and the state of loader UI steps code (complicated, fragile, incomprehensible setting of flags) I am leaving it as it is.

iSCSI

Various issues

Anaconda UX redesign

UX redesign


  1. https://www.redhat.com/archives/anaconda-devel-list/2010-September/msg00181.html