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(a)suse.de>, <mt(a)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(a)opensuse.org
To contact the owner, e-mail: wicked-devel+owner(a)opensuse.org
Hi list
The following might be a non-issue, but I would still like to mention my observations. The reason being that my customer is mainly managing their complex network setup through their own management tools.
In testing a macvlan on top of a bond it appears that manually starting the macvlan interface with
# wicked ifup macvlan0
does not start the underlying device, it is associated to.
When starting the bond device itself, that one starts its slaves correctly as per below :
os131b:/etc/wicked/ifconfig # cat ens7.xml
<interface>
<name>ens7</name>
<control>
<link-detection>
<timeout>10</timeout>
<require-link/>
</link-detection>
</control>
<link/>
</interface>
os131b:/etc/wicked/ifconfig # cat ens8.xml
<interface>
<name>ens8</name>
<control>
<link-detection>
<timeout>10</timeout>
<require-link/>
</link-detection>
</control>
<link/>
</interface>
os131b:/etc/wicked/ifconfig # cat bond0.xml
<interface>
<name>bond0</name>
<control>
<link-detection>
<timeout>10</timeout>
<require-link/>
</link-detection>
</control>
<bond>
<mode>active-backup</mode>
<miimon>
<frequency>100</frequency>
<carrier>netif</carrier>
</miimon>
<slaves>
<slave>
<device>ens7</device>
</slave>
<slave>
<device>ens8</device>
</slave>
</slaves>
</bond>
<link/>
</interface>
os131b:/etc/wicked/ifconfig # ip l sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens7: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT qlen 1000
link/ether 52:54:00:f0:33:4b brd ff:ff:ff:ff:ff:ff
3: ens8: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT qlen 1000
link/ether 52:54:00:d7:b9:8e brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 52:54:00:93:d2:81 brd ff:ff:ff:ff:ff:ff
os131b:/etc/wicked/ifconfig # wicked ifup bond0
bond0: network-up
os131b:/etc/wicked/ifconfig # ip l sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens7: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
link/ether 52:54:00:f0:33:4b brd ff:ff:ff:ff:ff:ff
3: ens8: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
link/ether 52:54:00:f0:33:4b brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 52:54:00:93:d2:81 brd ff:ff:ff:ff:ff:ff
15: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT
link/ether 52:54:00:f0:33:4b brd ff:ff:ff:ff:ff:ff
os131b:/etc/wicked/ifconfig # wicked ifdown bond0
bond0: device-down
os131b:/etc/wicked/ifconfig # cat macvlan0.xml
<interface>
<name>macvlan0</name>
<ipv4:static>
<address>
<local>172.10.31.4/24</local>
</address>
</ipv4:static>
<macvlan>
<device>bond0</device>
<mode>bridge</mode>
</macvlan>
</interface>
os131b:/etc/wicked/ifconfig # wicked ifup macvlan0
bond0: device-exists
wicked: device macvlan0 failed: operation timed out
wicked: device bond0 failed: operation timed out
os131b:/etc/wicked/ifconfig # ip l sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 52:54:00:f0:33:4b brd ff:ff:ff:ff:ff:ff
3: ens8: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT qlen 1000
link/ether 52:54:00:d7:b9:8e brd ff:ff:ff:ff:ff:ff
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 52:54:00:93:d2:81 brd ff:ff:ff:ff:ff:ff
9: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN mode DEFAULT
link/ether 76:9a:17:18:79:c3 brd ff:ff:ff:ff:ff:ff
10: macvlan0@bond0: <NO-CARRIER,BROADCAST,MULTICAST,UP,M-DOWN> mtu 1500 qdisc noqueue state LOWERLAYERDOWN mode DEFAULT
link/ether 76:9a:17:18:79:c3 brd ff:ff:ff:ff:ff:ff
This also happens if the underlying macvlan device is a regular interface, e.g. ens7 in the above setup.
If the underlying device is started before trying to start the macvlan device, it works.
Again, when booting the system, the devices are brought up correctly. However post-boot interface management must also work for wicked to be useful to my customer, who is managing interfaces in their SLES based telco systems. They have up to thousands of virtual interfaces defined on a single machine.
Researching this I have noticed some syslog messages that appear when down'ing virtual interfaces.
Perhaps they can give some hints :
2013-12-30T14:42:35.947330+01:00 linux-vr36 wickedd-dhcp6[592]: unable to open /sys/class/net/bond0/bonding/slaves: No such file or directory
2013-12-30T14:42:35.947644+01:00 linux-vr36 wickedd-dhcp6[592]: bond0: cannot get bonding attribute mode
2013-12-30T14:42:35.948150+01:00 linux-vr36 wickedd-dhcp6[592]: error retrieving bonding attribute from sysfs
2013-12-30T14:42:35.960640+01:00 linux-vr36 wickedd[562]: unable to open /sys/class/net/bond0/bonding/slaves: No such file or directory
2013-12-30T14:42:35.961549+01:00 linux-vr36 wickedd[562]: bond0: cannot get bonding attribute mode
2013-12-30T14:42:35.962277+01:00 linux-vr36 wickedd[562]: error retrieving bonding attribute from sysfs
>>>
2013-12-30T14:42:35.968078+01:00 linux-vr36 wickedd[562]: cannot send device-delete event for model "bond0" - no dbus device
<<<
2013-12-30T14:43:19.379833+01:00 linux-vr36 kernel: [ 9433.464445] bonding: bond0 is being created...
2013-12-30T14:43:19.435791+01:00 linux-vr36 kernel: [ 9433.520436] device bond0 entered promiscuous mode
2013-12-30T14:43:19.435808+01:00 linux-vr36 kernel: [ 9433.520525] IPv6: ADDRCONF(NETDEV_UP): macvlan0: link is not ready
2013-12-30T14:43:19.435501+01:00 linux-vr36 wickedd-dhcp4[595]: macvlan0: reconfig changes device type! d6 l0
2013-12-30T14:43:39.398381+01:00 linux-vr36 wicked: device macvlan0 failed: operation timed out
2013-12-30T14:43:39.399146+01:00 linux-vr36 wicked: device bond0 failed: operation timed out
2013-12-30T14:44:45.178972+01:00 linux-vr36 kernel: [ 9519.263529] device bond0 left promiscuous mode
2013-12-30T14:44:45.220664+01:00 linux-vr36 avahi-daemon[555]: Withdrawing workstation service for macvlan0.
>>>
2013-12-30T14:44:45.238129+01:00 linux-vr36 wickedd[562]: cannot send device-delete event for model "macvlan0" - no dbus device
<<<
Please let me know if this kind of issues are considered spamming of the mailing list.
Thanks.
Best regards
Andreas Taschner
Dedicated Support Engineer
SUSE
--
To unsubscribe, e-mail: wicked-devel+unsubscribe(a)opensuse.org
To contact the owner, e-mail: wicked-devel+owner(a)opensuse.org
Hi
As far as I understand the wicked command, it should be possible to filter the dump of xml information for interfaces.
# wicked help
show-xml [--raw] [--modem] <ifname|all>
Specifying an interface name as argument to the command does not limit the output.
os131b:/etc/wicked/ifconfig # wicked show-xml all |egrep 'object path|name'
<object path="/org/opensuse/Network/Interface"/>
<object path="/org/opensuse/Network/Interface/1">
<name>lo</name>
<object path="/org/opensuse/Network/Interface/2">
<name>ens7</name>
<object path="/org/opensuse/Network/Interface/3">
<name>ens8</name>
<object path="/org/opensuse/Network/Interface/4">
<name>eth2</name>
os131b:/etc/wicked/ifconfig # wicked show-xml eth2 |egrep 'object path|name'
<object path="/org/opensuse/Network/Interface"/>
<object path="/org/opensuse/Network/Interface/1">
<name>lo</name>
<object path="/org/opensuse/Network/Interface/2">
<name>ens7</name>
<object path="/org/opensuse/Network/Interface/3">
<name>ens8</name>
<object path="/org/opensuse/Network/Interface/4">
<name>eth2</name>
In fact it always acts as if 'all' was specified (this may be the default though) :
os131b:/etc/wicked/ifconfig # wicked show-xml |egrep 'object path|name'
<object path="/org/opensuse/Network/Interface"/>
<object path="/org/opensuse/Network/Interface/1">
<name>lo</name>
<object path="/org/opensuse/Network/Interface/2">
<name>ens7</name>
<object path="/org/opensuse/Network/Interface/3">
<name>ens8</name>
<object path="/org/opensuse/Network/Interface/4">
<name>eth2</name>
Is this working as designed/not yet implemented/bug/configuration error at my end ?
Best regards
Andreas Taschner
--
To unsubscribe, e-mail: wicked-devel+unsubscribe(a)opensuse.org
To contact the owner, e-mail: wicked-devel+owner(a)opensuse.org