[systemd-devel] systemd-networkd and bonding config
Mikhail Morfikov
mmorfikov at gmail.com
Sat Feb 28 04:26:07 PST 2015
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?
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?
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-networkd[1165]: wlan0 : lost carrier
But after the boot stage, when I restart the systemd-networkd
service, everything works just fine.
Feb 28 12:14:52 morfikownia systemd[1]: Starting Network Service...
Feb 28 12:14:53 morfikownia systemd-networkd[1103]: bond0 : netdev ready
Feb 28 12:14:53 morfikownia systemd-networkd[1103]: br_lxc : netdev ready
Feb 28 12:14:53 morfikownia systemd-networkd[1103]: Enumeration completed
Feb 28 12:14:53 morfikownia systemd-networkd[1103]: ifb0 : lost carrier
Feb 28 12:14:53 morfikownia systemd-networkd[1103]: ifb1 : lost carrier
Feb 28 12:14:53 morfikownia systemd-networkd[1103]: ifb0 : gained carrier
Feb 28 12:14:53 morfikownia systemd[1]: Started Network Service.
Feb 28 12:14:53 morfikownia systemd-networkd[1103]: ifb1 : gained carrier
Feb 28 12:14:54 morfikownia systemd-networkd[1103]: bond0 : bond0 : could not bring up interface: Invalid argument
Feb 28 12:14:54 morfikownia systemd-networkd[1103]: br_lxc : br_lxc : could not bring up interface: Invalid argument
Feb 28 12:14:54 morfikownia systemd-networkd[1103]: br_lxc : link configured
Feb 28 12:14:54 morfikownia systemd-networkd[1103]: wlan0 : link configured
Feb 28 12:14:54 morfikownia systemd-networkd[1103]: bond0 : gained carrier
Feb 28 12:14:54 morfikownia systemd-networkd[1103]: eth1 : link configured
Feb 28 12:14:54 morfikownia systemd-networkd[1103]: lo : link configured
Feb 28 12:14:57 morfikownia systemd-networkd[1103]: wlan0 : gained carrier
Feb 28 12:14:58 morfikownia systemd-networkd[1103]: bond0 : DHCPv4 address 192.168.1.150/24 via 192.168.1.1
Feb 28 12:14:58 morfikownia systemd-networkd[1103]: bond0 : link configured
This problem occurs randomly -- sometimes the wlan interface fails,
sometimes it doesn't. I don't know why this happens, but it
always can be fixed by restarting the systemd-networkd service.
I know wlan interfaces require wpasupplicant config, and I created
the appropriate service file:
# cat wpa_supplicant at .service
[Unit]
Description=WPA supplicant (%i)
After=systemd-networkd.service
Requires=systemd-networkd.service
Before=network-online.target
ConditionPathIsSymbolicLink=/sys/class/net/%i
[Service]
Type=simple
ExecStartPre=/sbin/ip link set %i up
ExecStart=/sbin/wpa_supplicant -s -i %i -b bond0 -D nl80211,wext -q -c /etc/wpa_supplicant/wpa_supplicant.conf -O /run/wpa_supplicant
ExecStopPost=/sbin/ip addr flush %i
ExecStopPost=/sbin/ip link set %i down
[Install]
WantedBy=multi-user.target
I don't use any GUI apps like network-manager.
4. How to disable/enable an interface? When I was using the sysvinit
networking script, I also had tools like ifup and ifdown . Do I have
to create some service files that include several ip* commands, or is
there a better way?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150228/ebd558d4/attachment.sig>
More information about the systemd-devel
mailing list