Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]How to let DHCP override my /etc/resolv.conf file
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
germanobax
Tux's lil' helper
Tux's lil' helper


Joined: 28 Apr 2005
Posts: 96

PostPosted: Tue May 22, 2007 8:34 pm    Post subject: [SOLVED]How to let DHCP override my /etc/resolv.conf file Reply with quote

Hi!
I switch networks constantly, but I don't understand why I can't automatically obtain DNS information via DHCP.

My /etc/conf.d/net file contains:

Code:

config_eth0=( "dhcp" )
modules=( "iwconfig" )

dhcp_eth0="nontp nonis nodns"


But it doesn't work. A comment in this file says: "This blank configuration will automatically use DHCP for any net.*", but commenting everything doesn't help either.

What can I do?
_________________
Life is a Sexually Transmitted Disease, with 100% mortality.


Last edited by germanobax on Fri May 25, 2007 1:58 pm; edited 1 time in total
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4735
Location: Angra do Heroísmo (PT)

PostPosted: Tue May 22, 2007 8:38 pm    Post subject: Re: How to let DHCP override my /etc/resolv.conf file Reply with quote

Hi.
germanobax wrote:
Hi!
I switch networks constantly, but I don't understand why I can't automatically obtain DNS information via DHCP.

You might want to try ethtool and resolvconf-gentoo.
germanobax wrote:

My /etc/conf.d/net file contains:
Code:

config_eth0=( "dhcp" )
modules=( "iwconfig" )

dhcp_eth0="nontp nonis nodns"


You really don't want nodns in there or it won't use the dns settings from the DHCP server.
_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
germanobax
Tux's lil' helper
Tux's lil' helper


Joined: 28 Apr 2005
Posts: 96

PostPosted: Tue May 22, 2007 9:02 pm    Post subject: Reply with quote

Thanks for your reply, but I don't know why I should use ethtool, neither how to use it to solve this problem. resolvconf-gentoo didn't help me too.
I removed the "nodns" part from the /etc/conf.d/net file, but no go.

The "great" solution I found is to boot with the LiveCD and copy the /etc/resolv.conf of the livecd to my disk everytime I switch networks. That's very annoying.
_________________
Life is a Sexually Transmitted Disease, with 100% mortality.
Back to top
View user's profile Send private message
mudrii
l33t
l33t


Joined: 26 Jun 2003
Posts: 789
Location: Singapore

PostPosted: Wed May 23, 2007 4:34 am    Post subject: Reply with quote

try to use the command
dhcpcd eth0
or
dhcpcd -HD eth0
to refresh IP settings in new network
_________________
www.gentoo.ro
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3942
Location: Hamburg

PostPosted: Wed May 23, 2007 7:28 am    Post subject: Reply with quote

Have a look into /etc/conf.d/domainname for the var OVERRIDE.
Back to top
View user's profile Send private message
germanobax
Tux's lil' helper
Tux's lil' helper


Joined: 28 Apr 2005
Posts: 96

PostPosted: Wed May 23, 2007 12:50 pm    Post subject: Reply with quote

Thanks for your help, guys. Unfortunately, things aren't working out yet. Let's see...

mudrii wrote:
try to use the command
dhcpcd eth0


Didn't work.


mudrii wrote:

dhcpcd -HD eth0
to refresh IP settings in new network


Says that "D" is an invalid option. I tried with just "H", but that didn't work too.

toralf wrote:
Have a look into /etc/conf.d/domainname for the var OVERRIDE.


Here's the output:

Code:

jbackes-laptop jbackes # cat /etc/conf.d/domainname
OVERRIDE=1


... still using a LiveCD... :cry:
_________________
Life is a Sexually Transmitted Disease, with 100% mortality.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3942
Location: Hamburg

PostPosted: Wed May 23, 2007 12:55 pm    Post subject: Reply with quote

Ehm, what about changing the line
Code:
dhcp_eth0="nontp nonis nodns"
into at least
Code:
dhcp_eth0="nontp"
Back to top
View user's profile Send private message
germanobax
Tux's lil' helper
Tux's lil' helper


