the itjerk

my adventures with technology

Tag Archives: port forward

raspberry pi and the squeezebox server

Here's something that's really easy to setup – streaming music from your Slimserver/Squeezebox Server/Logitech Media Server to your Raspberry Pi. Not a lot of assumptions here; my Squeezebox Server is at home, and I'm at work; I've opened the necessary ports at on my home computer and router (22 tcp, 9000 tcp, 3483 tcp/udp), and I know it's WAN and LAN addresses. I'm also going to assume that you know the drill about opening ports on computers, your work's security policies and all that jazz.

Please note that all this can be done using your remote computer's host name; just open a stream to in just about any media player, play it, then open a browser to, select the remote player, queue up some music and press play! All this assumes that your Squeezebox Server is set to use port 9000.

But for security's sake, I'm going to use ssh port forwarding to send all the traffic through a tunnel. This not only secures the stream by using ssh, but allows you to load the stream and view the web interface using the localhost interface on your RPi.

Okay, first setup a port forward from your Squeezebox Server at home on your RPi using the terminal. Note that all addresses are for your Squeezebox Server computer.

ssh -L <local port>:<lan address>:<lan port> <username>@<wan address>

Next, just add the music stream to mpc and play it:

mpc add http://localhost:9000/stream.mp3
mpc play

Now, point your browser to http://localhost:9000 (or whatever local port you are forwarding to), select the appropriate player (mpd on your RPi), queue up some music, and viola, you can enjoy all the music from your Slimserver/Squeezebox Server/Logitech Media Server wherever your Raspberry Pi is connected!


dynamic port forwarding with ssh

Need to surf securely at work, or on a public wifi? Here's the poor man's vpn. Using an OpenSSH connection to your host machine with the dynamic "-D" flag, you can create a SOCKS proxy for a web browser on another machine. On a Windows machine, you'll need to use Putty to get your ssh connection.
Here's the connection:

ssh -D port user@hostmachine

Once you connect via ssh to your host, configure Firefox to use the SOCKS proxy server. (Options>Advanced>Network>Connections)

For even more security, you can also configure Firefox to route all its DNS requests through the same tunnel. From Firefox's address bar, type "about:config" for "advanced" settings, then look for the key "network.proxy.socks_remote_dns" and set it to true by double-clicking. Done! All your surfing will tunnel through your host machine.

To verify that everything's working, point Firefox here to verify the IP address matches that of the host machine.