Thursday, January 6, 2011

How to listen to a netradio channel when the firewall blocks the port

TCP port 8000 is being blocked in the customer's premises where I'm currently working. This is a Windows box. Putty resolves the problem easily for me, with some support from a remote FreeBSD setup. A GNU/Linux box would do the same.

1. Configure Putty to forward a TCP port to some local port in the FreeBSD machine.
From Putty configuration,
-> Connection -> SSH -> Tunnels -> "Add a new forwarded port"

  • In the Source port field, type some port, that is the port where you will be connecting to from your media player. Use for example, 8080.
  • In the Destination field, type for example, localhost:8000.

2. Now with Putty's SSH port forwarding configured, SSH to your FreeBSD/Linux account.

3. Now we need to forward the netradio data to the port what is being forwarded to the Windows machine. For that, I'm using wget and netcat. So in the Linux/FreeBSD account, command
 wget -qO-  http://relay5.slayradio.org:8000 | nc -l 8000
The above is redirecting wget's output to stdout and that is then piped to netcat that is listening to local port 8000. That was the port that is being forwarded. Note that in some version of nc, you may need to add the -p switch for it to work, e.g. "nc -l -p 8000".

4. Now, the netradio data is available from port 8080 from the Windows computer. You may now connect to http://localhost:8080/ using your favorite media player and start listening.