Re: [systemd-devel] systemd-networkd and bonding config

2015-03-04 Thread Tom Gundersen
Hi Mikhail,

On Sat, Feb 28, 2015 at 1:26 PM, Mikhail Morfikov  wrote:
> I've just finished migration from /etc/init.d/networking script to
> systemd-networkd solution, and I just wanted to ask a couple of things.
>
> First, I have two interfaces -- one wire (eth1) and one wifi (wlan0),
> and I want them to be bonded into one bond0 interface. I had that
> solution when I was using sysvinit, and, so far, I haven't played with
> the network settings. After some reading, I managed to set the exact
> same setup and it works, more or less.
>
> Here are the questions:
>
> 1. How to set a MAC address to the bond0 interface? So far, I created
> 05-bond0.link file:
>
> # cat  /etc/systemd/network/05-bond0.link
> [Match]
> Driver=bonding
> Name=bond0
>
> [Link]
> MACAddress=3c:4a:92:00:4c:5b
>
> The MAC address is the MAC address of the eth1 interface. Is this the
> right way to do it?

You don't need to have a .link file for bonding devices. .link files
are a way to override the kernel defaults for network devices that we
don't create (i.e., wlan0/eth0 and typically other real hardware). For
virtual devices that we create we can just set the correct information
at creation time, which is done in .netdev files. But see below.

> 2. I noticed that the bonding information is bugged for some reason, I
> mean, when you check it under:
>
> # cat /proc/net/bonding/bond0
> Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
>
> Bonding Mode: load balancing (round-robin)
> MII Status: up
> MII Polling Interval (ms): 0
> Up Delay (ms): 0
> Down Delay (ms): 0
>
> Slave Interface: wlan0
> MII Status: up
> Speed: Unknown
> Duplex: Unknown
> Link Failure Count: 0
> Permanent HW addr: c0:cb:38:01:f0:f5
> Slave queue ID: 0
>
> Slave Interface: eth1
> MII Status: up
> Speed: 10 Mbps
> Duplex: half
> Link Failure Count: 0
> Permanent HW addr: 3c:4a:92:00:4c:5b
> Slave queue ID: 0
>
> it gives you the proper interfaces, but Up/Down Delay are set to 0
> and "Link Failure Count" doesn't count anything. The "Bonding Mode" is
> also wrong.
>
> This is the bonding file for networkd :
>
> # cat 20-bond0.netdev
> [NetDev]
> Description=Bonding interface
> Name=bond0
> Kind=bond
> MACAddress=3c:4a:92:00:4c:5b
>
> [Bond]
> Mode=active-backup
> MIIMonitorSec=200
> UpDelaySec=1000
> DownDelaySec=1000
>
> Is the information bugged, or should I check some other file in order to
> see the bonding settings?

The logic here is that when we create a new bond we will create it
with these settings, but we will not change the settings of a
preexisting bond, as that may have been created by somebody else we
don't know about so we figure better leave it alone.

The confusing part here is that the kernel will create bond0 with
default settings, and we will then not touch that. Ideally there would
be a kernel config switch to make it not create default devices like
that, but for the moment I think the best solution is to simply call
your bond something else. So if you put bond1 everywhere instead
things should JustWork(TM).

