Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a 4 computers at home that are hooked up through a router. They all have the same domain name, of course with different host names. I can ping to all of them by IP address, but I wish to be able to refer to them by FQDN. Any tips welcome!
Do they have fixed IPs. If so, then you just need to add a "hosts" file to each, containing the IP/Name of the others. In Linux, the file is /etc/hosts. In Winblows it's C:\WINDOWS\system32\drivers\etc\hosts.
If they have dynamic IPs, then the Router would have to run a DNS tied to it's DHCP. Most, if not all, don't support this. They just pass DNS requests through to an external DNS.
Thank you. This is in Debian unstable, so I'd be interested to know if there's a Debian way of doing this. I'm not sure if these are static IPs or not, but I'll find out. If I want to make the FQDNs be accesible from outside the router, that's a whole different story isn't it? Thanks.
Even if these hosts get their address from DHCP most NAT routers will remember the IP assigned and not change it unless you change a NIC card (which changes the MAC address). So for 5 hosts, editing the hosts file is the best solution. Look in your /etc/nsswitch.conf file. On the "hosts:" line, "files" is listed first. This line is in sync with /etc/host.conf; "order hosts, bind". Some people run their own nameserver (DNS) for the LAN. For 5 hosts, that is just to much work. For some NAT routers, you can use the IP address of the router as the nameserver. This won't work for my Linksys wireless router however.
For only 5 hosts, static addresses would be just as managable. Assign them outside the address range that the router uses to assign addresses. For a Linksys NAT router, that would be in the ranges 192.168.1.2-99 and 192.168.1.150-192.168.1.254.
So are you saying the easiest would be to just modify the /etc/hosts file at each computer using the IP addresses I get from ifconfig, and putting the info for the other computers in it? Thanks.
Yes, but if you want to go from using a dhcp assigned address to a fixed address, you may want to change it's address first. A Linksys NAT router starts at 192.168.1.100, and assigns up to 50 IP addresses. These are the defaults and can be modified in the setup. However with only 5 devices, you have plenty of IP address to choose from outside of 195.168.1.100-149.
My host file contains an entry like:
192.168.1.100 hpamd64.jesnet hpamd64
If you wanted you could even add www.linuxquestions.org to your hosts file with maybe an alias of "lq". Then it would be a few milliseconds quicker and easier to reach your favorite website.
Cool, I just checked the IPs of all the computers and modified their /etc/hosts like this. I can now ping them, ssh to/from them and what not. IIUC, one can just add any number of IP/FQDN in that file to make life easier contacting them? I hope there's no security issue doing that. It's very handy! BTW, is NFS the best way to go to access each computer's filesystem from any of the computers? Thanks again for the pointers!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.