Click to See Complete Forum and Search --> : local network question


LinuxSteve
03-09-2002, 04:20 PM
Hi, I have a few questions I hope some kind soul can help me out with. I'd appreciate it greatly.

I've just made the move from W!nd*ws 2000 to Mandrake 8.1 on 2 of the 3 machines in a local network. All 3 machines are assigned dynamic IP addresses via DHCP from my ISP. This works great; they can all three see the outside world.

First question: The 2 Linux boxes cannot see either other nor the 'doze PC unless I add the dynamic IP addresses of the other machines by hand to /etc/hosts. But that's a PITA, because each time I power on or off a machine, it might get a different IP assignment from my ISP. I don't want to have to edit /etc/hosts by hand each time. Also, as far as I understand masquarading, I don't want to be using that, because all 3 machines can talk directly through a little 4 port hub to my DSL modem and on to the outside world. I don't want all IP traffic routed through one machine.

So my question is: How can I have the Linux boxes automatically detect the IP address of the other machines on the local network? The 'doze box seems to do this automatically somehow - it can ping the two Linux machines without ever having been told their IP addresses, but vice versa doesn't work.

Second question: each time I reboot my Linux boxes, something clobbers /etc/hosts :-). But I have things in /etc/hosts that I wanted to keep, such as: "127.0.0.1 ad.doubleclick.net". After a reboot, the hostname in the line above gets replaced with localhost. How can I find what is changing these lines on a reboot, and make it stop?

Thanks muchly!

New Linux Dude Steve

LinuxSteve
03-09-2002, 04:23 PM
I should clarify something in my above post. When I said that the two linux machines cannot see each other or the 'doze box unless I add a line to /etc/hosts, I meant that they cannot see it by hostname. They can see it by IP address of course. It's just name resolution that's the issue here I think.

teeitup
03-11-2002, 12:23 AM
First question: The 2 Linux boxes cannot see either other nor the 'doze PC unless I add the dynamic IP addresses of
the other machines by hand to /etc/hosts. But that's a PITA, because each time I power on or off a machine, it might
get a different IP assignment from my ISP. I don't want to have to edit /etc/hosts by hand each time. Also, as far as I
understand masquarading, I don't want to be using that, because all 3 machines can talk directly through a little 4
port hub to my DSL modem and on to the outside world. I don't want all IP traffic routed through one machine.


This behavior is normal. Symptoms and solutions are dependent on your configuration. Routing through a single machine is in your best interest.


Second question: each time I reboot my Linux boxes, something clobbers /etc/hosts :-). But I have things in
/etc/hosts that I wanted to keep, such as: "127.0.0.1 ad.doubleclick.net". After a reboot, the hostname in the line
above gets replaced with localhost. How can I find what is changing these lines on a reboot, and make it stop?

This happens because it is trying to fix your host file.
127.0.0.1 localhost
This has to be there. It is important to the operation of the OS and X.
If you do an "ifconfig" as root you will see an interface lo it's ip address is 127.0.0.1. Every computer has this entry.
After that you may enter addresses of any box you choose. However, if your network assigns IP addresses via DHCP this can be a problem. /etc/hosts is not an efficient way to manage address translation in a DHCP network. It does work well for servers, routers, or network gear that use static address on your network.

Good Luck,

LinuxSteve
03-12-2002, 02:15 AM
Thanks for the words of wisdom! I do have 127.0.0.1 localhost localhost.localdomain in my /etc/hosts as the first line.

The thing I was trying to accomplish via 127.0.0.1 ad.doubleclick.net is to blackhole those domains so the banners didn't appear in my web browser. Perhaps there's a superior way to accomplish this via ipchains or something like that; I haven't gotten far enough along yet to investigate, but it's on my list of things to do.

It seems like DNS being able to optionally fall back on netbios name resolution might be a handy thing to solve my first problem. I did a bit of poking around on the net and it seems this is a common problem, since for better or worse, we live in a Windows dominated world. It'd be a lot easier to get a Linux box integrated into an existing Win* network if you could tell DNS to ask nmbd for names. Of course, they aren't really the same namespace, but, probably they mostly are in practice.

Then again, I'm certainly no sort of networking guru, so probably there's some reason or another why this wouldn't be a good idea...


Jeez. I used to use 'nix systems back in 1978 or so, text only stuff, none of this fancy Linux stuff. Now I realize I don't know what the @#$ I'm doing any more. Times have passed me by, hehe :)

Thanks again for your help.