LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How to resolve hostnames on DHCP home network (https://www.linuxquestions.org/questions/linux-networking-3/how-to-resolve-hostnames-on-dhcp-home-network-816849/)

ksdmnv 06-28-2010 01:38 PM

How to resolve hostnames on DHCP home network
 
Hi,

(although I'm running Solaris, I've posted here as I expect Solaris/LINUX is irrelevant) - more of a general network Q.


I have a PC running Solaris 10 (hostname MARKUNIX) and a laptop running WinXP (hostname MARK-LAPTOP).

Both are connected to broadband via a router. IP addresses for each are determined via DHCP (192.168.1.nn) and I do not leave either on, 24x7.

I am running Oracle on MARKUNIX and want to be able to refer to it by hostname when using Oracle tools on my laptop.

Each machine can ping each other ok by ip address and curiously the Solaris PC can ping MARK-LAPTOP (I'm not sure how it resolves that?) - importantly the laptop cannot ping MARKUNIX.

Now I could add MARKUNIX to my laptops hosts file but that would mean changing the file each time I boot up as the ip address for MARKUNIX will keep changing (DHCP).

Is there a way to refer to MARKUNIX without having to keep changing ip addresses and use DHCP? As I understand it the 192.168 address is private and is not really the 'real' ip address and as such can be manipulated(fixed?) even whilst using DHCP?

Am I right in thinking that a static ip from my broadband supplier is the ip of my connection (router) and I'll still have the same private network referencing issues?

What I've covered above pretty much is the extent of my knowledge of networking so bear that in mind please ;-)

Any help greatly appreciated.

cheers

rweaver 06-28-2010 02:12 PM

Some dhcpd servers support setting dns information for a host, but I'm unsure how portable it is... you can also look at using dyndns typical of local product and automate the process to some degree.

tsg 06-28-2010 03:43 PM

Some routers will allow you to define static IP addresses assigned through DHCP. You'll still get the DNS etc. settings through DHCP but each machine will get the same IP address every time.

Many routers do DNS for the private network by using the Windows machine name (probably why MARK-LAPTOP works). On Linux you can run Samba to provide it to the router. I'm not sure about Solaris.

jefro 06-28-2010 07:16 PM

You need to set up wins server I'd think.

The other way would be to make a dns entry for that on a local server. (again I'm thinking)

Might be more simple to assign the leases forever so that each time it gets the same IP address.

Ping is getting blocked by default more and more. Not a good test anymore.

jlinkels 06-28-2010 07:59 PM

My standard solution is to run a DNS server on a linux server (bind9) and bind IP addresses to names. Then I also run a DHCP server on the same linux box, and in the dhcpd.conf I use stanzas like:

Code:

host donald_pc {
  hardware ethernet 00:0a:5e:42:99:81;
  fixed-address donald_pc.megaline.com;
}

By stating the MAC address I make sure that this PC always gets the correct IP address. The IP address is defined in the DNS file for this domain. There is only one place (two files) where I have to define IP address against name, and that is in the DNS files.

You could also make a shortcut to this method by defining IP addresses bound to MAC addresses in your DHCP server. Even broadband routers can do that now. Then you can either address a host by its (constant now) IP address or use an entry in the hosts file.

jlinkels


All times are GMT -5. The time now is 07:20 PM.