View previous topic :: View next topic |
Author |
Message |
numerodix l33t
Joined: 18 Jul 2002 Posts: 743 Location: nl.eu
|
Posted: Sun Oct 06, 2002 11:24 am Post subject: hostnames in LAN? |
|
|
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 |
|
|
Mnemia Guru
Joined: 17 May 2002 Posts: 476
|
Posted: Sun Oct 06, 2002 12:14 pm Post subject: |
|
|
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 |
|
|
BackSeat Apprentice
Joined: 12 Apr 2002 Posts: 242 Location: Reading, UK
|
Posted: Sun Oct 06, 2002 12:45 pm Post subject: |
|
|
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 |
|
|
mglauche Retired Dev
Joined: 25 Apr 2002 Posts: 564 Location: Germany
|
Posted: Sun Oct 06, 2002 1:04 pm Post subject: |
|
|
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 |
|
|
numerodix l33t
Joined: 18 Jul 2002 Posts: 743 Location: nl.eu
|
Posted: Mon Oct 07, 2002 12:07 pm Post subject: |
|
|
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 |
|
|
seemant Retired Dev
Joined: 16 Nov 2002 Posts: 61 Location: Oakland, CA
|
Posted: Mon Jan 27, 2003 10:11 am Post subject: dhcp-dns maybe? |
|
|
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 |
|
|
Matje l33t
Joined: 29 Oct 2002 Posts: 619 Location: Hasselt, Belgium
|
Posted: Mon Jan 27, 2003 10:19 am Post subject: |
|
|
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 |
|
|
mr_neutron Tux's lil' helper
Joined: 05 Jan 2003 Posts: 124 Location: Germany
|
Posted: Mon Jan 27, 2003 11:05 pm Post subject: |
|
|
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 |
|
|
|