How to set DNS on Ubuntu 12.04 clients?

590 views
Skip to first unread message

Sandra Schlichting

unread,
Sep 11, 2012, 10:00:03 AM9/11/12
to puppet...@googlegroups.com
Hi all =)

Does anyone know of a module that can configure the DNS on Ubuntu 12.04 clients?

This module works for CentOS and Ubuntu < 12.04


but in Ubuntu 12.04 you can't just overwrite the /etc/resolv.conf anymore. DNS have to be set in /etc/network/interfaces

Does anyone know how to do this in puppet?

Hugs,
Sandra =)

Andreas Ntaflos

unread,
Sep 11, 2012, 11:16:59 AM9/11/12
to puppet...@googlegroups.com
On 11/09/12 16:00, Sandra Schlichting wrote:
> Hi all =)
>
> Does anyone know of a module that can configure the DNS on Ubuntu 12.04
> clients?
>
> This module works for CentOS and Ubuntu < 12.04
>
> http://forge.puppetlabs.com/saz/resolv_conf
>
> but in Ubuntu 12.04 you can't just overwrite the /etc/resolv.conf
> anymore. DNS have to be set in /etc/network/interfaces

Not necessarily. I have not tried this myself yet, but you can put
static DNS settings in /etc/resolvconf/resolv.conf.d/{head,base,tail}.
Afterwards call "service resolvconf restart". See here for details:
http://www.stgraber.org/2012/02/24/dns-in-ubuntu-12-04/

You should be able to adapt the resolv_conf module accordingly, or write
your own.

Andreas

signature.asc

Stephen Gran

unread,
Sep 11, 2012, 11:23:37 AM9/11/12
to puppet...@googlegroups.com
Hi,
Surely if you're statically configuring DNS on a server, you don't want
a dynamic DNS configuration daemon running on the same server.

Presumably something like:

package { 'resolvconf':
ensure => purged
}

And then get on with your life?

Cheers,
--
Stephen Gran
Senior Systems Integrator - guardian.co.uk

Please consider the environment before printing this email.
------------------------------------------------------------------
Visit guardian.co.uk - newspaper of the year

www.guardian.co.uk www.observer.co.uk www.guardiannews.com

On your mobile, visit m.guardian.co.uk or download the Guardian
iPhone app www.guardian.co.uk/iphone and iPad edition www.guardian.co.uk/iPad

Save up to 37% by subscribing to the Guardian and Observer - choose the papers you want and get full digital access.
Visit guardian.co.uk/subscribe

---------------------------------------------------------------------
This e-mail and all attachments are confidential and may also
be privileged. If you are not the named recipient, please notify
the sender and delete the e-mail and all attachments immediately.
Do not disclose the contents to another person. You may not use
the information for any purpose, or store, or copy, it in any way.

Guardian News & Media Limited is not liable for any computer
viruses or other material transmitted with or as part of this
e-mail. You should employ virus checking software.

Guardian News & Media Limited

A member of Guardian Media Group plc
Registered Office
PO Box 68164
Kings Place
90 York Way
London
N1P 2AP

Registered in England Number 908396

Sandra Schlichting

unread,
Sep 11, 2012, 11:44:32 AM9/11/12
to puppet...@googlegroups.com
Surely if you're statically configuring DNS on a server, you don't want
a dynamic DNS configuration daemon running on the same server.

Presumably something like:

package { 'resolvconf':
        ensure => purged
}

And then get on with your life?

That is a very attractive solution fore sure!

Should I just ignore that it depends on the "ubuntu-minimal" package?


Joe Topjian

unread,
Sep 11, 2012, 11:54:01 AM9/11/12
to puppet...@googlegroups.com
That is a very attractive solution fore sure!

Should I just ignore that it depends on the "ubuntu-minimal" package?

ouch. 

Since /etc/resolv.conf is a symlink to resolvconf's resolv.conf, you can break the symlink, turn resolv.conf into a normal static file and then use the puppet module.

I am not 100% confident of this solution, though, since I'm not sure if resolvconf will recreate the symlink at some point -- I haven't used this solution enough to confirm that.

Thanks,
Joe


--
Joe Topjian
Systems Administrator
Cybera Inc.


Big data is coming to Canada. Join the welcome wagon.
Cyber Summit 2012
October 1-3, Banff

Cybera is a not-for-profit organization that works to spur and support innovation, for the economic benefit of Alberta, through the use of cyberinfrastructure.

Stephen Gran

unread,
Sep 11, 2012, 11:59:15 AM9/11/12
to puppet...@googlegroups.com
Hi,
It won't cause any harm (as in, lack of functionality) - the
ubuntu-minimal package only exists to make sure other software is
installed. If you are uneasy about removing the package, you can also
presumably just make sure the service doesn't run.

Craig White

unread,
Sep 11, 2012, 12:28:26 PM9/11/12
to puppet...@googlegroups.com

On Sep 11, 2012, at 8:54 AM, Joe Topjian wrote:

> That is a very attractive solution fore sure!
>
> Should I just ignore that it depends on the "ubuntu-minimal" package?
>
> ouch.
>
> Since /etc/resolv.conf is a symlink to resolvconf's resolv.conf, you can break the symlink, turn resolv.conf into a normal static file and then use the puppet module.
>
> I am not 100% confident of this solution, though, since I'm not sure if resolvconf will recreate the symlink at some point -- I haven't used this solution enough to confirm that.
----
if /etc/resolv.conf is a puppet maintained file, even if resolvconf package is updated, it will be replaced by the puppet asserted file anyway.

Craig

Sandra Schlichting

unread,
Sep 11, 2012, 12:29:32 PM9/11/12
to puppet...@googlegroups.com
Not necessarily. I have not tried this myself yet, but you can put
static DNS settings in /etc/resolvconf/resolv.conf.d/{head,base,tail}.
Afterwards call "service resolvconf restart". See here for details:
http://www.stgraber.org/2012/02/24/dns-in-ubuntu-12-04/

Just tried it, and just treating /etc/resolvconf/resolv.conf.d/base as your /etc/resolv.conf works.
 
You should be able to adapt the resolv_conf module accordingly, or write
your own.

That should be interesting. I on it =)

 

Joe Topjian

unread,
Sep 11, 2012, 1:08:49 PM9/11/12
to puppet...@googlegroups.com
if /etc/resolv.conf is a puppet maintained file, even if resolvconf package is updated, it will be replaced by the puppet asserted file anyway.

Very true, but I would hate to have two services fighting with each other in that way. 

Craig White

unread,
Sep 12, 2012, 11:17:34 AM9/12/12
to puppet...@googlegroups.com

On Sep 11, 2012, at 10:08 AM, Joe Topjian wrote:

> if /etc/resolv.conf is a puppet maintained file, even if resolvconf package is updated, it will be replaced by the puppet asserted file anyway.
>
> Very true, but I would hate to have two services fighting with each other in that way.
----
well, I upgraded a 10.04 test server to 12.04 and noticed the messaging about the dynamic nature of /etc/resolv.conf in the Ubuntu server list but it hasn't been a problem at all so I have left it alone (with puppet fully managing /etc/resolv.conf). There's been no contention so I gather that if /etc/resolv.conf isn't a symlink, it isn't mucked with by the Ubuntu/Debian packaging.

I am however starting to gear up for testing puppet 3, on a test server and ruby 1.93 clients with puppet 3 and even though the current estimate is another year of 10.04 for new deploys, I have an eye on this issue but so far, it's not been a problem.

Craig
Reply all
Reply to author
Forward
0 new messages