- Jan 14, 2018
- 29
- 3
If your newer model Hikvision camera won't let you connect from remote over the Internet into a Linux [homemade NVR] server, maybe because you've firewalled prober IP addresses, or for some other reason you restrict your camera's access to the Internet -
I added a fifth brand new Hikvision camera to four others that were about 5 years old. Unlike the four old cameras, this new one would only allow me to view the live stream locally (same 192.168.x.x subnet). Neither does it allow me to log into its web page when I'm off-site. This was NOT OK with me.
My server side solution to allow me remote connect for rtsp live stream is:
where you can see I've changed my rtsp ports to 9554 just to be a non-conformist, and my camera address is 192.168.0.12.
To allow me remote management via the camera-served web page, I run:
where I've changed my http ports to 9080 just to be a non-conformist, and my camera address is 192.168.0.12.
These lines are actually used instead of the iptables nat table DNAT rules, otherwise necessary for those ports. Note that the specific camera then cannot use "basic" authentication for the rtsp stream, and whatever rtsp player used on the client machine to view that camera's live stream will have to accommodate the same. rtsp authentication will have to be "digest" for newer cams or "none" for older ones.
In case you're wondering, I'm not seeing the "T300" do any good. It is supposed to be a timeout to remove the camera login after use.
EDIT: This technique also defeats that evil Hikvision 5 minute time limit viewing live streams off-site.
I hope someone else can be helped by this this.
I added a fifth brand new Hikvision camera to four others that were about 5 years old. Unlike the four old cameras, this new one would only allow me to view the live stream locally (same 192.168.x.x subnet). Neither does it allow me to log into its web page when I'm off-site. This was NOT OK with me.
My server side solution to allow me remote connect for rtsp live stream is:
nohup socat -T300 TCP4-LISTEN:9554,fork,reuseaddr TCP:192.168.0.12:9554 2>/dev/null &
where you can see I've changed my rtsp ports to 9554 just to be a non-conformist, and my camera address is 192.168.0.12.
To allow me remote management via the camera-served web page, I run:
nohup socat -T300 TCP4-LISTEN:9080,fork,reuseaddr TCP:192.168.0.12:9080 2>/dev/null &
where I've changed my http ports to 9080 just to be a non-conformist, and my camera address is 192.168.0.12.
These lines are actually used instead of the iptables nat table DNAT rules, otherwise necessary for those ports. Note that the specific camera then cannot use "basic" authentication for the rtsp stream, and whatever rtsp player used on the client machine to view that camera's live stream will have to accommodate the same. rtsp authentication will have to be "digest" for newer cams or "none" for older ones.
In case you're wondering, I'm not seeing the "T300" do any good. It is supposed to be a timeout to remove the camera login after use.
EDIT: This technique also defeats that evil Hikvision 5 minute time limit viewing live streams off-site.
I hope someone else can be helped by this this.
Last edited: