Sonos and SmartOS - Samba Server
Posted by Dave Eddy on May 05 2015 - tags: techSonos is a fantastic product that makes it easy to set up whole-house audio in a piecemeal fashion. I started with one speaker, then a couple weeks later was up to 4 speakers, and a couple months after that the whole house is equipped with enough speakers for music to be heard anywhere.
In order to stream your own music collection to Sonos, it must be available over the network using a supported protocol - sadly at the time of this writing NFS is unsupported by Sonos. In order to get Sonos up and running on my network, I setup a cifs/samba read-only share with my music collection inside a SmartOS zone.
This post is basically a modified version of Jonathan Perkin’s and Thomas Merkel’s posts covering mounting in a shared directory with music using lofs.
create the zone
To create the zone you have to first create a JSON manifest to be used by the
vmadm(1M)
command. This is the JSON manifest for the cifs
zones called
cifs.json
I used. The filesystems
array mounts in /goliath/entertainment
from the Global Zone to /entertainment
inside the zone. I do this because my
entertainment
directory is used by multiple zones - for example my plex
zone
uses it to share my plex library.
{
"brand": "joyent",
"image_uuid": "c02a2044-c1bd-11e4-bd8c-dfc1db8b0182",
"autoboot": true,
"alias": "cifs",
"hostname": "cifs.rapture.com",
"dns_domain": "rapture.com",
"resolvers": [
"10.0.1.2",
"10.0.1.3"
],
"max_physical_memory": 512,
"filesystems": [
{
"source": "/goliath/entertainment",
"target": "/entertainment",
"type": "lofs",
"options": [
"ro"
]
}
],
"nics": [
{
"nic_tag": "admin",
"ip": "10.0.1.31",
"netmask": "255.255.255.0",
"gateway": "10.0.1.1",
"primary": true
}
]
}
Note: this mounts /entertainment
as read-only, so even if there is a bug
with the samba software, no network user will be able to delete or modify
data.
Create the zone with
vmadm create -f cifs.json
manage cifs
First, login to the zone
vmadm list | grep cifs
zlogin <uuid>
Then, ensure pkgin
is up to date
pkgin up
pkgin fug
Next, install the samba
package
pkgin in samba
Create the necessary config file at /opt/local/etc/samba/smb.conf
[global]
security = share
load printers = no
guest account = nobody
log file = /var/log/samba/log.%m
[entertainment]
path = /entertainment
public = yes
only guest = yes
writable = no
printable = no
This shares out /entertainment
(which is mounted ro from the Global Zone)
to the network with guest/anonymous access.
Finally, start the samba services
svcadm enable samba:smbd
svcadm enable samba:nmbd
svcadm enable dns/multicast
Now you have a working cifs server
setup Sonos
In the Sonos app you can go to the Music Library settings in the preferences pane and add the new cifs server. For my server I used
//10.0.1.31/entertainment/Music/DavesMusic