Click to See Complete Forum and Search --> : [RESOLVED] Laptop resolv.conf issues w/ dual nics


Daedrus
11-01-2004, 12:02 PM
I am having problems with resolv.conf on my laptop that is running Slackware 10. I use the integrated nic at home with DHCP enabled so that it picks up an address from my router. At work the laptop is plugged into a docking station and has a static IP address.

The system was originally set up at work. Everything worked fine. I finally took the laptop home and it worked fine. Now I am back at work and I can't get out to the internet. eth1(docking station) is up and i can ping ip address on my subnet and others (gw set correctly). When I looked at resolv.conf it is now only listing the nameservers for my ISP at home. I have tried just adding the nameservers for work, but this doesn't work.

Question: Is there a way to set different resolv.conf files for each network interface? or is there some other way of configuring this that I am missing? I have a wifi nic as well but I am not worrying about this now.

Thanks in advance for the help.

techwise
11-01-2004, 12:53 PM
Yes I do beloeve you can set up what is referred to as "profiles" for your different connections. I have read on it before but dont know the procedures.

For a quick fix though, as root:

~#dhcpcd -k
~#dhcpcd

this will stop and then restart your dhcp client daemon.

If this does not solve the problem, it is likely that your work locations DHCP server is not configured to offer dns server info as part of its offer.

mike

Daedrus
11-01-2004, 12:58 PM
My work configuration is static. no dhcp. nameserver was originally set through netconfig in slackware, but this config was overwritten by dhcp settings for eth0 when i logged in at home.

techwise
11-01-2004, 01:15 PM
then just do "dhcpcd -k" to make sure it is not running.

then edit your resolv.conf file to the proper servers. Then take the eth* device down and up.

You should be able to route then.

Also, can you ping an address outside your lan?

If not you need to set your default gateway. . .

route add default gw ***.***.***.***

mike

Daedrus
11-01-2004, 01:38 PM
That helps get me up now, but when I go home and use eth0 w/dhcp i will overwrite the resolv.conf again. I will have to look into profiles, but not sure how to do it with slack.

ph34r
11-01-2004, 01:52 PM
Why not make a second good copy of resolv.conf for your work, name it like /etc/resolv.conf.work, and write a shell script that will copy it over to /etc/resolv.conf

Daedrus
11-01-2004, 02:14 PM
Definitely something to do for shortrun. Long run would rather have resolv.conf.eth0, etc. that way it is a little easier when i bring up my wireless as well.

techwise
11-01-2004, 05:17 PM
This just hit me.

I do the same thing you do but, at work I have a DHCP server give me an address. It just gives me the same address every time so that I only have to have dhcpcd running on the laptop and I can connect no matter where I am, home. office, Starbucks etc. . .

I just set the DHCP server to assign the same address to the mac address of my card and it works great.

So if your network admin or you can set that up (easy) you wont have to worry about the profiles thing.

Mike

Daedrus
11-01-2004, 05:21 PM
Thanks techwise. I had forgotten about that. It has been a while since I have had to change anything on the dhcp server (department is static except for a few dynamic addresses). I will go and make that change.

Still, there should be a way to work profiles, but it isn't too important, mainly a learning thing.

Daedrus
11-01-2004, 05:37 PM
Thanks again techwise. I made the change and it didn't work at first. Stupid me remembered to unload dhcpsrvr (Netware server) but forgot to load it again after making the change. It works fine now. I guess this is the easiest way to go.

techwise
11-03-2004, 12:21 PM
I love to learn new things too. Im allways reading but in reality there is so much to learn and so little time.

It is nice that there are so many ways to get the job done in Linux.

Mike

happybunny
11-03-2004, 12:41 PM
does dhclient work in slackware?

I think you can set your static IP as you normally would at work, then at home do a dhclient eth0 and it will ignore your static settings and ask for an IP.

then, on reboot, it will read your static file config again.