Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Stop dhcp overwriting resolv.conf
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
timbp
n00b
n00b


Joined: 07 Nov 2008
Posts: 12

PostPosted: Sat Nov 08, 2008 8:21 am    Post subject: Stop dhcp overwriting resolv.conf Reply with quote

I know I had this working yesterday, but today I can't work it out.

I'm using DHCP to get my network settings, except that gives the router address as the nameserver, and various programs (such as wget) do not get proper addresses from the router.
So I want my nameserver to be the ISP nameserver.

My /etc/conf.d/net file currently has only the line
dns_servers_eth0=( "203.0.178.191" )

As far as I recall, that was all I needed yesterday, but today it doesn't work. Every time the lease is renewed, resolv.conf gets rewritten to use my router as the nameserver.

What have I done wrong?

Furthermore, how do I change the lease time? As this is in my own home with nobody else connecting, I can't see any need to renew the lease every hour or so. I guess I should use static IPs, but dhcp was easier (at least when I was Windows only).
Back to top
View user's profile Send private message
kds66
Apprentice
Apprentice


Joined: 17 Oct 2006
Posts: 166
Location: Manaus, Brazil

PostPosted: Sat Nov 08, 2008 8:42 am    Post subject: Reply with quote

To prevent /etc/resolv.conf from being overwritten, add the following line to /etc/conf.d/net:
Code:
dhcpcd_eth0="-R"

The lease time is determined AFAIK by the dhcp server.
Back to top
View user's profile Send private message
timbp
n00b
n00b


Joined: 07 Nov 2008
Posts: 12

PostPosted: Sat Nov 08, 2008 9:19 am    Post subject: Reply with quote

Thank you.

Found the lease setting in my router and changed that.

Also added your line to my /etc/conf.d/net

Now perhaps I can start a major merge and leave it, and not come back hours later to find it couldn't download from 1.0.0.0
Back to top
View user's profile Send private message
kds66
Apprentice
Apprentice


Joined: 17 Oct 2006
Posts: 166
Location: Manaus, Brazil

PostPosted: Sat Nov 08, 2008 12:10 pm    Post subject: Reply with quote

You're welcome, I'm glad I could help.

Hint: add "[solved]" to the the subject when your problem has been resolved.
Back to top
View user's profile Send private message
timbp
n00b
n00b


Joined: 07 Nov 2008
Posts: 12

PostPosted: Sat Nov 08, 2008 12:17 pm    Post subject: Reply with quote

But not solved :(

Just went to emerge something else and found emerge/wget trying to connect to 1.0.0.0
/etc/resolv.conf currently has
Code:
dns_servers_eth0=( "203.0.178.191" )
dhcpd_eth0="-R"

But stilll /etc/resolv.conf was overwritten with "nameserver 192.168.1.1".
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Sat Nov 08, 2008 4:42 pm    Post subject: Reply with quote

There wasn't a comment at the top saying which program generated resolv.conf?
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
kds66
Apprentice
Apprentice


Joined: 17 Oct 2006
Posts: 166
Location: Manaus, Brazil

PostPosted: Sat Nov 08, 2008 5:21 pm    Post subject: Reply with quote

timbp wrote:
But not solved :(

Just went to emerge something else and found emerge/wget trying to connect to 1.0.0.0
/etc/resolv.conf currently has
Code:
dns_servers_eth0=( "203.0.178.191" )
dhcpd_eth0="-R"


That should go into /etc/conf.d/net - not resolv.conf.
Back to top
View user's profile Send private message
RedSquirrel
Guru
Guru


Joined: 22 Apr 2008
Posts: 336

PostPosted: Sat Nov 08, 2008 5:29 pm    Post subject: Reply with quote

From /etc/conf.d/net.example:

Quote:
# GENERIC DHCP OPTIONS
# Set generic DHCP options like so
#dhcp_eth0="release nodns nontp nonis nogateway nosendhost"

# This tells the dhcp client to release it's lease when it stops, not to
# overwrite dns, ntp and nis settings, not to set a default route and not to
# send the current hostname to the dhcp server and when it starts.
# You can use any combination of the above options - the default is not to
# use any of them.
Back to top
View user's profile Send private message
timbp
n00b
n00b


Joined: 07 Nov 2008
Posts: 12

PostPosted: Sat Nov 08, 2008 9:14 pm    Post subject: Reply with quote

kds66 wrote:
timbp wrote:
But not solved :(

Just went to emerge something else and found emerge/wget trying to connect to 1.0.0.0
/etc/resolv.conf currently has
Code:
dns_servers_eth0=( "203.0.178.191" )
dhcpd_eth0="-R"


That should go into /etc/conf.d/net - not resolv.conf.

It was in the right file, I just wrote the wrong thing on the forum.

But it didn't work anyway.

I'll try dhcp_eth0="nodns"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum