Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
hostnames in LAN?
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
numerodix
l33t
l33t


Joined: 18 Jul 2002
Posts: 743
Location: nl.eu

PostPosted: Sun Oct 06, 2002 11:24 am    Post subject: hostnames in LAN? Reply with quote

Yes I did search before posting, couldn't find anything similar. But point me in the right direction if you will, thanks a lot!

Ok to the point. I have a small LAN behind a Smoothwall firewall/router. Smooth runs dhcp so ip addressing is not a problem. But when setting hostnames in linux, they are only known to the machine on which they are set. For instance, my smoothwall hostname is unknown to my gentoo machine. What I would like to do is set up some sort of mechanism to identify hostnames for every machine in the network (they can well be defined in text file on the smoothwall router if that is the solution) and assign ips accordingly.

I would like to obtain something like this..

1. New machine comes on the network
2. Machine hostname is "john"
3. "john" is registered for ip 192.168.1.13
4. Assign ip 192.168.1.13 to "john"

---

1. New machine comes on the network
2. Machine hostname is "frank"
3. "john" is not registered
4. Assign random ip 192.168.0.58 to "frank"

The problem is I have no idea what I need, I suppose some sort of internal dns.

If this is not possible or very impractical, in the least I would like a way to use the hostnames instead of the ips, ie. "ping john".

Any ideas?
Back to top
View user's profile Send private message
Mnemia
Guru
Guru


Joined: 17 May 2002
Posts: 476

PostPosted: Sun Oct 06, 2002 12:14 pm    Post subject: Reply with quote

Honestly, if you only have a few machines I would just try to hardcode it in your /etc/hosts file on each machine. I don't think there is any alternative to that besides running DNS, and that doesn't seem like it's worth the effort/risk.

Actually, now that I think about it...you could probably even come up with some sort of scheme where the hosts file on each machine sources a central file on the firewall machine through NFS, etc. That way you could probably make it so that the central file could be automatically updated by the DHCP server so that the IPs match correctly. Failing that, you'd at least only have to change it in one place when your IP changes. If ya put together a few little scripts it could almost be a form of "poor man's DNS".

Hope that helps...others might have better solutions.
Back to top
View user's profile Send private message
BackSeat
Apprentice
Apprentice


Joined: 12 Apr 2002
Posts: 242
Location: Reading, UK

PostPosted: Sun Oct 06, 2002 12:45 pm    Post subject: Reply with quote

You either need to install DNS (in which case I'd recommend djbdns) or you need to use /etc/hosts files on each machine as the previous person recommended. I think, for a small network, I'd go with /etc/hosts too.

However, there is an additional problem. You want to make sure that each machine that you know about alwaysgets the same address. I don't know Smoothwall particularly well but the ISC DHCP server (the one usually used on Linux) allows you to pre-allocated IP addresses to clients based on their MAC (hardware) address. You might want to take a look at that too.

HTH.

BS
Back to top
View user's profile Send private message
mglauche
Retired Dev
Retired Dev


Joined: 25 Apr 2002
Posts: 564
Location: Germany

PostPosted: Sun Oct 06, 2002 1:04 pm    Post subject: Reply with quote

for the killer solution install dhcp and dns (bind!), and configure auto-dns-update, so that the dns recods match the hostnames the dhcpd recieve from the clients.

So basicly it works like this:
- dhcpd gets a request from a known mac adress (you don't have wildcard dhcp access, do you ? ;)
- dhcpd reads the hostname from the client, looks in the dhcpd.leases if an IP for it does allrerady exists, if not it assigns a new one.
- dhcpd tells BIND to update the zone files for the record of the new logged on client

so baisicly you have a <computername>.foobar.com assigned automaticly ;)

for a good howto check out: http://ops.ietf.org/dns/dynupd/secure-ddns-howto.html
Back to top
View user's profile Send private message
numerodix
l33t
l33t


Joined: 18 Jul 2002
Posts: 743
Location: nl.eu

PostPosted: Mon Oct 07, 2002 12:07 pm    Post subject: Reply with quote

Ok I decided I would try the easiest option first. It seems Smoothwall runs some sort of dns server by default, I always point all my other machines at smooth for dns. So from the info I found here (http://cr.yp.to/djbdns/faq/orientation.html#dns), I tried coding the hostnames in /etc/hosts on smooth and the ip of smooth in /etc/resolv.conf on smooth (ie. external dns cache). So far the smooth box knows all the hostnames, and my gentoo machine also seems to recognize the other hosts. However, this I did not mention at first, I also have a couple of Windows machines and those are still quite ignorant. Is there any way to "enlighten" them using this setup? The dns is set to the smooth box in the TCP/IP settings in Windoze...

If not, then I'll have to try one of the others. But I'm afraid you'd have to explain a bit about how to make it work, I have no clue about this, or possibly a helpful getting started guide. :) mglauche, I had a look at yours and it suggests Windows does not support auto updates by default, the best solution by far would be to set it up so that no changes are necessary for the Win machines.
Back to top
View user's profile Send private message
seemant
Retired Dev
Retired Dev


Joined: 16 Nov 2002
Posts: 61
Location: Oakland, CA

PostPosted: Mon Jan 27, 2003 10:11 am    Post subject: dhcp-dns maybe? Reply with quote

there's a small perl script called dhcp-dns, which was recommended to me by someone, because I wish to do the same sort of thing.

http://freshmeat.net/redir/dhcp-dns/1856/url_homepage/dhcp_dns.html


Then again, I'm still struggling with understanding what all that stuff in the djbdns docs means.
Back to top
View user's profile Send private message
Matje
l33t
l33t


Joined: 29 Oct 2002
Posts: 619
Location: Hasselt, Belgium

PostPosted: Mon Jan 27, 2003 10:19 am    Post subject: Reply with quote

There's a nice howto for setting up named (BIND), which I do @ home. Off course, you don't get automagical dns then.
_________________
Life is like a box of chocolates... Before you know it, it's empty...
Back to top
View user's profile Send private message
mr_neutron
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jan 2003
Posts: 124
Location: Germany

PostPosted: Mon Jan 27, 2003 11:05 pm    Post subject: Reply with quote

In case you want to go with the /etc/hosts solution: Windows (at least up to ME, afaik) has an "/etc/hosts" too:
C:\Windows\hosts.sam
(.sam for "sample"). Just edit and rename it to 'hosts'. I found this very useful for my home LAN.
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