Thursday, June 3, 2010

Resolving FOSCAM connection dropouts

I bought a FOSCAM FI8908W wireless IP webcam off eBay recently. It has lots of features for the price.

However, I've had problems with being unable to connect to the camera after a period of time (an hour or so). Power cycling the camera would fix the problem.

I've tried upgrading to the latest firmware (version 11.14.2.17 is supposed to fix WiFi disconnection problems), but it did not fix my problem.

The problem is not related to my browser or the wireless network. I've tried disabling DHCP (router based static IP). It turns out the problem is that the webcam simply ceases to respond to ARP requests (once in this broken state).

The ARP protocol is a mechanism to translate between IP addresses and Ethernet MAC addresses. Without ARP, you cannot perform IP communications over Ethernet (since all Ethernet traffic must be destined to MAC addresses). The ARP protocol allows network devices to discover the MAC addresses of the designated IP address.

Simply adding a static ARP entry on your PC will restore communications. This show how on Windows to determine the MAC address of your webcam (e.g. IP address 192.168.1.20) and then create a static ARP entry:
c:\> ping 192.168.1.20

Pinging 192.168.1.20 with 32 bytes of data:

Reply from 192.168.1.20: bytes=32 time=7ms TTL=64
Reply from 192.168.1.20: bytes=32 time=3ms TTL=64
Reply from 192.168.1.20: bytes=32 time=3ms TTL=64
Reply from 192.168.1.20: bytes=32 time=3ms TTL=64

Ping statistics for 192.168.1.20:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 3ms, Maximum = 7ms, Average = 4ms

c:\> arp -a
Interface: 192.168.1.1 --- 0x10003
Internet Address Physical Address Type
192.168.1.20 01-12-23-34-45-56 dynamic

c:\> arp -s 192.168.1.20 01-12-23-34-45-56

c:\> arp -a
Interface: 192.168.1.1 --- 0x10003
Internet Address Physical Address Type
192.168.1.20 01-12-23-34-45-56 static
To make this change persist after rebooting, simply add the "arp -s" command to a batch file that you run from your Windows startup folder.

31 comments:

Arthur's Blog said...

Hi Mark,
Great blog, fascinated by the auto chicken door.
Re the Foscam
I have this dropout problem too, even with wired connections.
I have tried your suggestion. First I right click the command prompt to get administrator mode, then I try the arp - s ip mac
and it says:
The ARP entry addition failed, access is denied.

Is there a way around this?

Regards,

Mark Stead said...

@Arthur's Blog: From what I can tell you're using Windows 7 which has a different security model.

It appears that even if you attempt to run commands as the Administrator user, the commands will still run without full privileges.

A web search turns up lots of people with the same problem - such as this page:
http://allfaq.org/forums/t/146100.aspx

Under Windows 7, you also need to use a different command instead of arp, specifically something like this:
C:\> netsh interface ipv4 add neighbors "Local Area Connection" store=persistent 192.168.1.20 01-12-23-34-45-56

It appears to support persistent definitions, so you only need to run the command once (logged in as the Administrator).

That said I've got Windows XP, so I might be wrong on the syntax.

Tell us how you go.

Arthur's Blog said...

Hi Mark,

So far I haven’t managed to get the windows7 command to work, but I have to read up more to be certain I know what I am doing having only just got win7.

But I also wanted to run the Foscam remotely while I was away without leaving a computer switched on, just the router. I have set up the dynamic domain name server to allow incoming access of the camera via the router. The arp fix, as I understand it, wouldn’t help with remote access via a standalone router.

I have a few other observations that may lead to some understanding if not a fix.

My original configuration to avoid trouble with wireless through walls was to use the IP camera’s via a Homeplug, network:
http://en.wikipedia.org/wiki/HomePlug_Powerline_Alliance
The Homeplug is, as I understand it, a switch (Foscam recommend a switch over a hub) operating via the mains electricity in the house. But I got disconnects and so I tried wireless. This seemed to work better for a while, but perhaps it was just wishful thinking as the wireless now regularly drops out. I presume the static arp (xp) (netsh win 7) would potentially cure the Homeplug disconnects too.

Meanwhile I have run one camera directly wired to the router and so far, a few days and counting, it hasn’t dropped out.

So I have three potential solutions but only one is mildly elegant:

1 Wire all (3) cameras to the router.

2 Another solution mentioned on another thread would be a timer to recycle the power every few hours. I have some 48 position (15 minute period) mechanical timers which would do this.

3 I could leave my old xp machine running, having set static with arp, the trouble here being I have experienced a computer left running start to burn although thankfully it didn’t cause a fire. But I would hate to have a remote picture of the house burning while I was away.

Regards,

Mark Stead said...

@Arthur's Blog: When/if you've got multiple problems it can be difficult to resolve each individual issue.

This arp/netsh issue will affect wired & wireless communication. So if you have wireless/homeplug issues then just use a direct wired connection to your router and confirm that is stable/reliable.

I identified the source of my problem when I couldn't connect from one computer, yet another computer still had the video window open (and could still ping).

