I've got a SMB shared folder on my Windows notebook and I connect to it via IP address in RaspBMC, I had the IP static until I realised that if I went out of the network I had to set it back to dynamic.

Is there any way of accessing a SMB shared folder from RaspBMC using the MAC address instead of the IP?

  • And what is wrong with DNS Names? MAC addresses are very low level and not really recommended to do that. MAC's are best used in firewalls and traffic shaping. So you would need to setup IPTables and query IPTables for the MAC to get the IP. But if you setup your Pi to a non clashing DNS name like raspberrypi1, use DHCP and the DNS on your router, you can just connect to SMB by typing //raspberrypi1
    – Piotr Kula
    May 12, 2015 at 9:44

1 Answer 1


It's more simple to just use windows network zones so it automatically uses a static IP for only your router, or give your computer a WINS name and get kodi to use the name not the IP.

grep smb /home/osmc/.kodi/userdata/sources.xml
<path pathversion="1">smb://WINNAME/Video/</path>

But yes you can write a root script to connect by mac address:

IP=$(nmap -p 445 | grep -B 4 B8:27:EB:9E:87:2A | grep "report for" | perl -pe 's/.* //g')
sed 's/(smb:\/\/)[^\/]+(\/)/$1'$IP'$2/' /home/osmc/.kodi/userdata/sources.xml

Then have it run from crontab or on command from the Kodi Advanced Launcher

Setting up a DNS server is another option but more complicated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.