Joined: 28 Apr 2005
Posts: 96

PostPosted: Wed May 23, 2007 1:20 pm    Post subject: Reply with quote

toralf wrote:
Ehm, what about changing the line
Code:
dhcp_eth0="nontp nonis nodns"
into at least
Code:
dhcp_eth0="nontp"


Did that:

Code:

cat /etc/conf.d/net

config_eth0=( "dhcp" )
modules=( "iwconfig" )
dhcp_eth0="nontp"


But the problem persists.
_________________
Life is a Sexually Transmitted Disease, with 100% mortality.
Back to top
View user's profile Send private message
Suicidal
l33t
l33t


Joined: 30 Jul 2003
Posts: 959
Location: /dev/null

PostPosted: Wed May 23, 2007 3:15 pm    Post subject: Reply with quote

I switch between my external lan which has dhcp and my (disjointed) local lan that does not have dhcp I have the following set:

Code:
modules=( "iproute2" )
config_eth0=( "dhcp" )
dhcp_eth0="release nontp"
dns_domain_eth0="myinternaldomain.local"
dns_servers_eth0="10.200.0.35 10.200.0.28 "
dns_search_eth0="myinternaldomain.local"
dns_options_eth0=( "timeout 1" "rotate" )
ntp_servers_eth0=( "10.200.0.18" "pool.ntp.org" )
fallback_eth0=( "10.200.78.221 netmask 255.255.255.0 broadcast 10.200.78.255" )
fallback_route_eth0=( "default via 10.200.78.1" )


eth0 will default to dhcp which will set the following in my /etc/recolv.conf

Code:
search myexternaldomain.com
nameserver 192.168.1.1
nameserver 192.168.1.1


If dhcp is not recieved networking will fallback to my fallback_eth0 ip and gateway, and it will set my dns_* entries

I think that:
Code:
dhcp_eth0="nodns"


is your problem

If you switch between alot of subnets you might want to look at the # ARPING Gateway configuration section in /etc/conf.d/net.example
Back to top
View user's profile Send private message
germanobax
Tux's lil' helper
Tux's lil' helper


Joined: 28 Apr 2005
Posts: 96

PostPosted: Wed May 23, 2007 3:43 pm    Post subject: Reply with quote

The problem is that most of the time I don't know or can't discover the correct IP, mask, domain, etc by myself (except when using the liveCD). DHCP should do the work of discovering all this information for me.

Mostly I simply don't know to which network I'm switching to, I just switch. DHCP gets an IP adress, but it doesn't set the DNS information in /etc/resolv.conf.
_________________
Life is a Sexually Transmitted Disease, with 100% mortality.
Back to top
View user's profile Send private message
germanobax
Tux's lil' helper
Tux's lil' helper


Joined: 28 Apr 2005
Posts: 96

PostPosted: Thu May 24, 2007 3:37 pm    Post subject: Reply with quote

Does anybody have another suggestion?
_________________
Life is a Sexually Transmitted Disease, with 100% mortality.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3942
Location: Hamburg

PostPosted: Thu May 24, 2007 3:45 pm    Post subject: Reply with quote

To sum it up, you use net-misc/dhcpcd-3.0.16-r1 or something similar and made an "/etc/init.d/net.eth0 restart" or something similar (eg during boot "start" is used), have a (nearly) stable Gentoo system without any obscure USE flags and it does not work for you, right ? (BTW, nice avatar)
Back to top
View user's profile Send private message
germanobax
Tux's lil' helper
Tux's lil' helper


Joined: 28 Apr 2005
Posts: 96

PostPosted: Thu May 24, 2007 4:04 pm    Post subject: Reply with quote

Exactly

Code:

jbackes@jbackes-laptop ~ $ esearch dhcpcd
[ Results for search key : dhcpcd ]
[ Applications found : 1 ]

*  net-misc/dhcpcd
      Latest version available: 3.0.16-r1
      Latest version installed: 3.0.16-r1
...


