LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Hostname resolution (https://www.linuxquestions.org/questions/linux-networking-3/hostname-resolution-868977/)

diogosalazar 03-16-2011 12:08 PM

Hostname resolution
 
Hi, I guess this thread could be at the Linux-Server forum but I'm not 100% sure, so here it goes...

I have a home network with 4 computers:
1-Ubuntu 10.10 (Server - wired)
2-Windows 7 (desktop - wired)
3-Windows 7 (laptop - wired)
4-Windows XP (laptop - wireless)

I also have a DLINK DI-624 wireless router which is connected to my cable modem.

My problem is that I can't ping computers by hostname.
I am still building the Ubuntu server and while configuring Samba for file sharing, I noticed that none of my computers were able to find my server on the network.

I'll be disabling my router so that all traffic flows through the server. (It has 2 network cards, it is going to act as a proxy/DHCP server)

What do I have to do to resolve network names?

tronayne 03-16-2011 12:27 PM

On your LAN it's generally easier if you use fixed-IP addressing. On your Linux machine you can directly edit /etc/hosts adding the fixed-IP address and name of each machine. On the Windows machines, you edit the network settings giving each machine a unique address; somewhere or other (I've forgotten) there is an equivalent of /etc/hosts where entries can be made for the fixed-IP address of machines on your LAN. Your D-Link manual should guide you in how to set up Windows machines for fixed-IP.

Precisely how that's done in Ubuntu I don't know -- I believe there's a network GUI that you use to specify network settings.

Assuming that your D-Link is at 192.168.1.1 (it's your gateway address), you may want to set fixed-IP addresses to 192.168.1.10, 192.168.1.20 and so on. If your D-Link is doing DHCP, it probably starts "leasing" addresses at 192.168.1.100 so as long as your stay below that, you can use fixed-IP with no problems. Your /etc/hosts file should look something like this
Code:

# For loopbacking.
127.0.0.1              localhost
192.168.1.10            fubar.com fubar
192.168.1.20            snafu.com snafu
192.168.1.30            pita.com pita

once you've done the addressing changes (the equivalent on Windows look different but serves the same purpose).

The trick is that the boxes have to know who they are and who everybody else is by name (which resolves to a fixed address). That'll also make it easier to set up Samba.

Hope this helps some.


All times are GMT -5. The time now is 04:59 PM.