How should resolvconf handle multiple interfaces in /etc/network/interfaces

Tags:

Answer: 1

5 hours ago

I'm on a fresh Ubuntu 16.04.02 LTS and at installation I assigned it address 192.168.0.151, dns-nameservers 192.168.0.10 192.168.0.11 and dns-search example.com.

So after installation and reboot I got /etc/network/interfaces with this content:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens18
iface ens18 inet static
    address 192.168.0.151
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
    gateway 192.168.0.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 192.168.0.10 192.168.0.11
    dns-search example.com

And /etc/resolv.conf as:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.100.10
nameserver 192.168.100.11
search favoptic.com

This is all OK and works as expected! But now I want to add 2 vip-addresses (Virtual IP address or aliases), so I add the following to /etc/network/interfaces without changing any of the things already present (just adding):

auto ens18:0
iface ens18 inet static
    address 192.168.0.152
    netmask 255.255.255.0

auto ens18:1
iface ens18 inet static
    address 192.168.0.153
    netmask 255.255.255.0

After reboot I now got 3 working ip's on the host.

BUT now /etc/resolv.conf is empty, only this:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

So dns resolution does not work any more. Ex:

$ ping askubuntu.com
ping: unknown host askubuntu.com

I have another host installed with Ubuntu 14.04.5 LTS, and I have similar setup of interfaces and ip's there and it all works flawlessly!


Solution

If I add dns-nameservers and dns-search to both of the vip-definitions it will work, but it seems to be a bit redundant. Is this a bug or designed this way just to puzzle me?

Added by: Joyce Torp II

Popular Search

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9