WAN access for NVR PoE Camera

Kandeman

n3wb
Joined
Sep 29, 2016
Messages
26
Reaction score
5
I’m trying to configure one of my camera’s to email photo’s when an event is triggered. I have this successfully working for a WiFi enabled camera that is on my main LAN but am having issues with getting it working for one of the PoE camera’s sitting on my NVR.

I have enabled Virtual Host and am able to access the camera’s via the NVR’s virtual ports e.g. 192.168.0.150:65001 but I can’t get email to work from the camera (192.168.254.2). As suggested in a number of posts I have tried to configure a static route in my router to enable this but I’m not 100% sure it’s configured correctly.

Network Gateway IP 192.168.0.1
NVR LAN IP 192.168.0.150
NVR PoE IP 192.168.254.1

Static Route that I configured on my router

IP Address 192.168.254.0
Subnet 255.255.255.0
Gateway 192.168.0.150 <- is this right?

But I also tried Gateway as 192.168.0.1

In both cases I still get an error that the Camera is unable to contact the test server when testing the email setup.

The camera’s network is configured as.
IP 192.168.254.2
Subnet 255.255.255.0
G/W 192.168.0.1 <- is this right?

I tried running a tracert 192.168.254.2 but it failed after reaching 192.168.0.150 which seems to indicate I've configured something wrongly but I'm not sure what. The other threads on this topic bounce around so much that I wasn't clear on what the final solution was.
 

alastairstevenson

Staff member
Joined
Oct 28, 2014
Messages
15,966
Reaction score
6,795
Location
Scotland
The static route looks OK.
G/W 192.168.0.1 <- is this right?
This is not correct - the camera default gateway needs to be 192.168.254.1
And the NVR channel needs to be set to Manual instead of Plug&Play to prevent the NVR from reconfiguring the gateway back to its original value.

A way to check all is working is to point the browser at the camera actual IP address - 192.168.254.2 and confirm it can be reached.
 

Kandeman

n3wb
Joined
Sep 29, 2016
Messages
26
Reaction score
5
So that works as I can access the Camera from 192.168.254.2 but the email still doesn't work. Still getting Failed to connect the test server hmmmm older firmware due to it being a hacked camera. Maybe that's the issue not the network access?
 

Kandeman

n3wb
Joined
Sep 29, 2016
Messages
26
Reaction score
5
So I've tried two different Camera's
DS-2CD2335-I with V5.4.20 build 160726
DS-2CD3345-I with V5.3.9 build 160612

and I've tried two different emails gmail and yandex and they both yield the same result.
 

alastairstevenson

Staff member
Joined
Oct 28, 2014
Messages
15,966
Reaction score
6,795
Location
Scotland
and I've tried two different emails gmail and yandex and they both yield the same result.
Check the DNS settings.
If the NTP setting has a test button and a domain name configured - you can check if name resolution is working there.
 

Kandeman

n3wb
Joined
Sep 29, 2016
Messages
26
Reaction score
5
As DNS I tried 8.8.8.8, 192.168.01 (router) and the NTP test with time.google.com does not work, failed to connect to test sever
 

Kandeman

n3wb
Joined
Sep 29, 2016
Messages
26
Reaction score
5
When I use my own local time server it works but time.Windows.com doesnt
 

Kandeman

n3wb
Joined
Sep 29, 2016
Messages
26
Reaction score
5
When I use my own local time server it works but time.Windows.com doesnt
It does sound like a DNS issue which results in the test not being able to connect to either the NTP or gmail server. If I run a tracert for smpt.gmail.com and then use the IP address instead and it works would that confirm that I have a DNS issue?
 

alastairstevenson

Staff member
Joined
Oct 28, 2014
Messages
15,966
Reaction score
6,795
Location
Scotland
Yes, that was the idea, if it works using an external IP address you need to suspect name resolution.
You can get the IP address by pinging the domain name.
 

Kandeman

n3wb
Joined
Sep 29, 2016
Messages
26
Reaction score
5
Surprisingly that didn't work, using the IP address for both the NTP time (time.windows.com / 52.166.120.77) and email server address (smtp.gmail.com / 74.125.23.108) achieved the same result. Failed to connect the test server!

To summarise:

Network Gateway IP 192.168.0.1
NVR LAN IP 192.168.0.150
NVR PoE IP 192.168.254.1

Static Route that I configured on my router

IP Address 192.168.254.0
Subnet 255.255.255.0
Gateway 192.168.0.150

The camera’s network is configured as.
IP 192.168.254.2
Subnet 255.255.255.0
G/W 192.168.254.1
DNS1 8.8.8.8
DNS2 192.168.0.1

I can access the POE camera 192.168.254.2 directly so that works.

Hik NVR.JPG Hik cam email.JPG Hik cam NW.JPG static route.JPG
 

mkkoskin

Young grasshopper
Joined
Feb 12, 2015
Messages
51
Reaction score
9
Unless your NVR can route, this will not work.