I always use "/etc/init.d/net.eth0 restart". My make.conf contains:

Code:

jbackes@jbackes-laptop ~ $ cat /etc/make.conf
CFLAGS="-O3 -pipe -march=athlon64"
CHOST="x86_64-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j2"

GENTOO_MIRRORS="http://adelie.polymtl.ca/ http://gentoo.osuosl.org/ ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://www.las.ic.unicamp.br/pub/gentoo/ ftp://ftp.las.ic.unicamp.br/pub/gentoo/ http://gentoo.inode.at/ "

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

FEATURES="parallel-fetch userfetch ccache"

CCACHE_SIZE="2G"
CCACHE_DIR="/var/tmp/ccache"

LINGUAS="pt_BR pt"

VIDEO_CARDS="radeon fglrx vmware"
INPUT_DEVICES="keyboard joystick mouse synaptics vmmouse"

USE = "3dnow a52 aac aalib aiglx apache2 apm bash-completion bindist bzip2
       cddb cdparanoia css daap dga directfb dts dv dvb exif fbcon ffmpeg flac
       ftp ggi gnutls gphoto2 graphviz idn imagemagick ipod jack java
       javascript jbig jikes joystick jpeg2k junit lcms libcaca libnotify
       libsamplerate lm_sensors lua matroska mmap mng mono mplayer musepack
       musicbrainz nas nocd nsplugin odbc openal php postgres samba scanner
       sndfile speex symlink tetex theora threads type1 usb v4l vcd videos
       visualization wifi wmf wxwindows x264 xine xinerama xosd xscreensaver
       xvid"



And my /etc/portage/package.use has:

Code:

jbackes@jbackes-laptop ~ $ cat /etc/portage/package.use
dev-java/sun-jdk doc
kde-base/kopete addbookmarks alias autoreplace connectionstatus contactnotes gadu groupwise highlight history irc jingle latex netmeeting nowlistening  sametime slp sms statistics texteffect translator webpresence winpopup yahoo
app-misc/beagle chm doc galago ole
sys-apps/lm_sensors sensord
x11-libs/qt qt3support
gnome-base/nautilus beagle
sys-power/cpufreqd pmu
games-rpg/nwn-data hou nowin sou
games-rpg/nwn hou sou
games-rpg/nwn-cep hou sou
mail-client/mozilla-thunderbird replytolist
net-www/mplayerplug-in divx gmedia realmedia wmp
media-video/mplayer 3dnowext amr bl cpudetection dv dvdnav enca lirc live lzo mmxext mp2 pnm rar real rtc srt tga tivo v4l2 xanim xvmc
www-servers/tomcat admin doc examples java5
media-video/vlc cdda dc1394 httpd live mod rtsp sdl-image shout skins stream vlm
media-video/transcode mjpeg extrafilters fame lzo network v4l2


Is there a problem in some use flags, that I'm not aware of?
_________________
Life is a Sexually Transmitted Disease, with 100% mortality.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Thu May 24, 2007 4:13 pm    Post subject: Reply with quote

Do you see any dns information in /var/lib/dhcpcd/dhcpcd-eth0.info ?
_________________
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
germanobax
Tux's lil' helper
Tux's lil' helper


Joined: 28 Apr 2005
Posts: 96

PostPosted: Thu May 24, 2007 4:16 pm    Post subject: Reply with quote

YES!

Code:

jbackes-laptop jbackes # cat /var/lib/dhcpcd/dhcpcd-eth0.info
IPADDR='143.54.10.149'
NETMASK='255.255.255.0'
BROADCAST='143.54.10.255'
ROUTES='0.0.0.0,0.0.0.0,143.54.10.1'
DNSDOMAIN='inf.ufrgs.br'
DNSSERVERS='143.54.11.9 143.54.11.7 143.54.9.1'
DHCPSID='143.54.11.9'
DHCPSNAME=''
LEASETIME='3600'
RENEWALTIME='1800'
REBINDTIME='3150'
INTERFACE='eth0'
CLASSID='dhcpcd 3.0.16'
CLIENTID='00:0f:b0:74:09:41'
DHCPCHADDR='00:0f:b0:74:09:41'


