PDA

View Full Version : [SOLVED] cant resolve ubuntu hostname from windows



Hathadar
March 3rd, 2010, 06:40 AM
I have two computers.

Computer A = windows 7.
Computer B = Ubuntu Server 9.10

Computer B automatically receives an IP address from my router.

I can ping computer B from computer A using the IP address.
I cannot ping computer B from computer A using its hostname.

My router did not show a hostname under it's active clients table.
After some searching I found a threat where somebody suggested modifying /etc/dhcp3/dhclient.conf and adding 'send hostname "blahblah"'
This allowed me to see the hostname in my router but I still cannot resolve it from my windows box.

How can I correct this?

techstop
March 3rd, 2010, 07:33 AM
The quickest method would be to put an entry in the hosts file on the Windows machine. There's plenty of howtos on this, google it, or try this example;

http://www.ezlan.net/host.html

A long-term solution (if you have plenty of machines you want to access the server by host-name) is to install a DNS service on the ubuntu server.

http://ubuntuforums.org/showthread.php?t=236093

redmk2
March 3rd, 2010, 07:50 AM
I have two computers.

Computer A = windows 7.
Computer B = Ubuntu Server 9.10

Computer B automatically receives an IP address from my router.

I can ping computer B from computer A using the IP address.
I cannot ping computer B from computer A using its hostname.

My router did not show a hostname under it's active clients table.
After some searching I found a threat where somebody suggested modifying /etc/dhcp3/dhclient.conf and adding 'send hostname "blahblah"'
This allowed me to see the hostname in my router but I still cannot resolve it from my windows box.

How can I correct this?

The windows machine needs to use the routers address as the primary DNS resolver. If you have the Windows host get that information from the DHCP server (in the router) then you need to configure your DHCP settings. make sure you include you ISP's DNS server as secondary resolver.

@techstop -- The "an entry in the hosts file on the Windows machine" method will only work if the IP address stays the same. With DHCP you can't guarantee that. As this is a dynamic process you need coordination between DHCP and DNS. This is not possible with a static file.

techstop
March 3rd, 2010, 08:03 AM
@techstop -- The "an entry in the hosts file on the Windows machine" method will only work if the IP address stays the same. With DHCP you can't guarantee that. As this is a dynamic process you need coordination between DHCP and DNS. This is not possible with a static file.

By suggesting to add an entry to the hosts file, I expected that it was understood that a static IP would be required. Not sure what you mean by
As this is a dynamic process you need coordination between DHCP and DNS. This is not possible with a static file.

You can set DNS server addresses while using a static address (but on a home network this is likely to be the same as the gateway address).

EDIT: now you've got me confused, you don't need a DHCP server for a static IP.

redmk2
March 3rd, 2010, 08:32 AM
By suggesting to add an entry to the hosts file, I expected that it was understood that a static IP would be required.

The OP specifically stated that he was using DHCP by this statement : Computer B automatically receives an IP address from my router.





Not sure what you mean by
As this is a dynamic process you need coordination between DHCP and DNS. This is not possible with a static file.

What this means is that the entries in the DNS server would need changing if the IP address changes (e.g. the mapping between the IP address and the hostname). The address of the servers is not what I was taling about. With a static file the mappings are set until you manually change them.


You can set DNS server addresses while using a static address (but on a home network this is likely to be the same as the gateway address).

EDIT: now you've got me confused, you don't need a DHCP server for a static IP.

Once again the OP sets the conditions and he/she said dhcp.

I personally prefer static addressing (manually configured IP addresses and DNS entries).

techstop
March 3rd, 2010, 09:26 AM
The OP specifically stated that he was using DHCP by this statement : Computer B automatically receives an IP address from my router.


OP is welcome (and encouraged) to change their network configuration to achieve their goals of being able to use hostname rather than IP address to access their ubuntu server


Once again the OP sets the conditions and he/she said dhcp.
OP is welcome (and encouraged) to change their network configuration to achieve their goals of being able to use hostname rather than IP address to access their ubuntu server


I personally prefer static addressing (manually configured IP addresses and DNS entries).

Good then. We agree.

redmk2
March 3rd, 2010, 04:23 PM
...


Good then. We agree.

No we do not agree. In your original reply you made no mention of converting the Ubuntu host to a static IP address. The OP may be unaware that he needs to do that. Incomplete advice is worse that no advice at all.

doas777
March 3rd, 2010, 04:27 PM
one way, is to configure samba as a wins server ("wins support = yes" in smb.conf and point your win boxes to it but it would require the server to have a static ip), but I'm sure there is a way to do it with just winbindd. google around to see.

Morbius1
March 3rd, 2010, 04:54 PM
Have Computer B continue to get it's IP address from the router. Have the router assign the same IP address to that machine based on that machines MAC address.

For Netgear routers it's called "DHCP Address Reservation"
For D-Link routers it's called "Static DHCP"
Linksys routers are more problematic. Some routers can do it and some cannot.
It also goes by the names: "reserved DHCP", "reserved leases", and "Pre-assigned DHCP" .

Then the host file method would work assuming at that point you still need to do something at the hostname level since now all ip address are fixed.

redmk2
March 3rd, 2010, 05:09 PM
one way, is to configure samba as a wins server ("wins support = yes" in smb.conf and point your win boxes to it but it would require the server to have a static ip), but I'm sure there is a way to do it with just winbindd. google around to see.

An interesting addition of complexity to the situation. The OP barely understands what he is doing at this point and you want him to add yet another server to the mix.

Winbind has nothing to do with name resolution. The Winbind service is used to resolve user and group information from Windows NT/2000/2003/2008 servers.

Hathadar
March 3rd, 2010, 06:24 PM
Thank you for all who responded. I still don't quite know where to go as there are there seems to be argument on the best way to proceed.

Some people say use a host file. I prefer to not do this and keep everything dynamic.

Some people say use my machine as a DNS server however that seems to indicate I would have to assign a static IP to my ubuntu box. Again, I would like to keep things dynamic.

Here is a question. How do windows machines automatically resolve host names on a local network without using a DNS server or host files? How is it that I can plug in a new windows box into my network and automatically be able to ping it via it's host name?

doas777
March 3rd, 2010, 08:13 PM
Thank you for all who responded. I still don't quite know where to go as there are there seems to be argument on the best way to proceed.

Some people say use a host file. I prefer to not do this and keep everything dynamic.

Some people say use my machine as a DNS server however that seems to indicate I would have to assign a static IP to my ubuntu box. Again, I would like to keep things dynamic.

Here is a question. How do windows machines automatically resolve host names on a local network without using a DNS server or host files? How is it that I can plug in a new windows box into my network and automatically be able to ping it via it's host name?

that functionality is part of the SMB protocol. SAMBA is the linux port of SMB. here is some info on smb/samba name resolution. http://oreilly.com/catalog/samba/chapter/book/ch07_03.html

Hathadar
March 3rd, 2010, 08:53 PM
Thanks, problem fixed.
I installed samba and configured it to be a wins server.
This allowed my windows machine to ping via host name.
I also installed winbind to allow my ubuntu box to ping my windows box.