# SMB share with Domain Name

#### incedis

##### Member
Can connect to my SMB share on a Pi with IP but cannot connect with domain name.
I have absolutely no issue when using IP. For the sake of not dying dumb, could someone explain me why this is happening with the domain name 'raspberrypi.lan' ?

Code:
$hostname raspberrypi$ nmblookup raspberrypi
192.168.8.226 raspberrypi<00>

smbclient -L 192.168.8.226
Unable to initialize messaging context

Sharename       Type      Comment
---------       ----      -------
print$Disk Printer Drivers share Disk Pi shared folder guest Disk guest IPC$            IPC       IPC Service (Samba 4.9.5-Debian)
Reconnecting with SMB1 for workgroup listing.

Server               Comment
---------            -------

Workgroup            Master
---------            -------
WORKGROUP            RASPBERRYPI

nmblookup -M -- -
192.168.8.226 __MSBROWSE__<01>

Last edited:

OP
I

#### incedis

##### Member
Found an answer to my problem.
A bit complex for me but made it worked.
Long explanations and resource for this issue in case people are interested domain name lookup
Context
I am using systemd-resolved. Actually I have fully switched to systemd-resolved. A brand new Arch install will not (for reasons unknown to me) convert your system to using systemd-resolved. Ubuntu does..
1)
Code:
1) ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
The symlink from 'stub-resolv.conf' to '/etc/resolv.conf' has to happen. See resource symlink explanation
2 ) Since using 'systemd-resolved' you now need to configure 'resolved.conf' in '/etc/systemd/resolved.conf'
domain name resolution is now made through LLMNR. See resource here LLMNR
Comment out the option.
In my context, it worked and hope yours would also. But no guarantee because if you read the resource I have linked there is a lot of variables at play depending on your configuration and your distro.

Using KDE, I can now access my raspberrypi smb share through domain name.
You can also see stats using resolvectl which is kind of neat.

Code:
resolvectl statistics
DNSSEC supported by current servers: no

Transactions
Current Transactions: 0
Total Transactions: 313

Cache
Current Cache Size: 27
Cache Hits: 159
Cache Misses: 182

DNSSEC Verdicts
Secure: 0
Insecure: 0
Bogus: 0
Indeterminate: 0

#### TheProf

##### Gold Member
Gold Supporter
I think you can also modify the hosts file on your local machine with the DNS name and IP, that way from your machine when you ping/connect using a DNS name, it should work. Another option would be to have a DNS server that can resolve names to ip addresses.

In my lab, I use a combination of hosts file in Liniux/Windows and a DNS server to resolve names to IP addresses.

\$100 Digital Ocean Credit
Get a free VM to test out Linux!