To check if the wireless connection is active, you may be able to check for an active association in the wireless access point/router. For example check the log files or status page. A wireless session can exist even if IP communications cannot be established.

Even if the wireless/homeplug network is unreliable and intermittently drops out, then communications should be reestablished again. Try power cycling the IPCam (or other devices) to see which device is the source of the problem.

Finally to allow remote access via a public IP, then it is your modem which initiates the local area connection to the IPCam (on behalf of the Internet client). You will need to add a static arp entry to the modem. Each modem will be configured differently. My Billion modem/router can only configure static arp via a command line interface.
C:> telnet router_ip
admin> ip interface iplan add staticarpentry 192.168.1.20 01:12:23:34:45:56
admin> ip interface iplan list staticarpentries

Static ARP entries for interface: iplan

ID | IP Address | MAC Address
-----|-----------------|-------------------
1 | 192.168.1.20 | 01:12:23:34:45:56
-------------------------------------------

Arthur's Blog said...

Progress with the drop out problem.

I am using a edimax router:
http://www.edimax.co.uk/en/produce_detail.php?pd_id=314&pl1_id=3&pl2_id=19

The equivalent of static mac to IP for this router seems to be DHCP reservation. See:

http://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol

This feature (which is not supported by all devices) is variously called Static DHCP Assignment (by DD-WRT), fixed-address (by the dhcpd documentation), DHCP reservation or Static DHCP (by Cisco/Linksys), and IP reservation or MAC/IP binding (by various other router manufacturers).

I am currently working in Oxfordshire with 3 cameras 170 miles away in Lancashire and a fourth camera (borrowed) here. So I have two of the Edimax routers and I have set DHCP reservation to cover the cameras with three fixed ip-mac in Lancashire, one here.

I have about 1.6 mbits down stream (about 0.4) upstream in Oxford, 5.2 and 0.4 in Lancashire and this may be a bit slow.

I had lots of troubles with Microsoft Explorer in terms of dropping the cameras but as I like the explorer display I struggled on but the huge down loads of information for the Explorer display and numerous errors sent me to Firefox, which worked, but it then started crashing. So I went with just the four cameras to Google’s Chrome browser, no other tabs.

This now seems to work. I have lost a camera but it then recovered. The display compared to Explorer is crude, but working is what matters and probably this interface will be enhanced in the by and by.

So for now communication between Oxfordshire and Australia (around 10,500 miles) between two individuals who know almost nothing of each other, has fixed communication between Oxfordshire and Lancashire (170 miles apart).

What amazing times we live in.

Many thanks for your help.

Regards,

Mark Stead said...

@Arthur's Blog: With my (Billion) modem/router, a fixed DHCP reservation is not the same as a static ARP entry. Other brands may be different.

Anyway, I'm glad it's working out for you.

REGINALDO said...

Hello,
I am not able to configure the router (TPLINK). How do I setup? Thanks!

REGINALDO said...

I want to configure IP CAMERA WIRELESS to have wireless access through the router. Tell me step by step. Help me please. Thanks!

Mark Stead said...

@REGINALDO: I think you'll have to read the TPLINK manual or at least be more specific on what your problem is.

The problem described here is not a wireless problem. You'll need to get the wireless connection working before you figure out if this problem is affecting you.

Bender said...

hi Mark, i am having problems with foscams frame rate being very slow, when viewed externally. On local LAN it works fine. I have ADSL 2 connection. But every time I login to view the camera, its nver 25-30 frames per sec, but rather 5 frames.

The camera is connected straight to the router. I was reading that there is an option to set frame rates, but i could not find it. The camera was bought on ebay.

Thanks

Igor

Mark Stead said...

@Bender: Gadget Victims describes how you can specify the resolution and frame rate on the URL.

> Updated CGI documentation:
> /videostream.cgi[?user=&pwd=&resolution=&rate=]
> /videostream.asf[?user=&pwd=&resolution=&rate=]
>
> Parameters:
> resolution:(8:320*240,32:640*480)
> rate: 0-23
> 0:maximum
> 1:20 fps
> 3:15 fps
> 6:10 fps
> 11:5 fps
> 12:4 fps
> 13:3 fps
> 14:2 fps
> 15:1 fps
> 17:1 fp/2s
> 19:1 fp/3s
> 21:1 fp/4s
> 23:1 fp/5s

I believe this only works in the later firmware revisions.

That said, your problem must be due to the speed of the ADSL 2 connection, since problems are not observed on the local network.

Keep in mind that for ADSL connections the upload speed is much lower than the download speed. ADSL 2+ has a maximum upload speed of 1.4Mbps, however your speed may be much lower.

I suggest you run an Internet speed test to determine your upload speed.

Also the Motion JPEG video format is not very compressed. In fact it is less compressed than I thought it would be.

I've analysed some recordings of mine, and the bit rate varies substantially between them. The highest was 2.86Mbps (including audio), the lowest was 1.12Mbps (no audio).

Based on these bit rates, I suspect it is highly likely that it is exceeding the speed of your ADSL 2 connection.

