[systemd-devel] systemd-nspawn network ping

kennedy kennedyhan at 163.com
Mon Feb 29 06:42:26 UTC 2016


Thanks! it works!
but I had a little question.
In my container, I run `route -n` it show me 3 result ,they are:


Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         0.0.0.0         U     2048   0        0 host0
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 host0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 host0


What's the "169.254.0.0" comes from ? I'v never configured that.


and when I add the "--network-veth" option on systemd-nspawn, the "169.254.0.0" it's disappeared.


------
Yours Sincerely
Han



At 2016-02-29 00:26:54, "Kai Krakow" <hurikhan77 at gmail.com> wrote:
>Am Sun, 28 Feb 2016 23:41:22 +0800 (CST)
>schrieb kennedy <kennedyhan at 163.com>:
>
>> how to ping container to container each other in systemd-nspawn ?
>> I've tried --network-veth option but it doesn't work enough.
>
>You need to join all host-side veth interfaces into the same bridge.
>Make two files for systemd-networkd:
>
># 99-bridge-cn.netdev
>[NetDev]
>Name=br-containers
>Kind=bridge
>[Match]
>Name=br-containers
>
># 99-bridge-cn.network
>[Network]
>Address=10.0.0.1/24
>DHCPServer=yes
>IPForward=yes
>IPMasquerade=yes
>
>Then "systemctl --edit systemd-nspawn at .service" to contain the
>following:
>
>############
>[Service]
>ExecStart=
>ExecStart=/usr/bin/systemd-nspawn --quiet --keep-unit --boot \
>--link-journal=try-guest --private-network \
>--network-bridge=br-containers --machine=%I
>############
>
>This will add all your container veth devices to the same bridge which
>you configured in systemd-networkd. You should now be able to ping each
>other.
>
>You may need to adjust a few more settings for your needs. I'd
>recommend to add nss-mymachines (see man page).
>
>
>-- 
>Regards,
>Kai
>
>Replies to list-only preferred.
>
>_______________________________________________
>systemd-devel mailing list
>systemd-devel at lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20160229/3f37069d/attachment.html>


More information about the systemd-devel mailing list