> 3. I don't know why, but sometimes (at boot stage) I get the following
> error message:
>
> # journalctl -b -1 -u systemd-networkd
> -- Logs begin at Sun 2015-02-22 21:48:12 CET, end at Sat 2015-02-28 12:33:57 
> CET. --
> Feb 28 12:08:26 morfikownia systemd[1]: Starting Network Service...
> Feb 28 12:08:27 morfikownia systemd-networkd[1165]: bond0   : netdev 
> ready
> Feb 28 12:08:27 morfikownia systemd-networkd[1165]: br_lxc  : netdev 
> ready
> Feb 28 12:08:27 morfikownia systemd-networkd[1165]: Enumeration completed
> Feb 28 12:08:27 morfikownia systemd[1]: Started Network Service.
> Feb 28 12:08:27 morfikownia systemd-networkd[1165]: ifb0: lost 
> carrier
> Feb 28 12:08:27 morfikownia systemd-networkd[1165]: ifb1: lost 
> carrier
> Feb 28 12:08:27 morfikownia systemd-networkd[1165]: ifb0: gained 
> carrier
> Feb 28 12:08:27 morfikownia systemd-networkd[1165]: ifb1: gained 
> carrier
> Feb 28 12:08:28 morfikownia systemd-networkd[1165]: bond0   : bond0   
> : could not bring up interface: Invalid argument
> Feb 28 12:08:28 morfikownia systemd-networkd[1165]: br_lxc  : br_lxc  
> : could not bring up interface: Invalid argument
> Feb 28 12:08:28 morfikownia systemd-networkd[1165]: br_lxc  : link 
> configured
> Feb 28 12:08:28 morfikownia systemd-networkd[1165]: wlan0   : wlan0   
> : could not join netdev: Operation not permitted
> Feb 28 12:08:28 morfikownia systemd-networkd[1165]: wlan0   : failed
> Feb 28 12:08:28 morfikownia systemd-networkd[1165]: eth1: link 
> configured
> Feb 28 12:08:28 morfikownia systemd-networkd[1165]: lo  : link 
> configured
> Feb 28 12:08:28 morfikownia systemd-networkd[1165]: bond0   : gained 
> carrier
> Feb 28 12:08:34 morfikownia systemd-networkd[1165]: wlan0   : gained 
> carrier
> Feb 28 12:11:02 morfikownia systemd-network

Re: [systemd-devel] systemd-networkd and bonding config

2015-03-04 Thread Ian Pilcher

On 03/04/2015 03:43 AM, Tom Gundersen wrote:

The logic here is that when we create a new bond we will create it
with these settings, but we will not change the settings of a
preexisting bond, as that may have been created by somebody else we
don't know about so we figure better leave it alone.

The confusing part here is that the kernel will create bond0 with
default settings, and we will then not touch that. Ideally there would
be a kernel config switch to make it not create default devices like
that, but for the moment I think the best solution is to simply call
your bond something else. So if you put bond1 everywhere instead
things should JustWork(TM).


Alternatively, if you're attached to the name bond0, you might be able
to something like this (not tested with systemd-networkd):

/etc/modprobe.d/rename-bond.conf:

install bonding /usr/sbin/modprobe --ignore-install bonding \
$CMDLINE_OPTS; /usr/sbin/ip link set dev bond0 down; \
/usr/sbin/ifrename -c /dev/null -i bond0 -n FOO >/dev/null

(Or an equivalent udev rule)

--

Ian Pilcher arequip...@gmail.com
 "I grew up before Mark Zuckerberg invented friendship" 


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd-networkd and bonding config

2015-03-04 Thread Mikhail Morfikov
> The logic here is that when we create a new bond we will create it
> with these settings, but we will not change the settings of a
> preexisting bond, as that may have been created by somebody else we
> don't know about so we figure better leave it alone.
> 
> The confusing part here is that the kernel will create bond0 with
> default settings, and we will then not touch that. Ideally there would
> be a kernel config switch to make it not create default devices like
> that, but for the moment I think the best solution is to simply call
> your bond something else. So if you put bond1 everywhere instead
> things should JustWork(TM).

I performed some tests, and I was able to run my system without bond
interfaces. So I think there's nothing that could trigger creation of
these kind of interfaces. The next thing I did was to create a .netdev
file that set bond0 interface (+ the rest of config files), and
here's the log:

# journalctl -b | grep -i bond
Mar 05 05:04:12 morfikownia kernel: bonding: Ethernet Channel Bonding Driver: 
v3.7.1 (April 27, 2011)
Mar 05 05:04:12 morfikownia systemd-networkd[862]: bond0   : netdev 
ready
Mar 05 05:04:12 morfikownia kernel: IPv6: ADDRCONF(NETDEV_UP): bond0: link is 
not ready
Mar 05 05:04:12 morfikownia kernel: bonding: bond0: Enslaving wlan0 as an 
active interface with an up link
Mar 05 05:04:12 morfikownia kernel: IPv6: ADDRCONF(NETDEV_CHANGE): bond0: link 
becomes ready
Mar 05 05:04:12 morfikownia systemd-networkd[862]: bond0   : bond0  
 : could not bring up interface: Invalid argument
