This is my container host machine:
gpsemc@lxd:~$ ifconfig
br0 Link encap:Ethernet HWaddr 00:50:56:bd:8a:a0
inet addr:10.62.90.147 Bcast:10.62.90.255 Mask:255.255.255.128
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1990472 errors:0 dropped:646 overruns:0 frame:0
TX packets:198517 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:818460410 (818.4 MB) TX bytes:14861277 (14.8 MB)
gpsemc@lxd:~$ lxc profile show 10.62.90.147
config: {}
description: 10.62.90.147-network
devices:
eth0:
name: eth0
nictype: bridged
parent: br0
type: nic
name: 10.62.90.147
This is the network information inside the container:
[root@fedora3011 ~]# cat /etc/systemd/network/eth0.network
[Match]
Name=eth0
[Network]
Address=10.62.90.206/25
Gateway=10.62.90.129
DNS=10.254.174.10
But I always get below error:
root@fedora3011 ~]# systemctl restart systemd-networkd
Job for systemd-networkd.service failed.
See âsystemctl status systemd-networkd.serviceâ and âjournalctl -xeâ for details.
[root@fedora3011 ~]# systemctl status systemd-networkd.service
â systemd-networkd.service - Network Service
Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2019-08-28 15:39:16 UTC; 1min 32s ago
Docs: man:systemd-networkd.service(8)
Process: 160 ExecStart=/usr/lib/systemd/systemd-networkd (code=exited, status=226/NAMESPACE)
Main PID: 160 (code=exited, status=226/NAMESPACE)
Aug 28 15:39:16 fedora3011 systemd[1]: systemd-networkd.service: Service has no hold-off time (RestartSec=0), scheduling restart.
Aug 28 15:39:16 fedora3011 systemd[1]: systemd-networkd.service: Scheduled restart job, restart counter is at 5.
Aug 28 15:39:16 fedora3011 systemd[1]: Stopped Network Service.
Aug 28 15:39:16 fedora3011 systemd[1]: systemd-networkd.service: Start request repeated too quickly.
Aug 28 15:39:16 fedora3011 systemd[1]: systemd-networkd.service: Failed with result âexit-codeâ.
Aug 28 15:39:16 fedora3011 systemd[1]: Failed to start Network Service.
By the way, I am able to create a lot of containers in ubuntu 16.04. 18.04. But it cannot work for fedora.
For example, on ubuntu 18.04 it looks like this:
lxc launch ubuntu:18.04 sharon-ubuntu
root@sharon-ubuntu:~# cat /etc/netplan/50-cloud-init.yaml
network:
version: 2
ethernets:
eth0:
dhcp4: no
addresses: [10.62.90.206/25]
gateway4: 10.62.90.129
nameservers:
addresses: [10.254.174.10,10.104.128.235]