[systemd-devel] Satitic IP in container

arnaud gaboury arnaud.gaboury at gmail.com
Mon Mar 3 02:35:13 PST 2014


>
> On host side :
> **** /etc/systemd/network/70-dahlia.netdev ***
> [Match]
> Host=host0
> Virtualization=container
>
> [NetDev]
> Name=br0
> Kind=bridge
>
> [Match]
> Virtualization=container
>
> *** /etc/systemd/network/80-dahlia.network ***
> [Network]
> DHCP=no
> DNS=192.168.1.254
>
>
> [Address]
> Address=192.168.1.94/24
>
> [Route]
> Gateway=192.168.1.254

> -----------------------------------
> Start the container
> # sudo systemd-nspawn --machine=dahlia --network-bridge=br0 -bD /dahlia
>
> *** On host : ***
>
> gabx at hortensia ➤➤ systemd/network % 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: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
> state DOWN group default
>     link/ether 7a:21:78:cc:bc:a9 brd ff:ff:ff:ff:ff:ff
> 8: vb-dahlia: <BROADCAST,MULTICAST> mtu 1500 qdisc noop master br0
> state DOWN group default qlen 1000
>     link/ether 7a:21:78:cc:bc:a9 brd ff:ff:ff:ff:ff:ff
>

> *** on Container: ***
>
> On container, I have of course systemd-networkd enable, and no files in /etc/systemd/networkd

> gab at dahlia ➤➤ ~ % ip addr show host0
> 2: host0: <NO-CARRIER,BROADCAST,ALLMULTI,AUTOMEDIA,NOTRAILERS,UP> mtu
> 1500 qdisc pfifo_fast state DOWN group default qlen 1000
>     link/ether 3a:4f:1f:c5:b5:d1 brd ff:ff:ff:ff:ff:ff
>     inet 192.168.1.94/24 brd 192.168.1.255 scope global host0
>        valid_lft forever preferred_lft forever

> gab at dahlia ➤➤ ~ % ip route
> default via 192.168.1.254 dev host0
> 192.168.1.0/24 dev host0  proto kernel  scope link  src 192.168.1.94
>
> gab at dahlia ➤➤ ~ % ping -c 3 8.8.8.8
> PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
> From 192.168.1.94 icmp_seq=1 Destination Host Unreachable
> From 192.168.1.94 icmp_seq=2 Destination Host Unreachable
> From 192.168.1.94 icmp_seq=3 Destination Host Unreachable
>

Network is thus unreachable on the container.
As we can see above, host0 is listed as DOWN. I have no idea why.

# ip link set dev host0 up
does no effect, host0 is still down

Now some debugging outputs:

gab at dahlia ➤➤ ~ % ip route show
default via 192.168.1.254 dev host0
192.168.1.0/24 dev host0  proto kernel  scope link  src 192.168.1.94

gab at dahlia ➤➤ ~ % cat /etc/resolv.conf
# Generated by resolvconf
domain lan
nameserver 192.168.1.254

gab at dahlia ➤➤ ~ # SYSTEMD_LOG_LEVEL=debug /lib/systemd/systemd-networkd
timestamp of '/etc/systemd/network' changed
timestamp of '/run/systemd/network' changed
host0: link (with ifindex 2) added
lo: link (with ifindex 1) added
Sent message type=method_call sender=n/a
destination=org.freedesktop.DBus object=/org/freedesktop/DBus
interface=org.freedesktop.DBus member=Hello cookie=1 reply_cookie=0
error=n/a
Got message type=method_return sender=org.freedesktop.DBus
destination=:1.7 object=n/a interface=n/a member=n/a cookie=1
reply_cookie=1 error=n/a
Got message type=signal sender=org.freedesktop.DBus destination=:1.7
object=/org/freedesktop/DBus interface=org.freedesktop.DBus
member=NameAcquired cookie=2 reply_cookie=0 error=n/a


gab at dahlia ➤➤ ~ % ping -c3 192.168.1.254
PING 192.168.1.254 (192.168.1.254) 56(84) bytes of data.
64 bytes from 192.168.1.254: icmp_seq=1 ttl=64 time=0.036 ms
64 bytes from 192.168.1.254: icmp_seq=2 ttl=64 time=0.034 ms
64 bytes from 192.168.1.254: icmp_seq=3 ttl=64 time=0.042 ms

--- 192.168.1.254 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.034/0.037/0.042/0.006 ms

I can ping the router
Why is my host0 shown as down and can't be up with the ip command ?
Do I need some conf files in container in /etc/systemd/netwrok/ ? I
tried to add some but it didn't changed anything.
I guess there is something wrong in my setup, but I have no idea what.

Thank you for help. I have been working on this setup for many days
now with no success.


More information about the systemd-devel mailing list