[systemd-devel] Satitic IP in container

arnaud gaboury arnaud.gaboury at gmail.com
Sat Mar 1 08:24:53 PST 2014


On Sat, Mar 1, 2014 at 3:26 PM, arnaud gaboury <arnaud.gaboury at gmail.com> wrote:
>
>
>>
>> No, --network-bridge=br0 means that a pair of veth devices are created
>> (host0 inside the container and vb-* outside), and the vb-* is added
>> to your bridge br0. So you should really have host0 in the container
>> with this option. However, if you don't, which device did this mac
>> address you used to match on come from?
>>
>> Yeah, this won't work, as networkd will not be in your container, so
>> it can't set up your ip address...
>>
>> Cheers,
>>
>> Tom
>
>
> I will maybe see the light then !
> I am still confused about what shall be done in the host machine, and what in the container.
> Let's go systemd -git and --network-bridge= br0
>
I am nearly done.

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=('212.147.10.162' '212.147.10.180')


[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

Now on Container:

gab at dahlia ➤➤ ~ % ip addr
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  <<<< IP
is finally here
       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


BUT
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


On container, I have of course systemd-networkd enable. I have the
same file /etc/systemd/network/80-dahlia.network . Not sure if I do
need it. When removed, I lost the IP.
No netctl profile enable, no dhcpcd.service enable. /etc/conf.d is empty

Any idea why I can't reach the network ?

Again TY for help


More information about the systemd-devel mailing list