At least the LiveCD can be discarded now... But /etc/resolv.conf still needs manual editing.
_________________
Life is a Sexually Transmitted Disease, with 100% mortality.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3942
Location: Hamburg

PostPosted: Thu May 24, 2007 4:27 pm    Post subject: Reply with quote

No, you haven't any obscure compiler flags, look at my settings :
Code:
# These settings were set by the catalyst build script that automatically built this stage
# Please consult /etc/make.conf.example for a more detailed example
CFLAGS="-O2 -march=pentium-m -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
Ok, except that -O3 had have some rare bugs in the past compared to -O2 but I won't believe that this is the case here. ANd I hope that the file permissions are ok :
Code:
tfoerste@n22 ~ $ ls -l /etc/resolv.conf
-rw-r--r-- 1 root root 71 May 24 17:35 /etc/resolv.conf
?
Back to top
View user's profile Send private message
germanobax
Tux's lil' helper
Tux's lil' helper


Joined: 28 Apr 2005
Posts: 96

PostPosted: Thu May 24, 2007 4:31 pm    Post subject: Reply with quote

Yes, they are (but I don't know what that 88 means):

Code:

jbackes@jbackes-laptop ~ $ ls -l /etc/resolv.conf
-rw-r--r-- 1 root root 88 2007-05-23 10:18 /etc/resolv.conf

_________________
Life is a Sexually Transmitted Disease, with 100% mortality.
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4735
Location: Angra do Heroísmo (PT)

PostPosted: Thu May 24, 2007 4:42 pm    Post subject: Reply with quote

germanobax wrote:
Yes, they are (but I don't know what that 88 means):

Code:

jbackes@jbackes-laptop ~ $ ls -l /etc/resolv.conf
-rw-r--r-- 1 root root 88 2007-05-23 10:18 /etc/resolv.conf

That is the size of the file.
_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Thu May 24, 2007 4:44 pm    Post subject: Reply with quote

Now do this

dhcpcd -n eth0

Then post the contents of /etc/resolv.conf
Then state what you think is wrong about it, or post what you think it should look like.

So say you have resolvconf? Post the output of resolvconf -l
_________________
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
germanobax
Tux's lil' helper
Tux's lil' helper


Joined: 28 Apr 2005
Posts: 96

PostPosted: Thu May 24, 2007 4:54 pm    Post subject: Reply with quote

That's crazy:

Code:

jbackes-laptop jbackes # dhcpcd -n eth0
jbackes-laptop jbackes # cat /etc/resolv.conf


Gives nothing.

BUT resolvconf -l gives the correct information:

Code:

jbackes-laptop jbackes # resolvconf -l
# resolv.conf for interface eth0
# Generated by dhcpcd for interface eth0
search inf.ufrgs.br
nameserver 143.54.11.9
nameserver 143.54.11.7
nameserver 143.54.9.1


Man, /etc/resolv.conf is EMPTY... It should look like the output of resolvconf -l
_________________
Life is a Sexually Transmitted Disease, with 100% mortality.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Thu May 24, 2007 6:50 pm    Post subject: Reply with quote

Yes, it should.

However, I'm betting you didn't do "emerge --config resolvconf-gentoo" did you?

EDIT: Infact from a previous post I can see you didn't. resolvconf only works when /etc/resolv.conf is a symlink to the resolvconf one.
_________________
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
germanobax
Tux's lil' helper
Tux's lil' helper


Joined: 28 Apr 2005
Posts: 96

PostPosted: Fri May 25, 2007 1:58 pm    Post subject: Reply with quote

UberLord wrote:
I'm betting you didn't do "emerge --config resolvconf-gentoo" did you?

EDIT: Infact from a previous post I can see you didn't. resolvconf only works when /etc/resolv.conf is a symlink to the resolvconf one.


You're right! I did that, and it finally works!
Thank you.
_________________
Life is a Sexually Transmitted Disease, with 100% mortality.
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