[systemd-devel] Understanding DHCP, DNS and IPMasquerade

Johannes Ernst johannes.ernst at gmail.com
Fri Jun 12 17:32:44 PDT 2015


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)

Thanks,


Johannes.



More information about the systemd-devel mailing list