[11-NOV-2015] Configure `systemd-networkd`, and a bridge device ================================================= References ---------- - https://wiki.archlinux.org/index.php/Systemd-networkd - https://major.io/2015/03/26/creating-a-bridge-for-virtual-machines-using-systemd-networkd/ Enabling `systemd-networkd` --------------------------- First, enable `systemd-networkd`: $ systemctl enable systemd-networkd $ systemctl start systemd-networkd Disable NetworkManager: $ systemctl disable NetworkManager Check the status of `systemd-networkd`: $ systemctl status systemd-networkd ● systemd-networkd.service - Network Service Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2015-11-11 19:07:35 CET; 13s ago Docs: man:systemd-networkd.service(8) Main PID: 6174 (systemd-network) Status: "Processing requests..." CGroup: /system.slice/systemd-networkd.service └─6174 /usr/lib/systemd/systemd-networkd Nov 11 19:07:35 taroxhost systemd[1]: Starting Network Service... Nov 11 19:07:35 taroxhost systemd-networkd[6174]: Enumeration completed Nov 11 19:07:35 taroxhost systemd[1]: Started Network Service. After a few minutes: $ systemctl status systemd-networkd ● systemd-networkd.service - Network Service Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: disabled) Active: inactive (dead) since Wed 2015-11-11 19:08:14 CET; 4min 21s ago Docs: man:systemd-networkd.service(8) Main PID: 6174 (code=exited, status=0/SUCCESS) Status: "Shutting down..." Nov 11 19:07:35 taroxhost systemd[1]: Starting Network Service... Nov 11 19:07:35 taroxhost systemd-networkd[6174]: Enumeration completed Nov 11 19:07:35 taroxhost systemd[1]: Started Network Service. Enabling `systemd-resolved` --------------------------- $ systemctl enable systemd-resolved $ systemctl start systemd-resolved $ systemctl status systemd-resolved ● systemd-resolved.service - Network Name Resolution Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2015-11-11 19:11:15 CET; 4s ago Docs: man:systemd-resolved.service(8) Main PID: 6239 (systemd-resolve) Status: "Processing requests..." CGroup: /system.slice/systemd-resolved.service └─6239 /usr/lib/systemd/systemd-resolved Nov 11 19:11:15 taroxhost systemd[1]: Starting Network Name Resolution... Nov 11 19:11:15 taroxhost systemd-resolved[6239]: Using system hostname 'taroxhost'. Nov 11 19:11:15 taroxhost systemd-resolved[6239]: Switching to system DNS server 192.168.1.1. Nov 11 19:11:15 taroxhost systemd[1]: Started Network Name Resolution. Move the NM-generated 'resolv.conf' to elsewhere: $ mv /etc/resolv.conf ~/resolv.conf.orig And, create a symlink to /etc/resolv.conf: $ ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf Create the 'network' directory for systemd: $ mkdir /etc/systemd/network Setup a network bridge with `systemd` for virtual machines ---------------------------------------------------------- Reference: https://major.io/2015/03/26/creating-a-bridge-for-virtual-machines-using-systemd-networkd/ https://wiki.archlinux.org/index.php/Systemd-networkd#Bridge_interface Ensure that you are using the right interface 'enp6s0' in my case: $ ip a | grep enp6s0 3: enp6s0: mtu 1500 qdisc mq state UP group default qlen 1000 inet 192.168.1.4/24 brd 192.168.1.255 scope global dynamic enp6s0 Bind ethernet to bridge: $ cat /etc/systemd/network/uplink.network [Match] #Name=en* Name=enp6s0 [Network] Bridge=br0 Create the bridge device in 'br0.netdev' file: $ cat /etc/systemd/network/br0.netdev [NetDev] Name=br0 Kind=bridge Create a network profile for the bridge: $ cat /etc/systemd/network/br0.network [Match] Name=br0 [Network] #DHCP=yes DHCP=ipv4 $ systemctl status systemd-networkd ● systemd-networkd.service - Network Service Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2015-11-11 23:04:31 CET; 19min ago Docs: man:systemd-networkd.service(8) Main PID: 857 (systemd-network) Status: "Processing requests..." CGroup: /system.slice/systemd-networkd.service └─857 /usr/lib/systemd/systemd-networkd Nov 11 23:04:35 taroxhost systemd-networkd[857]: br0: Could not set hostname: Permission denied Nov 11 23:21:28 taroxhost systemd-networkd[857]: virbr0-nic: Gained carrier Nov 11 23:21:28 taroxhost systemd-networkd[857]: virbr0-nic: Lost carrier Nov 11 23:21:28 taroxhost systemd-networkd[857]: virbr0-nic: Removing non-existent address: fe80::5054:ff:fe04:b6df/64 (valid for ever) Nov 11 23:22:30 taroxhost systemd-networkd[857]: virbr0-nic: Gained carrier Nov 11 23:22:31 taroxhost systemd-networkd[857]: virbr0-nic: Lost carrier Nov 11 23:22:31 taroxhost systemd-networkd[857]: virbr0-nic: Removing non-existent address: fe80::5054:ff:fe04:b6df/64 (valid for ever) Nov 11 23:23:34 taroxhost systemd-networkd[857]: virbr0-nic: Gained carrier Nov 11 23:23:34 taroxhost systemd-networkd[857]: virbr0-nic: Lost carrier Nov 11 23:23:34 taroxhost systemd-networkd[857]: virbr0-nic: Removing non-existent address: fe80::5054:ff:fe04:b6df/64 (valid for ever) Run `networkctl`: $ networkctl IDX LINK TYPE OPERATIONAL SETUP 1 lo loopback carrier unmanaged 2 enp5s0 ether off unmanaged 3 enp6s0 ether degraded configured 4 enp129s18 ether off unmanaged 5 enp129s18f4 ether off unmanaged 6 enp129s19 ether off unmanaged 7 ens5f0 ether off unmanaged 8 enp129s16f1 ether off unmanaged 9 enp129s16f5 ether off unmanaged 10 enp129s17f1 ether off unmanaged 11 enp129s17f5 ether off unmanaged 12 enp129s18f1 ether off unmanaged 13 enp129s18f5 ether off unmanaged 14 enp129s19f1 ether off unmanaged 15 ens5f1 ether off unmanaged 16 enp129s16 ether off unmanaged 17 enp129s16f4 ether off unmanaged 18 enp129s17 ether off unmanaged 19 enp129s17f4 ether off unmanaged 20 br0 ether routable configured 21 ip_vti0 tunnel off unmanaged 30 virbr0 ether no-carrier unmanaged 31 virbr0-nic ether off unmanaged 23 links listed.