Mar 05 05:04:12 morfikownia kernel: bonding: bond0: Enslaving eth1 as an active 
interface with an up link
Mar 05 05:04:12 morfikownia systemd-networkd[862]: bond0   : gained 
carrier
Mar 05 05:04:19 morfikownia systemd-networkd[862]: bond0   : DHCPv4 
address 192.168.1.113/24 via 192.168.1.1
Mar 05 05:04:19 morfikownia systemd-networkd[862]: bond0   : link 
configured

As you can see, there's nothing before it, so I don't understand why the
bond0 interface has some problems. Anyway, I changed the files and set
bond1 instead of bond0, and here's the log:

root:~# journalctl -b | grep -i bond
Mar 05 05:09:18 morfikownia kernel: bonding: Ethernet Channel Bonding Driver: 
v3.7.1 (April 27, 2011)
Mar 05 05:09:18 morfikownia kernel: bonding: bond1: Setting MII monitoring 
interval to 1000
Mar 05 05:09:18 morfikownia kernel: bonding: bond1: Setting up delay to 5000
Mar 05 05:09:18 morfikownia kernel: bonding: bond1: Setting down delay to 5000
Mar 05 05:09:18 morfikownia systemd-networkd[945]: bond1   : netdev 
ready
Mar 05 05:09:19 morfikownia kernel: bonding: bond1: Enslaving wlan0 as an 
active interface with a down link
Mar 05 05:09:19 morfikownia systemd-networkd[945]: bond1   : gained 
carrier
Mar 05 05:09:19 morfikownia systemd-networkd[945]: bond1   : bond1  
 : could not bring up interface: Invalid argument
Mar 05 05:09:19 morfikownia systemd-networkd[945]: bond1   : lost 
carrier
Mar 05 05:09:19 morfikownia systemd-networkd[945]: bond1   : DHCPv4 
connection considered system critical, ignoring request to reconfigure it.
Mar 05 05:09:19 morfikownia kernel: bonding: bond1: Enslaving eth1 as an active 
interface with a down link
Mar 05 05:09:20 morfikownia kernel: bonding: bond1: link status up for 
interface wlan0, enabling it in 0 ms
Mar 05 05:09:20 morfikownia kernel: bonding: bond1: link status definitely up 
for interface wlan0, 0 Mbps full duplex
Mar 05 05:09:20 morfikownia kernel: bonding: bond1: first active interface up!
Mar 05 05:09:20 morfikownia systemd-networkd[945]: bond1   : gained 
carrier
Mar 05 05:09:22 morfikownia systemd-networkd[945]: bond1   : DHCPv4 
address 192.168.1.150/24 via 192.168.1.1
Mar 05 05:09:22 morfikownia systemd-networkd[945]: bond1   : link 
configured

It's a little bit longer, and as you can see there's just bond1 info
and nothing concerning bond0. Also the MAC address changed in this
point -- it looks like the bond0 interface caused that problem.

I thougt that the only one interface was created, but there were
two of them.

The bond0 interface looks like this:

root:~# cat /proc/net//bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: load balancing (round-robin)
MII Status: down
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0

and the other one:

root:~# cat /proc/net//bonding/bond1
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 1000
Up Delay (ms): 5000
Down Delay (ms): 5000

Slave Interface: wlan0
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: c0:cb:38:01:f0:f5
Slave queue ID: 0

Slave Interface: eth1
MII Status: down
Speed: 10 Mbps
Duplex: half
Link Failure Count: 0
Permanent HW addr: 3c:4a:92:00:4c:5b
Slave queue ID: 0

and the bond1 wor

Re: [systemd-devel] systemd-networkd and bonding config

2015-03-04 Thread Mikhail Morfikov
> Alternatively, if you're attached to the name bond0, you might be able
> to something like this (not tested with systemd-networkd):
> 
> /etc/modprobe.d/rename-bond.conf:
> 
> install bonding /usr/sbin/modprobe --ignore-install bonding \
>   $CMDLINE_OPTS; /usr/sbin/ip link set dev bond0 down; \
>   /usr/sbin/ifrename -c /dev/null -i bond0 -n FOO
> >/dev/null
> 