I guess the options then are to get a H.264 webcam or use VLC to perform transcoding on the fly.

Actually eBay has some not-to-expensive H.264 webcams, including the DOZ27W and GD-2805.

Mark Stead said...

I've confirmed the same problem affects the Foscam FI8905W (at firmware level 11.25.2.30).

Luckily adding a static ARP entry also fixes this camera.

allan said...

I think the problem has to do with certain types of routers or maybe the use of a subnet with NAT circumvents the issue. I have resolved the problem of Foscam dropping off my network by using an older belkin wireless G router and putting the cams in that subnet.

See my summary page for more details: http://allankosowan.com/FOSCAM.htm

J said...

This still resolving your troubles? After a few months of untroubled use, two camera's have started this exact behaviour. I am going to try to figure out the ARP settings for my dd-wrt router.

Jim said...

Great catch on the foscam camera; I added an arp entry and for the first time in weeks its gone > 1 day without disconnecting. THANK YOU!
-jim

Radu said...

I have a IP camera FI8908W and a router D-Link DIR655. IP camera connects to router using wifi
I have configures router to have a daily schedule for Wifi: starts at 9 AM and stops at 11.30 PM every day.
The issue is that IP camera does not starts when wifi starts at 9 AM.

The only way to make camera starts is to unplug and re-plug the power cord.
I have tried to use this tutorial and I have assigned a static ARP entry. Still not fixed. camera refuses to connect to the network when Wifi starts.

Camera is using firmware 11.4.2.28 and web UI 2.4.8.15 (latest from foscam site: http://www.foscam.com/down3.aspx)

Mark Stead said...

@Radu: I think you only require a static arp entry on your router if you are trying to access from another network - for example if you are trying to access over the Internet (or you have multiple local subnets).

Otherwise for a local connection, you will require a static arp entry on the client (e.g. PC or NAS) from which you are attempting to access/view the video.

The first step to diagnose is to determine whether you can ping the camera.

BTW Why don't you disable the WiFi schedule to prove that is or isn't part of the problem.

Buckyballs Australia said...

I have found a simple solution to fix foscam dropout. I just went out and bought a bigger, longer antenna. Now the camera has been up for 3 days non stop. Perfect.

Ben Ronsse said...

Hey Mark,

Sadly the solution didn't work for me. Nothing to do with an arp issue or so.

But i've found out that when i lower my speed in my switch from 100FD towards 10HD, i don't have any disconnections anymore...

Nasitopo said...

@Radu:
Did you solve your problem?
I have exactely the same problem.

(The issue is that IP camera does not starts when wifi starts at 9 AM. The only way to make camera starts is to unplug and re-plug the power cord)

Now What If I Do said...

There is a new firmware out that might just solve this problem, check it out here!

Rose Marry said...

Nice blog. I love the way you write.
PEO Networking

Nasitopo said...

@Now What If I Do
The new firmware is not for FI8908W..

Is it possible to use it in any case?

Thank you in advance

matthew lovelace said...

Camera Keeps Dropping off. I have the solution. Log into the camera and turn the brightness and contrast down from the default 6 on both settings to 3 on both settings. I have pulled my hair out and found that this corrects the issue with the camera dropping off. Its a light particle issue with the Foscam Cameras.Let me know how you go with this :):)

Regards
Matthew
IT Engineer

Nasitopo said...

@matthew lovelace

I tried but the solution you proposed doesn't solve my problem.

(The issue is that IP camera does not starts when wifi starts at 9 AM. The only way to make camera starts is to unplug and re-plug the power cord)

Fred said...

@matthew lovelace

This is a September's fool joke isn't it ??

Keanen said...

@matthew I cannot believe it but changing these values has my FI8904w up and running for a few minutes so far. Before changing these values, I could not get a stream to run for over a minute or two. Woot woot!

Thanks!

DonMcJr said...

Hello! Great Blog! I have 2 IP Cams running and have had them for 2 years no problems...had to buy a new router and the wired one works on host computer and remotely... the one that connects wirelessly works on host computer and will work on the Tinycam APP on my phone IF I an connected to the wireless network on my phone but it will not work on just 3g/4/g or remotely anywhere. Setting same for both cams different ports of course. WHat am I missing I know it's something infront of my face and I'm just missing it...

brewski said...

I have a foscam set up outside. It has driven me nuts. It is the second foscam camera(a replacement for the first). It seemed to work but the picture dropped ie a broken image symbol refreshing the camera shows an image for 1 second and then broken symbol again.
However changing the resolution to 320x240 the camera returns a stable picture.
Now on recommendations here I changed the brightness to 4 and the contrast to 2 and reset the resolution to 640x480 the picture seems stable.

Ron Braun said...

Hi mark great site I seek your help I have a FI9805w after setting all parameters & saving the cam denys me access after power down I get access deny @ log in I have set static ip as you suggested do you have any ideas Thanks Ron

Buythis Dashcam said...

Hello, I had the problem then it is now ok after disabling DHCP, do you know why ? And why was this DHCP enabled if we don't need it ? Thank you.