Samba shares only visible using IP address but not host name
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Samba shares only visible using IP address but not host name
I have two computers, both running mepis 7.0 32 bit (basically debian etch). Both are fully updated. one is called "kitchen" and the other "dining_room" I had samba working fine, until I started messing around with NFS on "kitchen". Now "kitchen" isn't visible in Samba.
Using "kitchen", I can see and mount the shares from "dining_room", no problem. But the shares from "kitchen" are not visible on either computer.
In trying to debug this, I went to "kitchen" and using konqueror, I typed in "smb://kitchen/" and I get an error mounting share message. Now here is the interesting thing. If I try to mount shares using the IP address instead of the host name (e.g., smb://192.168.1.4/ instead of smb://kitchen/), it works fine. I also noticed in SMB4K (on "kitchen"), when I try to browse the shares, it is showing a different IP address than the one assigned to the machine. I know the machine is using 192.168.1.4, but in SMB4K, when trying to connect it indicates it is connecting to 192.168.1.5
I copied /etc/samba/samba.conf from the "dining_room" to "kitchen" and that didn't help. I checked /etc/hosts, /etc/hosts.allow, /etc/host.deny, and /etc/network/interfaces, to see if I had hard coded the IP address at some point when I was messing with NFS, but can't find anything out of sorts.
What configuration files do I need to check/edit, to correct this problem? The shares are visible using the IP address but not the host name, so samba is working. But there is something with the hostname and IP address I am overlooking. Any help would be appreciated.
Thanks Reply With Quote
If you run nmap, what ports are open on the other machine.
139/tcp open netbios-ssn
445/tcp open microsoft-ds
631/tcp open ipp
631 is cups, but samba may use it. You do need 139 and 445 open. If you are using older technologies, such as you have Windows98 machines, they will use 137-139.
Also run "smbclient -L <hostname>" and see if the services are listed.
It seems to me that smb4k doesn't handle the [profile] service properly.
Try restarting smbd and nmbd on both machines.
If one of the machines is used as a server and always on, (such as a desktop for laptops on the network) you might try configuring the it as a wins server and putting it's IP address in the router's configuration, or each client's samba configuration.
Do your hosts use DHCP? Could the lease have changed reassigning IP addresses but samba and/or /etc/hosts and/or arp contains old IP address information?
I changed the IP address from DHCP to static 192.168.1.5 on "kitchen", and some of the problems have sort of cleared up.
I am sure all the correct ports are open, because of two things: one, samba works when I use the IP address, and two, there is no difference even if the firewall is disabled.
when I do "smbclient -L kitchen" I get the response "timeout connecting to 126.96.36.199:445" I believe the is the openDNS server my box is pinging. However, if I do "smbclient -L 192.168.1.5", it works fine
etc/hosts is as follows:
# The following lines are desirable for IPv6 capable hosts
# (added automatically by netbase upgrade)
If you changed to a static IP setup, and as you only have two hosts, edit your /etc/hosts file. Make sure that /etc/hosts is correct. If you had an old entry in /etc/hosts and you were assigned a different IP address, that could have caused your problem. It sounds like you don't have entries in your /etc/hosts file for the other computers on the network. This will enable you to use ssh or ping by name.
The samba-doc package (if you have it) supplies three books. Samba 3 by Example, and Samba 3 HOWTO & Reference Guide. The second one has a section on browsing. The troubleshooting section might help.
If you have the avahi service running, see if you can ping an IP address using "ping <hostname>.local".
Is this on the "kitchen" host?
You should be able to browse even if you don't have /etc/hosts entries (or a dns server). Vice-versa isn't necessarily true however.
I just tried an experiment. I commented out the /etc/hosts entry for "hpmedia" on my LAN. Then I ran "smbclient -L hpmedia". I was able to get the information. The argument after -L is the winbios hostname not the network hostname. If you use a command like "ping", then you do need an entry in /etc/hosts (or run dns or use <hostname>.local with avahi service running) to resolve the hostname.
sure nmbd is running correctly? that's what establishes the hostnames on the windows network - the smb kioslave might rely on it to determine how to reach the other server. I know I use it on my home network - I have two linux boxes, a mac, and an old laptop running xp for compatibility - they can all see each other via samba, ftp, and sftp, and they all advertise as a windows network since that's the most limiting. I also use my /etc/hosts file pretty liberally with static ips.
The more I look at this and do research, the more I am convinced it is a nmbd issue. I tried to delete wins.dat and browse.dat, and have the system recreate them fresh. That had some positive impact, but not total resolution.
I'll probably try to uninstall and purge samba next (with apt) and reinstall it, to see if that helps clear out whatever config file is messing me up.