It doesn't work. It just removed bond interfaces completely (it
doesn't matter whether I use bond0 or bond1): 

root:~# networkctl
IDX LINK TYPE   OPERATIONAL SETUP
  1 lo   loopback   carrier configured
  2 eth1 ether  off configuring
  3 ifb0 ether  off unmanaged
  4 ifb1 ether  off unmanaged
  5 wlan0wlan   degradedconfiguring
  6 br_lxc   ether  no-carrier  configured

6 links listed.

Maybe I just stay with the bond1 interface.


pgpU2SChggEgT.pgp
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd-networkd and bonding config

2015-03-05 Thread Tom Gundersen
On Thu, Mar 5, 2015 at 5:27 AM, Mikhail Morfikov  wrote:
>> The logic here is that when we create a new bond we will create it
>> with these settings, but we will not change the settings of a
>> preexisting bond, as that may have been created by somebody else we
>> don't know about so we figure better leave it alone.
>>
>> The confusing part here is that the kernel will create bond0 with
>> default settings, and we will then not touch that. Ideally there would
>> be a kernel config switch to make it not create default devices like
>> that, but for the moment I think the best solution is to simply call
>> your bond something else. So if you put bond1 everywhere instead
>> things should JustWork(TM).
>
> I performed some tests, and I was able to run my system without bond
> interfaces. So I think there's nothing that could trigger creation of
> these kind of interfaces. The next thing I did was to create a .netdev
> file that set bond0 interface (+ the rest of config files), and
> here's the log:
>
> # journalctl -b | grep -i bond
> Mar 05 05:04:12 morfikownia kernel: bonding: Ethernet Channel Bonding Driver: 
> v3.7.1 (April 27, 2011)
> Mar 05 05:04:12 morfikownia systemd-networkd[862]: bond0   : netdev 
> ready
> Mar 05 05:04:12 morfikownia kernel: IPv6: ADDRCONF(NETDEV_UP): bond0: link is 
> not ready
> Mar 05 05:04:12 morfikownia kernel: bonding: bond0: Enslaving wlan0 as an 
> active interface with an up link
> Mar 05 05:04:12 morfikownia kernel: IPv6: ADDRCONF(NETDEV_CHANGE): bond0: 
> link becomes ready
> Mar 05 05:04:12 morfikownia systemd-networkd[862]: bond0   : bond0
>: could not bring up interface: Invalid argument
> Mar 05 05:04:12 morfikownia kernel: bonding: bond0: Enslaving eth1 as an 
> active interface with an up link
> Mar 05 05:04:12 morfikownia systemd-networkd[862]: bond0   : gained 
> carrier
> Mar 05 05:04:19 morfikownia systemd-networkd[862]: bond0   : DHCPv4 
> address 192.168.1.113/24 via 192.168.1.1
> Mar 05 05:04:19 morfikownia systemd-networkd[862]: bond0   : link 
> configured
>
> As you can see, there's nothing before it, so I don't understand why the
> bond0 interface has some problems. Anyway, I changed the files and set
> bond1 instead of bond0, and here's the log:
>
> root:~# journalctl -b | grep -i bond
> Mar 05 05:09:18 morfikownia kernel: bonding: Ethernet Channel Bonding Driver: 
> v3.7.1 (April 27, 2011)
> Mar 05 05:09:18 morfikownia kernel: bonding: bond1: Setting MII monitoring 
> interval to 1000
> Mar 05 05:09:18 morfikownia kernel: bonding: bond1: Setting up delay to 5000
> Mar 05 05:09:18 morfikownia kernel: bonding: bond1: Setting down delay to 5000
> Mar 05 05:09:18 morfikownia systemd-networkd[945]: bond1   : netdev 
> ready
> Mar 05 05:09:19 morfikownia kernel: bonding: bond1: Enslaving wlan0 as an 
> active interface with a down link
> Mar 05 05:09:19 morfikownia systemd-networkd[945]: bond1   : gained 
> carrier
> Mar 05 05:09:19 morfikownia systemd-networkd[945]: bond1   : bond1
>: could not bring up interface: Invalid argument
> Mar 05 05:09:19 morfikownia systemd-networkd[945]: bond1   : lost 
> carrier
> Mar 05 05:09:19 morfikownia systemd-networkd[945]: bond1   : DHCPv4 
> connection considered system critical, ignoring request to reconfigure it.
> Mar 05 05:09:19 morfikownia kernel: bonding: bond1: Enslaving eth1 as an 
> active interface with a down link
> Mar 05 05:09:20 morfikownia kernel: bonding: bond1: link status up for 
> interface wlan0, enabling it in 0 ms
> Mar 05 05:09:20 morfikownia kernel: bonding: bond1: link status definitely up 
> for interface wlan0, 0 Mbps full duplex
> Mar 05 05:09:20 morfikownia kernel: bonding: bond1: first active interface up!
> Mar 05 05:09:20 morfikownia systemd-networkd[945]: bond1   : gained 
> carrier
> Mar 05 05:09:22 morfikownia systemd-networkd[945]: bond1   : DHCPv4 
> address 192.168.1.150/24 via 192.168.1.1
> Mar 05 05:09:22 morfikownia systemd-networkd[945]: bond1   : link 
> configured
>
> It's a little bit longer, and as you can see there's just bond1 info
> and nothing concerning bond0. Also the MAC address changed in this
> point -- it looks like the bond0 interface caused that problem.
>
> I thougt that the only one interface was created, but there were
> two of them.
>
> The bond0 interface looks like this:
>
> root:~# cat /proc/net//bonding/bond0
> Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
>
> Bonding Mode: load balancing (round-robin)
> MII Status: down
> MII Polling Interval (ms): 0
> Up Delay (ms): 0
> Down Delay (ms): 0
>
> and the other one:
>
> root:~# cat /proc/net//bonding/bond1
> Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
>
> Bonding Mode: load balancing (round-robin)
> MII Status: up
> MII Polling Interval (ms): 1000
> Up Delay (ms): 5000
> Down Delay (ms): 5000
>
> Slave Interface: wlan0
> MII Status: up
> Speed: Unknown
> Dupl

