[systemd-devel] Understanding DHCP, DNS and IPMasquerade

Johannes Ernst johannes.ernst at gmail.com
Sat Jun 13 13:55:17 PDT 2015


> On Jun 13, 2015, at 2:33, joerg.systemd at higgsboson.tk <mailto:joerg.systemd at higgsboson.tk> wrote:
> 
> 13. Juni 2015 02:32 Uhr, "Johannes Ernst" <johannes.ernst at gmail.com <mailto: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

I did. No change. I do receive the IP address (so DHCP IP assignment is working) but I do not receive the DNS server.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150613/113b6273/attachment.html>


More information about the systemd-devel mailing list