Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyone know how to have 2X resolv.conf

Status
Not open for further replies.
Apr 2, 2003
58
GB
In a common situation you have a laptop with a network card and a wireless card.

If I use the standard NIC at work and the wireless card at home it would be nice to assign DNS specific to each nic.

Otherwise at one location there is a delay using the internet whilst waiting for the incorrect DNS entry to timeout. Therefore does anyone out there have a way to provide different DNS settings for whichever card is used.

Preferably the solution would be automatic. Heck I don't know why Linux has this function missing as every card in windows can have it's own DNS (which is logical!)

Regards,

Mocha
 
Since my laptop has only a network card and no wireless adaptor, I can only guess at this. Seems the few distros I've used recently if an 'ifup' and 'ifdown' command (interface up, interface down). There also seem to be a few /etc/networks/ifup.d and ifdown.d type of setups (the directory names aren't exact, just something like that). In this directory, you drop scripts that will be run when the corresponding interface is brought up or shut down. I'd dig around and find that directory. Then I'd put a script in there for each interface (I'm assuming you can get the card as say eth0 and the adapter as eth1) to create a symlink to one of my two /etc/resolv.conf.eth0 or /etc/resolv.conf.eth1 kind of trickery.

Geez, I've confused myself. It's late, I'm about off to bed. Maybe someone can figure out what I really meant and explain it clearly ;-)

----
JBR
 
HiMochaResearch,

I have not used a wireless card before, but I have used two network cards in one computer, with each card assigned its own IP address for connecting into its respective network.

I'm running Fedora Core 2. I use the following dialog to access the network dialog wizard:

system setting --> network --> network configuration

If the NICs were properly installed and the BIOS correctly found both cards during boot, then each card should appear in the "network configuration" dialog.

I can select each NIC and then supply the IP address, subnet mask, IP gateway, NetBIOS name, and lmhost IP and NetBIOS, etc.

To do more advanced stuff you might look at iptable and ipchain.


Hope this helps,

Regards,

LelandJ


Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox
 
Thanks for your replies.

Flugh - that sounds like you are on the right track I will investigate this.

Leland123 - my question didn't have anything to do with getting the cards running together - but thnx anyways. I have different DNS requirements at work (Cabled Lan) and Home (Wireless). So I am trying to get something sorted so the DNS is automatically right for the card that's in use.

Cheers,

Mocha
 
Hi,

I think I have found a way to sort this problem out.

In ifcfg-eth0 (LAN - for me) and ifcfg-eth1 (Wireless for me)there is a setting PEERDNS this if set to yes uses DHCP to set the DNS values in resolv.conf

That's great on it's own but it dodn't solve my problem as I don't have the ability for DHCP at home (wireless) to assign the DNS.

Anyway there is another parameter that can be set that writes in the DNS if PEERDNS is set to yes. For example:

ifcfg-eth0
---------------

PEERDNS=yes
DNS{1,2}=192.168.110.99

---------------

Writes:

nameserver 192.168.110.99

into the resolv.conf

+ For Wireless:

ifcfg-eth1
---------------

PEERDNS=yes
DNS{1,2}=212.45.45.12, 212.45.45.13

---------------

Writes:

nameserver 212.45.45.12
nameserver 212.45.45.13

into the resolv.conf

I have not yet tested this on the wireless side but I hope that it will do the job there too.

Regards,

Muffin (formerly Mocha!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top