Re: [systemd-devel] systemd-networkd and bonding config

2015-03-05 Thread Michał Bartoszkiewicz
On Thu, Mar 5, 2015 at 3:47 PM, Tom Gundersen  wrote:
> The kernel creates bond0 itself. This is confusing and we should
> probably request the kernel to stop doing that (patch needed).

You can use "options bonding max_bonds=0" to disable the creation of bond0.

-- 
Michał Bartoszkiewicz 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd-networkd and bonding config

2015-03-05 Thread Susant Sahani
On Thu, 05 Mar 2015 21:01:53 +0530, Michał Bartoszkiewicz  
 wrote:



On Thu, Mar 5, 2015 at 3:47 PM, Tom Gundersen  wrote:

The kernel creates bond0 itself. This is confusing and we should
probably request the kernel to stop doing that (patch needed).


You can use "options bonding max_bonds=0" to disable the creation of  
bond0.


this options is not a netlink parameter.networkd does not use module  
parameters I guess.

Specifically to use it we need to add

/etc/modprobe.d/bonding.conf

options bonding max_bonds=0


Susant
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd-networkd and bonding config

2015-03-05 Thread Ian Pilcher

On 03/05/2015 09:31 AM, Michał Bartoszkiewicz wrote:

You can use "options bonding max_bonds=0" to disable the creation of bond0.


Now there's a poorly documented (and named) module parameter!

--

Ian Pilcher arequip...@gmail.com
 "I grew up before Mark Zuckerberg invented friendship" 


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd-networkd and bonding config

2015-03-05 Thread Mikhail Morfikov
> You can use "options bonding max_bonds=0" to disable the creation of
> bond0.
> 

That's exactly what I needed:

# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 1000
Up Delay (ms): 5000
Down Delay (ms): 5000

Slave Interface: wlan0
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: c0:cb:38:01:f0:f5
Slave queue ID: 0

Slave Interface: eth1
MII Status: going down
Speed: 10 Mbps
Duplex: half
Link Failure Count: 1
Permanent HW addr: 3c:4a:92:00:4c:5b
Slave queue ID: 0

There's only one bond interface and also the MAC address is the right
one.


pgpLXS8DxVp_J.pgp
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel