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 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| 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 |
| |||
| 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 |
| ||||
| 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. |