[systemd-devel] Understanding DHCP, DNS and IPMasquerade

joerg.systemd at higgsboson.tk joerg.systemd at higgsboson.tk
Sat Jun 13 02:33:42 PDT 2015


13. Juni 2015 02:32 Uhr, "Johannes Ernst" <johannes.ernst at gmail.com> schrieb:

> My host obtains an IP address and DNS server via DHCP from upstream via Ethernet like this (systemd
> 219, Arch Linux)
> 
> [Match]
> Name=en*
> 
> [Network]
> DHCP=ipv4
> 
> It has the resolv.conf symlink to /run/systemd/resolve/resolv.conf, and the DNS server from DHCP
> shows up there.
> 
> It also has this test.network file:
> 
> [Match]
> Name=ve-*
> 
> [Network]
> Address=0.0.0.0/28
> IPMasquerade=yes
> IPv4LL=yes
> DHCPServer=yes
> IPForward=yes
> 
> My host runs a container like this: (systemd 219, UBOS (just like Arch Linux))
> 
> systemd-nspawn -b -D test -n
> 
> The container does not have any networkd configuration. It has the resolv.conf symlink, and runs
> systemd-networkd
> 
> I was expecting:
> * container gets an IP address from host in some new subnet: WORKS, e.g 10.0.0.2
> * container can route to upstream via IPMasquerade: WORKS, after manual 'modprobe iptable_nat'
> * container gets the DNS server from the host: FAILS: /etc/resolv.conf points to Google name
> servers instead (8.8.8.8 etc)
> * host and container can ping test (if test is the name of the container machine per machinectl):
> FAILS, neither can
> 
> What am I misunderstanding or doing wrong? If somebody educates me, I’ll put the insights on a wiki
> somewhere (e.g. Arch)

Hi, you need to configure the networkd inside your container to issue DHCP-Request on its own
interface,
like you did on the host:

[Match]
Type=ethernet

[Network]
DHCP=ipv4

> Thanks,
> 
> Johannes.
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 603 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150613/45445acd/attachment.sig>


More information about the systemd-devel mailing list