sharing a "/etc/hosts" file on a lan

I'm trying to study computer networking simply as a hobby (I'm old and don't have anything better to do). I have two Asus netbooks and have installed FreeBSD on both of them (off-line, as in no Internet connection). I want "/etc/hosts" of one of the PC's on the network to be used as the database for all name lookups on the network. In other words, not using any type of server, like unamed, bind. Or am I getting too stupid with low level name resolution? Thanks all!
 
"back in the days" when using the hostsfile was common, you'd either made this file downloadable from a main system (ftp or http if you wanted to get fancy) and pulled it from there to all other systems, or if this became too tedious, you'd set up a YP/NIS system (yp(8)).

Given that you only have 2 hosts which you both control I'd simply scp the file around after every change. Or to have some revision control, use git where you can set up the repositories on both hosts so they push to each other. This way you can omit the manual scp step and simply git push the changes to the other host(s) or git pull manually if the host was powered down.
 
Thanks for the info, sko. Your method seems quite doable. But I'm starting to realize that my shared single file resolver idea is too primitive. Even with a small network, it seems best to simply use software that has already been designed for bulk network name resolution. I'm going to check out unbound.
 
unbound is pretty straightforward and lightweight (in resource/memory requirements and setup/maintenance); I'm using it regularly for local name resolutions on jailhosts or small home networks.

You can simply define records via "local-data" either in unbound.conf(5) or a separate file that you include inside unbound.conf. I usually use the latter approach to keep things a bit more clean. The included file just holds records in the form of:
Code:
local-zone: "local." static
local-data: "myhost.local.    A    192.168.10.22"
local-data: "anotherhost.local.    A    192.168.10.25"

just look at the examples in unbound.conf, they cover pretty much everything you might need in a small setup.
 
One problem with host files is that they can't change when the machine walks out of or into your network. For example I have a server that I use by its internal IP address when on my LAN, but on a laptop outside I want no /etc/hoss entry so that DNS is being used.

Heavy use of OpenVPN is one cure.
 
Agreed. I use internal DNS and LDAP, where LDAP serves additional info like passwd, group, and other databases, with Kerberos handling authentication. I also use NIS (legacy) but it's shadowed by the LDAP databases.

I could bridge my VPN to the LAN my laptop is on though I prefer not to because the machine I VPN into would need to have its interface on the LAN in promiscuous mode. I think VLAN trunking would mitigate that, and that requires a little cash outlay for some managed switches (currently planned).

In the mean time my laptop is on another network with with a different name (laptop name followed by a number). Works but not elegant.
 
maybe is you use SAMBA to make a WINS server (I dont know is only applies to windows for resolve netbios names)
but is a good practique
 
WINS is never anything "good", except if it is removed from a network...
I dont like wins,but tell that in a crappy network with crappy tecnical support of machines with 200 users that cant resolv a netbios server name and you need a solution NOW
 
Back
Top