SOLVED Cannot connect to SMB share, hostname listed in host_allow

simon_lefisch

Dabbler
Joined
May 24, 2020
Messages
24
Hello everyone,

I have setup a private SMB share for myself and created a list of allowed devices in Hosts Allow (laptop, phone) using the hostname. However I cannot seem to connect to it. I receive an error on my MacBook Pro saying "There was a problem connecting to the server xxx.xxx.xxx.xxx. Check the server name or IP address and then try again. Contact your system admin if issue persists." Using IP addresses instead of hostname works fine. I tried to find a solution online and added the hostnames to the Hostname Database in Network >> Global Configuration to be sure but still nothing. Is there something else I'm missing? I tried just the hostname, hostname and domain (hostname.domain) but still nothing. I know I could use the IP address but would rather use hostname since these devices are DHCP.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,398
The hostname database is for the FreeNAS server's resolution. In your case, you need to add an entry for your FreeNAS server to your MacBook's /etc/hosts.
 

simon_lefisch

Dabbler
Joined
May 24, 2020
Messages
24
The hostname database is for the FreeNAS server's resolution. In your case, you need to add an entry for your FreeNAS server to your MacBook's /etc/hosts.
Thanks for the reply. Idk how that would fix my issue considering that I am trying to connect to the SMB share using the IP address. I tried it anyway and still cannot connect. Maybe I didn't explain it correctly....The issue is using device hostnames in the host_allow section of the SMB share. If I input the IP address of my Mac in that section I can connect just fine. Using ie; macbook.local gives me the error I mentioned above.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,398
It's reciprocal hosts entries. The FreeNAS server needs an entry for the MacBook. The Macbook needs an entry for the FreeNAS server.
 

simon_lefisch

Dabbler
Joined
May 24, 2020
Messages
24
Interesting, considering that before I switched to FreeNAS I was running a CentOS 7 VM as an SMB server and I didn't have to have an entry for it in /etc/hosts on my Mac...and I was able to connect to it just fine when using smb://<username>@<server_ip>/<share>.

Also, as a test, have an NFS share running. I input the my Mac's hostname into host_allow and was able to connect to it just fine. Anyway, like I said, I added FreeNAS to /etc/hosts on my Mac and still had the same error.
 
Joined
Oct 22, 2019
Messages
3,579
Are you using .local by any chance? This is a shot in the dark, but if so, try something other than .local, such as .home or .private. (Make the appropriate change away from .local to something else in your local DNS server or router.)

I had issues with ".local" that I no longer use .local anymore. (I instead have used, and currently use, such alternatives as .router, .nas, .private, .home, and so forth.)
 
Last edited:

simon_lefisch

Dabbler
Joined
May 24, 2020
Messages
24
Are you using .local by any chance? This is a shot in the dark, but if so, try something other than .local, such as .home or .private. (Make the appropriate change away from .local to something else in your local DNS server or router.)

I had issues with ".local" that I no longer use .local anymore. (I instead have used, and currently use, such alternatives as .router, .nas, .private, .home, and so forth.)
I'm not using ".local". I have my router (pfSense VM) set the domain as ".lan". I've also added it to FreeNAS under Network >> Global Configuration. This is really throwing me for a loop. It happens regardless of OS (tested in Ubuntu, Windows, and Mac) o_O
 
Joined
Oct 22, 2019
Messages
3,579
Using ie; macbook.local gives me the error I mentioned above.

I was referring to the client computers, such as your Macbook in this case. It sounds like if you enter its local IP address in the hosts_allow, it works as expected, but if you add macbook.local in the hosts_allow, it doesn't work.
 

simon_lefisch

Dabbler
Joined
May 24, 2020
Messages
24
I was referring to the client computers, such as your Macbook in this case. It sounds like if you enter its local IP address in the hosts_allow, it works as expected, but if you add macbook.local in the hosts_allow, it doesn't work.
I did try listing as MacBook.lan in hosts_allow but still could not connect. I have not tried changing the hostname of my Mac to .lan tho. I wouldn't think I'd have to but it's worth a try I guess, but in Network Preferences under the DNS tab DNS shows my pfSense VM and Search Domains shows .lan. When I ping my MacBook, it comes back with MacBook.lan. Running the command hostname in Terminal comes back with the .lan domain as well so DNS is working properly. The thing is, it happens no matter what OS (as stated in my previous post).
 
Last edited:

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,543
I did try listing as MacBook.lan in hosts_allow but still could not connect. I have not tried changing the hostname of my Mac to .lan tho. I wouldn't think I'd have to but it's worth a try I guess, but in Network Preferences under the DNS tab DNS shows my pfSense VM and Search Domains shows .lan. When I ping my MacBook, it comes back with MacBook.lan. Running the command hostname in Terminal comes back with the .lan domain as well so DNS is working properly. The thing is, it happens no matter what OS (as stated in my previous post).
Try setting hostname lookups = yes as an auxiliary parameter under Services->SMB, restart the SMB services, and try again.
 

simon_lefisch

Dabbler
Joined
May 24, 2020
Messages
24
Try setting hostname lookups = yes as an auxiliary parameter under Services->SMB, restart the SMB services, and try again.
I did come across that option and I set it up but had no luck (under Services >> SMB and in Auxiliary Parameters of the SMB share itself). Is there maybe something else that I need to set somewhere else in Settings? Maybe something I overlooked? I swear I went thru and set everything correctly.
 

simon_lefisch

Dabbler
Joined
May 24, 2020
Messages
24
@anodos so, gave it one more try with the hostname lookups = yes parameter, input hostname.lan in the hosts allow field, restarted FreeNAS this time and now I can connect to the share. Idk what changed besides restarting FreeNAS vs restarting the SMB service. So weird o_O Anyway, looks like it's working finally. Thanks for everyones help with this. Marking as resolved.
 
Top