The way the packets would now travel (with the above setup)
(Camera 192.168.254.2) -> (NVR PoE IP 192.168.254.1) -> Stops here

You would have to create a static route on the NVR to pass all traffic from NVR PoE IP interface to Network Gateway IP through NVR LAN IP interface.
 

alastairstevenson

Staff member
Joined
Oct 28, 2014
Messages
15,966
Reaction score
6,795
Location
Scotland
Unless your NVR can route, this will not work.
Many people have used the configuration shown above to allow their NVR POE-connected cameras to send image attachments via email, it's awell-established method.

The way the packets would now travel (with the above setup)
(Camera 192.168.254.2) -> (NVR PoE IP 192.168.254.1) -> Stops here
Sorry, that's incorrect.
When 'Virtual Host' is enabled on the NVR, it turns on 'ip_forwarding' (not to be confused with port forwarding) in the Linux kernel between the NVR LAN interface and the POE ports interface, by setting a non-zero value in /proc/sys/net/ipv4/ip_forward

You would have to create a static route on the NVR to pass all traffic from NVR PoE IP interface to Network Gateway IP through NVR LAN IP interface.
With ip_forwarding enabled, packets are passed between the NVR LAN and POE interfaces by the Linux kernel.
 

alastairstevenson

Staff member
Joined
Oct 28, 2014
Messages
15,966
Reaction score
6,795
Location
Scotland
Can I not get email working on a POE camera then?
Many people have done this successfully, using the configuration settings as you have quoted.
It's not clear why your setup isn't enabling this.


What's the NVR model, and firmware version?
Presumably Virtual Host is enabled?
 

Kandeman

n3wb
Joined
Sep 29, 2016
Messages
26
Reaction score
5
NVR settings.JPG NVR v-cont.JPG

When I turn v-control off I can no longer access the camera via 192.168.254.2 but can when I turn it back on so that seems to be working.
 

mkkoskin

Young grasshopper
Joined
Feb 12, 2015
Messages
51
Reaction score
9
Many people have used the configuration shown above to allow their NVR POE-connected cameras to send image attachments via email, it's awell-established method.


Sorry, that's incorrect.
When 'Virtual Host' is enabled on the NVR, it turns on 'ip_forwarding' (not to be confused with port forwarding) in the Linux kernel between the NVR LAN interface and the POE ports interface, by setting a non-zero value in /proc/sys/net/ipv4/ip_forward


With ip_forwarding enabled, packets are passed between the NVR LAN and POE interfaces by the Linux kernel.
I was not familiar with the "Virtual Host" this NVR offers and was definitely not expecting it to actually enable IP forwarding. Thank you for explaning this!

Do you know how the system manages returning traffic? Does the gateway need a static route from WAN -> NVR PoE IP to know where to return the packets? When routing, both ends need to know the route, I assume it is the same in this case? Or does this work like a NAT?

Example case:
From camera to NVR to gateway
.254.2 -> .254.1 -> .0.150 -> .0.1
Reply from gateway to camera
Who is .254.2 and how to reach? <- .0.1

If there is a way to test this connection with a simple "ping", the responses can shed some light on whats causing the connection not to work. Does the camera/nvr/gateway support ssh/ping?
 
Last edited:

alastairstevenson

Staff member
Joined
Oct 28, 2014
Messages
15,966
Reaction score
6,795
Location
Scotland
Do you know how the system manages returning traffic? Does the gateway need a static route from WAN -> NVR PoE IP to know where to return the packets? When routing, both ends need to know the route, I assume it is the same in this case? Or does this work like a NAT?
That's a good question.
Not so much a static route from WAN to NVR POE interface - but a valid NAT linked entry for the POE subnet and the external connection.
I wonder if the router only does NAT for LAN addresses on its own subnet. That would be unusual.
Despite the facility to create a static route and the fact that it is working OK, as the POE-connected camera is accessible from the LAN at it's native address.
 

alastairstevenson

Staff member
Joined
Oct 28, 2014
Messages
15,966
Reaction score
6,795
Location
Scotland
I had a look through the entire console and couldn't find anything like a ping or trace that might help.
I think the suggestion was aimed at doing the ping from a LAN-connected PC.
But that should work fine, as you are able to access the camera from the LAN at it's real IP address.

A suggestion, if you feel inclined to spend a bit more time exploring connectivity:

Temporarily set the PC IP address to one on the same range at the NVR POE-connected cameras, such as 192.168.254.100 with a default gateway of 192.168.254.1
Set the DNS to the IP address of your LAN router, 192.168.0.1
Connect the PC to a spare NVR POE port.

At a Windows command prompt, try the following:
ping 192.168.0.150
ping 192.168.0.1
ping smtp.gmail.com
tracert 192.168.0.1
tracert smtg.gmail.com
ping 8.8.8.8

These should all work OK, but if not, change the PC DNS to 8.8.8.8 and repeat.
 
Top