Unix Technical Forum

Using DHCP but specifying DNS servers manually

This is a discussion on Using DHCP but specifying DNS servers manually within the Gentoo Linux Support forums, part of the Unix Operating Systems category; --> I've a laptop running gentoo that I use at home & work, with DHCP on both sites. It works ...


Go Back   Unix Technical Forum > Unix Operating Systems > Gentoo Linux Support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-21-2008, 10:06 AM
Stephen Patterson
 
Posts: n/a
Default Using DHCP but specifying DNS servers manually

I've a laptop running gentoo that I use at home & work, with DHCP on
both sites. It works just fine at home, but the DHCP server at work
gives out the wrong DNS server address so I'd like to enter the DNS
server manually for this network without having to edit resolv.conf
manually every time.

Is there any way I can do this?

--
Stephen Patterson steve@patter.mine.nu http://patter.mine.nu/
Linux Counter No: 142831 GPG Public key: E3E8E974
"Whoever said nothing is impossible never tried slamming a revolving door."
-- Melissa O'Brien
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-21-2008, 10:06 AM
Paul Bredbury
 
Posts: n/a
Default Re: Using DHCP but specifying DNS servers manually

Stephen Patterson wrote:
> I've a laptop running gentoo that I use at home & work, with DHCP on
> both sites. It works just fine at home, but the DHCP server at work
> gives out the wrong DNS server address so I'd like to enter the DNS
> server manually for this network without having to edit resolv.conf
> manually every time.


If resolv.conf is getting changed by DHCP, then you can probably use
/etc/ppp/ip-up.local to change it again. Put in a command such as:

cp -p /etc/resolv.conf-dns /etc/resolv.conf

And create /etc/resolv.conf-dns. Check that it has the same permissions
as /etc/resolv.conf
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-21-2008, 10:06 AM
Johan Lindquist
 
Posts: n/a
Default Re: Using DHCP but specifying DNS servers manually

So anyway, it was like, 14:03 CEST Jun 17 2005, you know? Oh, and, yeah,
Stephen Patterson was all like, "Dude,

> I've a laptop running gentoo that I use at home & work, with DHCP on
> both sites. It works just fine at home, but the DHCP server at work
> gives out the wrong DNS server address so I'd like to enter the DNS
> server manually for this network without having to edit resolv.conf
> manually every time.
>
> Is there any way I can do this?


'man dhclient' seems to suggest you can use overrides for mostly all
the dhcp parameters by indicating such in the config file. If you're
using dhcpcd, it's -R.

--
Time flies like an arrow, fruit flies like a banana. Perth ---> *
14:54:53 up 26 days, 19:32, 10 users, load average: 2.21, 2.36, 2.23
Linux 2.6.11.10 x86_64 GNU/Linux Registered Linux user #261729
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-21-2008, 10:06 AM
Anno v. Heimburg
 
Posts: n/a
Default Re: Using DHCP but specifying DNS servers manually

Stephen Patterson wrote:

> I've a laptop running gentoo that I use at home & work, with DHCP on
> both sites.


You can stop dhcp from modifying configuration file by passing appropriate
options in /etc/conf.d/net

See man 8 dhcpcd.
Relevant excerpt:
| -R Prevents dhcpcd from replacing existing /etc/resolv.conf file.

For reference, this is from my /etc/conf/net:

| iface_eth0="dhcp"
| dhcpcd_eth0="-N -Y"

This tells the startup script to configure eth0 using dhcp, and the dhcp
client not to change /etc/ntp.conf (-N) and /etc/yp.conf (-Y).

Anno.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:53 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com