View previous topic :: View next topic |
Author |
Message |
timbp n00b
Joined: 07 Nov 2008 Posts: 12
|
Posted: Sat Nov 08, 2008 8:21 am Post subject: Stop dhcp overwriting resolv.conf |
|
|
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 |
|
|
kds66 Apprentice
Joined: 17 Oct 2006 Posts: 166 Location: Manaus, Brazil
|
Posted: Sat Nov 08, 2008 8:42 am Post subject: |
|
|
To prevent /etc/resolv.conf from being overwritten, add the following line to /etc/conf.d/net:
The lease time is determined AFAIK by the dhcp server. |
|
Back to top |
|
|
timbp n00b
Joined: 07 Nov 2008 Posts: 12
|
Posted: Sat Nov 08, 2008 9:19 am Post subject: |
|
|
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 |
|
|
kds66 Apprentice
Joined: 17 Oct 2006 Posts: 166 Location: Manaus, Brazil
|
Posted: Sat Nov 08, 2008 12:10 pm Post subject: |
|
|
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 |
|
|
timbp n00b
Joined: 07 Nov 2008 Posts: 12
|
Posted: Sat Nov 08, 2008 12:17 pm Post subject: |
|
|
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 |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
kds66 Apprentice
Joined: 17 Oct 2006 Posts: 166 Location: Manaus, Brazil
|
Posted: Sat Nov 08, 2008 5:21 pm Post subject: |
|
|
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 |
|
|
RedSquirrel Guru
Joined: 22 Apr 2008 Posts: 336
|
Posted: Sat Nov 08, 2008 5:29 pm Post subject: |
|
|
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 |
|
|
timbp n00b
Joined: 07 Nov 2008 Posts: 12
|
Posted: Sat Nov 08, 2008 9:14 pm Post subject: |
|
|
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 |
|
|
|