开发者

Access my foscam camera on my home from the Internet - using ssh tunnels

Recently I buyed a Foscam wireless IP camera: http://www.foscam.com/Products_List.asp?id=173

In my home, my laptop and my IP camera are behind a cable modem (my ISP gives me a dynamic IP) using a linksys router (I dont have a public IP).

Actually I use SSH in a basic way to learn / manage some basic things in my VPS server.

My question is (the right ssh flags and comm开发者_高级运维ands to achieve this):

I think that I need to create:

  1. A tunnel from my local router to a remote VPS server where I have root access.

  2. A portforward in the router.

Thanks in advance.


You need to add a port forward in your router from port X to port 22 on your home computer.

You can then ssh -p X username@your-home-ip.

Include the -L Y:foscamip:80 command line switch when you run ssh, assuming focscam runs a web server on port 80 (standard). Use something over 1024 for Y, like 8080.

Open up a web browser, and go to http://localhost:Y.

You have access! When you're done, simply log out of your ssh session.


Old question, but I will answer in the hope it helps someone like me. Given:

  • you have a VPS with root access at root@example.com
  • you have an RTSP-compatible IP camera in your LAN at address 192.168.1.100
  • you have a PC/router/Raspberry Pi able to create the tunnel

what I did was

ssh -N -f -R 10554:192.168.1.100:554 root@example.com

Exaplanation:

  • -N: don't execute any command via SSH
  • -f: put SSH in the background
  • -R: remote port forwarding
  • 10554: a port to open on the VPS to access the IP camera (better if > 1024)
  • 192.168.1.100:554: IP address and port you want to access remotely
  • root@example.com: user and address of your VPS

To access the RTSP stream of the camera, open rtsp://<username>:<password>@example.com:10554/<path-to-stream>.

Of course it works fine also for other kind of streams (e.g. HTTP).

Better yet, use autossh.

/usr/bin/autossh -N -f -M 0 -i /home/pi/.ssh/id_rsa -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -R 10554:192.168.1.100:554 root@example.com.

I ended up with this command reading a lot of articles on the web. I even created an autossh user on the VPS without a shell, so it can do nothing apart from port forwarding.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