Handling resolv.conf on Ubuntu Server 14.04 LTS
Tom H
tomh0665 at gmail.com
Sat Jun 14 06:45:39 UTC 2014
On Sat, Jun 14, 2014 at 1:03 AM, Niki Kovacs <info at microlinux.fr> wrote:
>
> I've just installed Ubuntu 14.04 LTS on a public server. Until now I've
> mainly used Slackware for this sort of thing. I'm doing a lot of RTFM to see
> how Ubuntu handles things.
>
> Right now I'm into configuring DNS with BIND, and something puzzles me. The
> traditional *NIX way of configuring the resolver is to just add a line or a
> couple lines in /etc/resolv.conf. Now Ubuntu doesn't handle things that way,
> and after reading the corresponding section in the official documentation,
> here's what my /etc/network/interfaces looks like:
>
> --8<----------------------------------------
> # /etc/network/interfaces
>
> # lo
> auto lo
> iface lo inet loopback
>
> # eth0
> auto eth0
> iface eth0 inet static
> address 195.154.104.191
> netmask 255.255.255.0
> gateway 195.154.104.1
> dns-nameservers 62.210.16.6 62.210.16.7
> dns-search online.net
> --8<----------------------------------------
>
> Now let's say I just installed BIND and want to use it, be it as a simple
> caching nameserver or as a primary domain server. In that case, on a
> traditional *NIX system I'd simply open /etc/resolv.conf and add the
> following line :
>
> nameserver 127.0.0.1
>
> And that's it. Immediate effect, without restarting anything.
>
> Now I wanted to do something similar on my Ubuntu server, so I figured this
> information would go in /etc/network/interfaces, like this:
>
> # eth0
> auto eth0
> iface eth0 inet static
> address 195.154.104.191
> netmask 255.255.255.0
> gateway 195.154.104.1
> dns-nameservers 127.0.0.1
> dns-search online.net
>
> And now what ? Invoking '/etc/init.d/networking restart' has no effect on
> the content of /etc/resolv.conf, which still keeps the old values.
>
> Do I really have to restart my whole server just to change my DNS resolver ?
> There must surely be another way.
1) It's '/etc/init/networking.conf' that controls the ifupdown network
configuration not '/etc/init.d/networking'.
2) It's best to use 'service <service> restart' but in the case of
'/etc/init/networking.conf' it's best to use 'ifdown eth0 ; ifup eth0'
(IIRC 'service networking restart' and '[initctl] restart networking'
error out).
3) For upstart jobs, you can use '[initctl] restart <service>'.
4) For sysvinit scripts, you can use 'env -i DISPLAY="$DISPLAY" LANG=C
PATH=/bin:/usr/bin:/sbin:/usr/sbin TERM="${TERM:-vt100}"
/etc/init.d/<service>'.
More information about the ubuntu-users
mailing list