[wicked-devel] Re: wicked network setup
Am 17.01.2014 14:02, schrieb Robert Schweikert:
Hi Marius, Hi!
As you know with newer incarnations of udev/systemd the network devices are enumerated differently, getting names such as enp5s0 or whatever.
This makes it difficult for appliances to setup a network configuration. For example previously when eth0 names were used we could simply add ifcfg-eth0 in /etc/sysconfig/network configure it for dhcp and no matter what the first device was it would be setup with dhcp and the network was up and running.
This obviously doesn't work anymore as we cannot predict the name of the first, or any interface for that matter.
Does wicked have a solution for this problem? i.e. is the some way to setup a rule that says "make one of the available interfaces run with dhcp"
What do you expect that wicked makes? :-) It does not write any configuration, but is simply using it. Wicked can match interfaces by pci-bus, mac address, ... [some code is there, but IMO not complete to catch all cases, e.g. s390] -- at least in its native mode, which we currently are *not* using. On SLES-10 we were using "ifcfg-eth-bus-pci-0000:00:19.0..." or "ifcfg- eth-id-$mac" as configuration names. Such ifcfg files are not supported. Further, this is IMO _not_ a solution but just moves the problem. Instead to detect the interface name, you have to detect the correct way to match an interface and create a config containing a the match [what is much more complex than to just find the name]. IMO there is no "golden solution". Basically you have the choice between 1) and 2) bellow. 1) Use systemd names, detect & create configs in the initial boot -- after systemd renamed it to its name. Just some dummy illustration, which I wrote here -- untested: #!/bin/bash get_netcard_ifnames() { while read ifname more ; do test "X echo "$ifname" done < <(hwinfo --netcard --short | grep -v "^network") } generate_net_config() { local ifname=$1 local mode=$2 local ipaddr=$3 local gwaddr=$4 { #echo "STARTMODE='hotplug'" echo "STARTMODE='auto'" case $mode in dhcp4|dhcp6|dhcp|static) echo "BOOTPROTO=$mode" ;; esac case $mode in static) test -n "$ipaddr" && echo "IPADDR='$ipaddr'" ;; test -n "$gwaddr" && { echo "default $gwaddr - -" \ > "/etc/sysconfig/network/ifroute-$ifname" } ;; esac } > "/etc/sysconfig/network/ifcfg-$ifname" } count=0 for ifname in `get_netcard_ifnames 2>/dev/null` ; do ### test is_ibft "$ifname" && continue # no config needed ### test is_usable_for_me "$ifname" || continue ((count++ == 0)) || break generate_net_config "$ifname" "${mode:-dhcp}" done 2) Don't use systemd names but "custom" name schema, which is also supported by systemd/udevd [except something changed here again] for compatibility / as fallback / when you don't like the names. Provide an udev rule renaming interfaces to e.g. "nic0", "nic1" Using "eth0" is not a good idea as _this_ is causing problems; renaming to "nic0" is not a problem -- systemd renames too. This is the SLES-11 way, the logic to write the rules were in udev-persistent-net-name generator and in yast2. Generation is AFAIK dropped from both as obsoleted. The rules [once written] are still supported. Problem: you have write rule / to provide logic to match the interface you want in an udev rule. 3) Reintroduce own matches by pci-bus, mac address, ... SLES-9 and SLES-10 were using it (getcfg); support has been dropped on SLES-11, obsoleted by udev rules. Problem: you have to provide logic matching the interface you want and a "translation tool" (getcfg on SLES-10) to translate a configuration to ifname and back (!!!). Problem: Patch every peace of software to use the "translation tool", that is wicked [it does not support such ifcfg files], firewall, dhcp and any other daemon using "bind-to-device" or needing the name for whatever. Gruesse / Regards, Marius Tomaschewski <mt@suse.de>, <mt@suse.com> -- SUSE LINUX Products GmbH, HRB 16746 (AG Nürnberg), GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, Maxfeldstraße 5, 90409 Nürnberg, Germany -- To unsubscribe, e-mail: wicked-devel+unsubscribe@opensuse.org To contact the owner, e-mail: wicked-devel+owner@opensuse.org
Hi, On 01/17/2014 11:24 AM, Marius Tomaschewski wrote:
Am 17.01.2014 14:02, schrieb Robert Schweikert:
Hi Marius, Hi!
As you know with newer incarnations of udev/systemd the network devices are enumerated differently, getting names such as enp5s0 or whatever.
This makes it difficult for appliances to setup a network configuration. For example previously when eth0 names were used we could simply add ifcfg-eth0 in /etc/sysconfig/network configure it for dhcp and no matter what the first device was it would be setup with dhcp and the network was up and running.
This obviously doesn't work anymore as we cannot predict the name of the first, or any interface for that matter.
Does wicked have a solution for this problem? i.e. is the some way to setup a rule that says "make one of the available interfaces run with dhcp"
What do you expect that wicked makes? :-) It does not write any configuration, but is simply using it.
Yes, sorry looks like I did not properly communicate what I wanted. I would like to create a wicked configuration file and stick it into my appliance. But rather than specifying the interface name in the configuration I want wicked to pick the interface for me. I have not taken a look at the wicked XML, thus I am going to butcher this here, please excuse my ignorance. myNetConfig.xml <interface-name>*</interface-name> <method>onboot</method> <ip>dhcp</ip> This pseudo code would instrcut wicked to find a suitable interface (*) that has no other configuration, fire it up at boot time and run dhcp. That's what I would like wicked to do. Isolate me from the name shenanigans that are introduced by the current udev version. I do like the new scheme it is just a problem for appliance building ;) Is there a way to do this in wicked, or how hard would it be to implement? Thanks, Robert -- Robert Schweikert MAY THE SOURCE BE WITH YOU SUSE-IBM Software Integration Center LINUX Tech Lead Public Cloud Architect rjschwei@suse.com rschweik@ca.ibm.com 781-464-8147 -- To unsubscribe, e-mail: wicked-devel+unsubscribe@opensuse.org To contact the owner, e-mail: wicked-devel+owner@opensuse.org
Am 17.01.2014 17:37, schrieb Robert Schweikert:
Hi,
I would like to create a wicked configuration file and stick it into my appliance.
But rather than specifying the interface name in the configuration I want wicked to pick the interface for me.
I have not taken a look at the wicked XML, thus I am going to butcher this here, please excuse my ignorance.
myNetConfig.xml
<interface-name>*</interface-name> <method>onboot</method> <ip>dhcp</ip>
https://github.com/openSUSE/wicked/blob/master/samples/nanny/eth-all.xml But note: yast2 does not understand this and we are not using the wicked-xml now, but ifcfg compatibility until a) wicked xml is stable and b) yast2 (and other parts of the system) has been rewritten to use xml. Gruesse / Regards, Marius Tomaschewski <mt@suse.de>, <mt@suse.com> -- SUSE LINUX Products GmbH, HRB 16746 (AG Nürnberg), GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, Maxfeldstraße 5, 90409 Nürnberg, Germany -- To unsubscribe, e-mail: wicked-devel+unsubscribe@opensuse.org To contact the owner, e-mail: wicked-devel+owner@opensuse.org
Am 17.01.2014 17:46, schrieb Marius Tomaschewski:
https://github.com/openSUSE/wicked/blob/master/samples/nanny/eth-all.xml
But note: yast2 does not understand this and we are not using the wicked-xml now, but ifcfg compatibility until a) wicked xml is stable and b) yast2 (and other parts of the system) has been rewritten to use xml.
=> Nothing for SLE-12-GA. Gruesse / Regards, Marius Tomaschewski <mt@suse.de>, <mt@suse.com> -- SUSE LINUX Products GmbH, HRB 16746 (AG Nürnberg), GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, Maxfeldstraße 5, 90409 Nürnberg, Germany -- To unsubscribe, e-mail: wicked-devel+unsubscribe@opensuse.org To contact the owner, e-mail: wicked-devel+owner@opensuse.org
On Fri, Jan 17, Robert Schweikert wrote:
But rather than specifying the interface name in the configuration I want wicked to pick the interface for me.
Isnt the fix for your case the use of the tool which used to write 70-persistent-net.rules? Just something simple as assigning every occouring MAC to eth0 (there will ever be just a single one per boot, right?) and continue to write ifcfg-eth0 as you like. This is not a wicked problem as wicked just reads existing ifcfg-* files. Olaf -- To unsubscribe, e-mail: wicked-devel+unsubscribe@opensuse.org To contact the owner, e-mail: wicked-devel+owner@opensuse.org
On 01/17/2014 12:19 PM, Olaf Hering wrote:
On Fri, Jan 17, Robert Schweikert wrote:
But rather than specifying the interface name in the configuration I want wicked to pick the interface for me.
Isnt the fix for your case the use of the tool which used to write 70-persistent-net.rules?
No, because within a kiwi image build we do not want to fiddle with the system stuff. Network setup is still configuration and up to the user. Previously this was easy the user of kiwi would drop etc/sysconfig/network/ifcfg-eth0 into the image via the overlay tree and would have the configuration they want on any target system. That no longer works. In most cases the person building the image will not know if the interface is enp5s0, or has some other name. Thus a "any-name" policy will address this problem and wicked already has it :)
Just something simple as assigning every occouring MAC to eth0 (there will ever be just a single one per boot, right?) and continue to write ifcfg-eth0 as you like.
This is not a wicked problem as wicked just reads existing ifcfg-* files.
Yes it is not a wicked problem. I am try to use wicked as a way/tool to solve the problem introduced with the new device naming scheme in udev for network devices. Later, Robert -- Robert Schweikert MAY THE SOURCE BE WITH YOU SUSE-IBM Software Integration Center LINUX Tech Lead Public Cloud Architect rjschwei@suse.com rschweik@ca.ibm.com 781-464-8147 -- To unsubscribe, e-mail: wicked-devel+unsubscribe@opensuse.org To contact the owner, e-mail: wicked-devel+owner@opensuse.org
On Fri, Jan 17, Robert Schweikert wrote:
Previously this was easy the user of kiwi would drop etc/sysconfig/network/ifcfg-eth0 into the image via the overlay tree and would have the configuration they want on any target system.
That no longer works. In most cases the person building the image will not know if the interface is enp5s0, or has some other name. Thus a "any-name" policy will address this problem and wicked already has it :)
Yes, I know. Just restore the any-name being eth0 rule and be happy. The so called stable by-id names can not be stable. We learned that with block devices and changed defaults in SLE12. Upstream did not learn it yet, so we will suffer. There is no other reliable way.
Yes it is not a wicked problem. I am try to use wicked as a way/tool to solve the problem introduced with the new device naming scheme in udev for network devices.
Its the wrong layer. Olaf -- To unsubscribe, e-mail: wicked-devel+unsubscribe@opensuse.org To contact the owner, e-mail: wicked-devel+owner@opensuse.org
Am 17.01.2014 18:40, schrieb Olaf Hering:
On Fri, Jan 17, Robert Schweikert wrote:
Previously this was easy the user of kiwi would drop etc/sysconfig/network/ifcfg-eth0 into the image via the overlay tree and would have the configuration they want on any target system.
That no longer works. In most cases the person building the image will not know if the interface is enp5s0, or has some other name. Thus a "any-name" policy will address this problem and wicked already has it :)
Yes, I know. Just restore the any-name being eth0 rule and be happy. The so called stable by-id names can not be stable. We learned that with block devices and changed defaults in SLE12. Upstream did not learn it yet, so we will suffer. There is no other reliable way.
Yes it is not a wicked problem. I am try to use wicked as a way/tool to solve the problem introduced with the new device naming scheme in udev for network devices.
Its the wrong layer.
Yes and I think, using the all-eth policy is the wrong way to go [except for a pre-boot/install/live-cd or other "preparing" stages and wanting to find out the final interface name]. The appliance will break yast2 [I guess at least] and still be not able to use several services, which require the interface name in their config. Further, you will run into problems when there are multiple devices [it is random which one of them sets default route, ... here]. Using a rule is the safe way. Implementing a script, which generates them it not soo difficult [at least less difficult than the resulting problems / limitation]. Important is to not use the same namespace as the kernel does, e.g. no eth0, as this is the usual/major reason for problems. Gruesse / Regards, Marius Tomaschewski <mt@suse.de>, <mt@suse.com> -- SUSE LINUX Products GmbH, HRB 16746 (AG Nürnberg), GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, Maxfeldstraße 5, 90409 Nürnberg, Germany -- To unsubscribe, e-mail: wicked-devel+unsubscribe@opensuse.org To contact the owner, e-mail: wicked-devel+owner@opensuse.org
On Fri, Jan 17, Olaf Hering wrote:
so called stable by-id names can not be stable. We learned that with
Corretion: s/by-id/by-path/ But that does not invalidate the point. Olaf -- To unsubscribe, e-mail: wicked-devel+unsubscribe@opensuse.org To contact the owner, e-mail: wicked-devel+owner@opensuse.org
On 01/17/2014 03:01 PM, Olaf Hering wrote:
On Fri, Jan 17, Olaf Hering wrote:
so called stable by-id names can not be stable. We learned that with
Corretion: s/by-id/by-path/
But that does not invalidate the point.
Olaf
So basically you guys are telling me that from a KIWI point of view we have to recommend to our users to fiddle with udev rules and then go back to the regular etc/sysconfig/network/ifcfg-.... script method. That's a sad picture, IMHO. Oh well. Robert -- Robert Schweikert MAY THE SOURCE BE WITH YOU SUSE-IBM Software Integration Center LINUX Tech Lead Public Cloud Architect rjschwei@suse.com rschweik@ca.ibm.com 781-464-8147 -- To unsubscribe, e-mail: wicked-devel+unsubscribe@opensuse.org To contact the owner, e-mail: wicked-devel+owner@opensuse.org
On Fri, Jan 17, Robert Schweikert wrote:
On 01/17/2014 03:01 PM, Olaf Hering wrote:
On Fri, Jan 17, Olaf Hering wrote:
so called stable by-id names can not be stable. We learned that with
Corretion: s/by-id/by-path/
But that does not invalidate the point. So basically you guys are telling me that from a KIWI point of view we have to recommend to our users to fiddle with udev rules and then go back to the regular etc/sysconfig/network/ifcfg-.... script method.
The network config is and was stored in ifcfg-<interface>, and both ifup and wicked continue to read just that. Simply because its an established and well understood interface. We had udev rules in place which made sure the string <interface> is bound to a certain MAC address. Thats not perfect for "sharing" the same disk with different VMs and their different MACs. At least for native its good and predictable. It could be improved by making sure that if just a single interface exists it will get eth0. But noone asked for that, it annoyed just me while moving vm disks around, it can be fixed by removing 70-persistent-net.rules before reboot. Now someone came up with something half-baked and <interface> is not predictable anymore. And worse, not even stable. Even if its sold as stable. So for us as distributor it would have been wise to minimize the damage by throwing just a little bit of our experience with the matter into the game and keep 70-persistent-net.rules. Its certainly not up to the user to fiddle with that. Its up to us to silently provide that file and move on. In case of KIWI, come up with a simple helper which does what is needed, or carry the old helper for your own purpose. Olaf -- To unsubscribe, e-mail: wicked-devel+unsubscribe@opensuse.org To contact the owner, e-mail: wicked-devel+owner@opensuse.org
participants (3)
-
Marius Tomaschewski
-
Olaf Hering
-
Robert Schweikert