[systemd-devel] Satitic IP in container

arnaud gaboury arnaud.gaboury at gmail.com
Sat Mar 1 00:18:15 PST 2014


I set up successful a Arch container managed by systemd-nspsawn.

I have an issue setting an IP for the container.

My host is Arch, running custom Kernel 3.13.5-1 (userspace is set) and
systemd-git (lats updated yesterday evening).
dhcpcd.service is disabled and network is started with these profiles:
*************
Description="Bridge connection to container"
Interface=br0
Connection=bridge
BindsToInterfaces=()
IP=no
SkipNoCarrier=yes
*********************
NB : I tried with IP=static Adress='192.168.1.94/24' but nothing changes
****************
Description='hortensia static ethernet connection'
Interface=enp7s0
Connection=ethernet
After=(bridge-hortensia)
IP=static
Address=('192.168.1.87/24')
Gateway='192.168.1.254'
DNS=('212.147.10.180' '212.147.10.162')
*********************

Any other profiles will break the network on host and/or container

Somme command ouptuts:

gabx at hortensia ➤➤ ~ % ip addr
2: enp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP group default qlen 1000
    link/ether 14:da:e9:b5:7a:88 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.87/24 brd 192.168.1.255 scope global enp7s0
       valid_lft forever preferred_lft forever
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state
UNKNOWN group default
    link/ether 66:c3:60:92:5f:2c brd ff:ff:ff:ff:ff:ff
*********
gabx at hortensia ➤➤ /etc/netctl % ip route
default via 192.168.1.254 dev enp7s0
192.168.1.0/24 dev enp7s0  proto kernel  scope link  src 192.168.1.87
***************

Now I enabled systemd-network with these two files:
70-dahlia.netdev
*************
[Match]
Host=77f348a2b3fb429b85a5de751ea9175a  <<< /etc/machie id in conatiner
Virtualization=systemd-nspawn

[NetDev]
Name=br0
Kind=bridge

80-dahlia.network
*****************
[Match]
Virtualization=container
MACAddress=fa:2c:eb:75:bd:a4  <<< container MAC address

[Network]
DHCP=no
DNS=192.168.1.254

[Address]
Address=192.168.1.94/24

[Route]
Gateway=192.168.1.254
*********************************

I start the container this way :
# systemd-nspawn --machine=dahlia -bD /dahlia

Container network is up, but no IP assigned, as returned by ip addr

# systemd-nspawn --machine=dahlia --network-veth --network-bridge=br0  -bD
/dahlia    >>>> no network inside container
# systemd-nspawn --machine=dahlia --network-bridge=br0 -bD /dahlia  >>>no
network inside container

I certainly miss something, but do not know what.

Thank you for help/hints.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140301/9026e712/attachment.html>


More information about the systemd-devel mailing list