LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 05-13-2008, 01:05 PM   #1
biiiep
Member
 
Registered: Aug 2003
Posts: 39

Rep: Reputation: 15
DNS service reconfigured always when lan cable is plugged in (using two devices)


I installed and configured two network device.

One is my onboard lan and the other a PCI wlan device.

I configured them both via interfaces file.

Code:
auto lo ath0 eth0
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0

iface ath0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

iface eth0 inet static
address 192.168.0.164
netmask 255.255.255.0
If no lan cable is plugged in to eth0 everything works fine. My gateway and dns (resolv.conf) are configured correctly.

Once I plug in also the cable the dns entry is overwritten by 192.168.0.1. Before it was 192.168.178.1.

I have no idea why this happens. I also read the the ominous network-manager ubuntu uses doesn't configure devices listed in interfaces. So has anybody a idea what there happens and how i can prevent it?

I already set the dhclient.conf option to:

Code:
prepend domain-name-servers 192.168.178.1;
But it has no use, it got overwritten nevertheless.

Perhaps here somebody can help me. thanks a lot in advance.
 
Old 05-13-2008, 02:08 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
It has to do with the DHCP server sending you which servers to use in resolv.conf.

You can tell your client not to overwrite.

The last time I did that (2005) it was in /etc/dhclient-conf.

I just needed to have the following line uncommented to set the search domains and prevent them from being overwritten by DHCP.

supersede domain-name "myfirstdomain.com myseconddomain.net";

There should be a similar setting for superseding DNS servers though I don't have that in front of me at the moment.

There is more than one dhcp client available for Linux so you may or may not use dhclient-conf on the one you're using. You'd just need to find the equivalent config file and options to the above if it is different.
 
Old 05-13-2008, 03:22 PM   #3
biiiep
Member
 
Registered: Aug 2003
Posts: 39

Original Poster
Rep: Reputation: 15
I am not sure whether this will help and what's the effect of this.
Because the dns values i get from the dhcp server are correct but it seams that they are overwritten by data from the static configured device.

Further i don't know what domains i shall enter because in both subnets i'm using only ip address to identify computers.
 
Old 05-14-2008, 09:28 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
?

Your interface is EITHER using DHCP or it uses a STATIC IP. It can't do both.

The fact you're attaching to different networks and working suggests it is DHCP. If it were STATIC it would only work on the network where that STATIC IP was relevant.

It is possible you have two interfaces one of which is STATIC and one of which is using DHCP. If so the DHCP will overwrite resolv.conf if it is providing that information from the DHCP server which is usually the case.

On the flip side your issue may be that you already have the entries I suggested created and if so they are overriding what your DHCP server is providing but from your original question it sounded like your issue was that the resolv.conf was being changed when you attached to a network.
 
Old 05-14-2008, 04:43 PM   #5
biiiep
Member
 
Registered: Aug 2003
Posts: 39

Original Poster
Rep: Reputation: 15
Ok, now i understood what you suggested to me

I added to my dhclient.conf the line

Code:
supersede domain-name-servers 192.168.178.1;
and everything works fine... the dns server stays the one i want to use.

Thanks a lot.

But still i'm not sure why it was overwritten before. Because i wanted to use eth0 with static address to use in my seperated lan. I didn't gave just a rudimentary configuration. And the other interface is configured via dhcp containing also the dns server to. Don't understand were the other address came from because it looked like came from any automatic coniguration from the eth0 lan.

but don't bother

Thanks.
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
if( ethernet-cable-is-plugged-in ) { ... mrtwice Linux - Networking 13 10-08-2006 02:57 PM
plugged in lan cable, still "not connected'' message shows New@Mandrake Linux - Networking 5 10-14-2004 11:56 AM
What happens when a network cable is plugged in ? balajipriya Linux - Networking 1 08-12-2004 09:10 AM
dhcpcd, no network cable plugged in meyert Slackware 3 04-28-2004 08:34 PM
Automatically Connect when cable is plugged in?? NovaBurst Fedora 2 02-18-2004 09:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 05:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration