xgerman's technology blog

Running SMB V1 on a separate VLan on Ubuntu for Sonos Speakers


Sonos insists on samba v1 to access music files on a file server. I have a small server in my network and this shows how I expose samba v1 to sonos on a specifc (sonos) VLan which I have setup on my router and my access points with a separate WLAN id.

Setup VLan in Ubuntu

Verify with ip a what your ethernet trunk port is. In my case it's enp2s0, my vlan tag is 9, and my subnet is\24. Since I want docker to handle everyhting I am not creating explicit vlan interfaces. I am also ignoring that I am actually running dhcp on said subnet nor am I taking care of IPv6.

Here is the command to create the docker network:

docker network  create  \
-d ipvlan \
--subnet= \
--gateway= \
-o parent=enp2s0.9 ipvlan9

You can test this setup with:

root@micro-snoopy:~# docker run --net=ipvlan9 -it --name ivlan_test1 --rm alpine /bin/sh
/ # ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
13: eth0@if11: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UNKNOWN
    link/ether 94:c6:91:1a:57:78 brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth0
       valid_lft forever preferred_lft forever
/ # ping
PING ( 56 data bytes
64 bytes from seq=0 ttl=64 time=0.666 ms
64 bytes from seq=1 ttl=64 time=0.538 ms
64 bytes from seq=2 ttl=64 time=0.543 ms
64 bytes from seq=3 ttl=64 time=0.628 ms
--- ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.538/0.593/0.666 ms

For fun you can run some ping (this is the address the ip a inside the container showed) on another host on that network.

Start the samba v1 docker container

docker run --net=ipvlan9  --name samba -p 139:139 -p 445:445 -v /home/german/samba/Music:/mnt/Music -d dperson/samba -p -s "music;/mnt/Music;yes;no" -g "ntlm auth=yes" -g "server min protocol = NT1"   -S

Once this is done you can log in again to figure out the IP address of the server and use that to link to your sonos.