Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Get Linux To Update /etc/hosts Dynamically
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Veldrin
Veteran
Veteran


Joined: 27 Jul 2004
Posts: 1945
Location: Zurich, Switzerland

PostPosted: Tue Jan 04, 2005 3:03 pm    Post subject: Get Linux To Update /etc/hosts Dynamically Reply with quote

Hi Everybody,

I know the title isn't ideal, but I don't really what I am looking for... I general I want to be able to connect to other computers in my local network by just using there hostnames. If I would use static IP-addresses I could just add them to /etc/hosts, but - alas - I am using DHCP, and to make the whole thing a bit more complicated, I have diffent IP-ranges at home and in my students home where I normally stay. Windoze somehow manages to be able to get computernames(hostnames) assosiated to IP-addresses, or at least that is how it seams. Somehow I got Windoze to accept the name I gave to my notebook and I could ping it directly (via {nis,wins,*}hostname)...
My Question in general is, is the same possible for Linux, or do I need a running server - which I currently to have at hand. I had a look to BIND which seamed firstly what I was looking for, but the deeper I got the more it became useless.

I hope I made myself clear of what I am looking for... Otherwise just ask, I try to explain in other words...

Greets
V.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54830
Location: 56N 3W

PostPosted: Tue Jan 04, 2005 3:23 pm    Post subject: Reply with quote

Veldrin,

If the name of the host you are looking for is not in /etc/hosts, then the dhcp server should provide its IP and it Just Works. When dhcp is in use you should only have a minimal hosts file.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Cosmin
Guru
Guru


Joined: 18 Dec 2003
Posts: 447
Location: Bucharest, Romania

PostPosted: Tue Jan 04, 2005 3:33 pm    Post subject: Reply with quote

You should have samba working on the gentoo boxes. This way you'll be able to 'ping' them by name.
_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian W. Kernighan
Back to top
View user's profile Send private message
Veldrin
Veteran
Veteran


Joined: 27 Jul 2004
Posts: 1945
Location: Zurich, Switzerland

PostPosted: Tue Jan 04, 2005 3:44 pm    Post subject: Reply with quote

@Seagoon: I know that /etc/hosts isn't the solution... but I need some way to get myself clear what I ment. And my /etc/hosts is as minimal as it could be...

@Cosmin: I do have samba installed, and I works from windoze. But I want to do the same from Linux, which i currently cannot - unless I misconfigured something...
Back to top
View user's profile Send private message
nobspangle
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1318
Location: Manchester, UK

PostPosted: Tue Jan 04, 2005 5:20 pm    Post subject: Reply with quote

you need to configure nsswitch.conf I think you just need to have
Code:
hosts:      files wins dns
Back to top
View user's profile Send private message
dannysauer
n00b
n00b


Joined: 23 Sep 2004
Posts: 60
Location: Lincoln, IL

PostPosted: Tue Jan 04, 2005 5:24 pm    Post subject: Reply with quote

What do you mean by "connect to other computers"? Do you just want to use SMB shares, or do you want to do something else? Are the other computers under your control, or no? How are you getting the names of these computers? This will help find you a solution...
Back to top
View user's profile Send private message
Veldrin
Veteran
Veteran


Joined: 27 Jul 2004
Posts: 1945
Location: Zurich, Switzerland

PostPosted: Tue Jan 04, 2005 5:48 pm    Post subject: Reply with quote

@noobspangle: I checked the entry in nsswitch.conf and added wins... Unfortunately I dont have another linux box around to test it...

@dannysauer: Yes there are: my notebook (my main workstation) and Linux File server (mainly samba)
It's mainly samba, and ssh for administrating my samba server. I played a bit with nfs, and I think I use it to get acces to my files server....

I do have to admit, although I use DHCP my IP-addresses are more or less static...

My first though was to create a wins db on linux... but in general I'd like to stay in linux-only stuff (i.e. use nfs instead of samba, etc...). I hope you get the idea.

Greets
V.

PS. I am terribly sorry for the confusion, but I sometimes get lost in unsignificant details... :roll:
[edit:]typo
Back to top
View user's profile Send private message
dannysauer
n00b
n00b


Joined: 23 Sep 2004
Posts: 60
Location: Lincoln, IL

PostPosted: Tue Jan 04, 2005 5:58 pm    Post subject: Reply with quote

If you have control over the machines, why don't you just set up a DNS server and set the machines to update DNS when they get their DHCP address?

http://www.mattfoster.clara.co.uk/ddns.htm, and Google for "dynamic dns" would probably help. Sure, it's overkill, but you're running Linux, and Linux users generally know that overkill is just barely enough. :)

BTW, CIFS is not a windows thing, I'm pretty sure it was an OS/2 thing. If you use CIFS (not SMB) and samba for file sharing, you'll have fewer problems with timeouts and the like, and you can still get *nix permissions et. al. Properly tuned NFS will have better performance (over UDP on a local network), but CIFS is pretty close, and much more fault tolerant. I think that'd be the better choice for you, given that you're using a laptop... Samba's more "linux" than NFS anyway, IMHO. ;)
Back to top
View user's profile Send private message
Cosmin
Guru
Guru


Joined: 18 Dec 2003
Posts: 447
Location: Bucharest, Romania

PostPosted: Wed Jan 05, 2005 8:29 am    Post subject: Reply with quote

Veldrin, all you need is samba. As long as it's working, you WILL be able to acces the linux boxes by name (instead of IP). That's all you need (if I undertand you correctly).
Moreover, you said you move your linux box from one network to another, changing the IP address ranges (DHCP or static, no matter). In this case, please check that your IP is the correct one. I mean, check to see if you get a correct IP from the DHCP server, check to see if the static address (if any) is correct. Be aware that you CANNOT acces a network if your netmask is 255.255.255.255 (for example).
_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian W. Kernighan
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum