How to set up a network camera (a.k.a. IP camera)
Network cameras (a.k.a IP cameras) are gaining popularity rapidly among consumers due to their ever-improving quality, features and declining prices. An HD network camera that normally cost over $300 in 2012 can be bought under $60 in 2021. Traditional typical users of network cameras are enterprises that have professionals for installation and maintenance. Many consumers choose the DIY approach to set up their cameras. This article is meant to help these users. It by no means can replace the help from professionals that is needed for a variety of reasons – complexity of a video surveillance system, user lacking required basic computer/network knowledge, demanded expedition…
There are literally thousands of models of network cameras in use. It is impossible to have a set of instructions fitting every model perfectly. We use a popular model (M1034-W) by the network camera inventor – Axis – in this article. The setup steps for the vast majority of other network cameras are either identical or very similar to the ones described here.
A word about ONVIF®. Detailed explanation about ONVIF is beyond the scope of this article. An average user may only need to know that ONVIF is an international standard. An ONVIF conformant camera offers the maximum compatibility and interoperability with many software and hardware on the market. Generally speaking, ONVIF conformant cameras have more features and better quality than traditional non-ONVIF network cameras.
For this article, we assume the reader has very basic computer and network knowledge. Technically savvy users may find many parts are too rudimentary for them.
Network cameras are different from web cams and analog CCTV cameras. Web cams are connected to computers by USB cables. Analogy CCTV cameras are connected to servers by coax cables. Network cameras are connected to a network for access just like computers are connected to networks. Each network camera is actually a computer with a CPU and memory. I process images from CCD (Charge-coupled Device) or CMOS (Complementary Metal-oxide Semiconductor) sensors, send to clients (e.g. apps) and hosts a web server.
Connect the network camera to your Local Area Network (LAN). A LAN is often the home network of a consumer. Plug an Ethernet cable (a.k.a. Cat 5 cable) into the Ethernet socket of the network camera, then plug the other end to the router (a.k.a. gateway or access point).
If this network camera does not have Wi-Fi, this may be the only step needed for the network configuration.
Find the IP address of the network camera. There are a few ways to do it.
Use a utility program from the camera’s vendor to find the camera. Please make sure Dynamic Host Configuration Protocol (DHCP) is used for now to ensure the network camera obtains an appropriate IP address from the router.
The following is from AXIS IP Utility:
For ONVIF cameras, you can run an ONVIF client application to discover the camera. The following are from Onvier for Android, IP CENTCOM for Windows 8.1/10 and IP CENTCOM for Windows Phone.
Use your router’s configuration page to find the camera’s assigned IP. You can unplug, then plug in the Ethernet cable to see which device shows up on the list to determine the device’s IP. The following is an example:
- Use a utility program from the camera’s vendor to find the camera. Please make sure Dynamic Host Configuration Protocol (DHCP) is used for now to ensure the network camera obtains an appropriate IP address from the router.
Configure Wi-Fi. Use a browser to visit the camera’s web UI with its IP address and port (e.g. http://192.168.0.20:81). Please note that if the camera uses the default HTTP port 80, you do not need to specify the port in the web address. Some cameras uses a different port for HTTP (e.g. the generic network camera referred to in this article uses port 81).
The following two sets of screenshots show the Wi-Fi configuration pages of an Axis network camera and a generic network camera respectively:
Fix the IP address (i.e. make the IP address static). Since the IP address is dynamically assigned, it may change after a power cycle of the network camera or the router. Many routers try to use the same IP address for a device by default, but you should not rely on this for fixing the IP address. There are two ways to achieve this:
Configure then network camera to turn the dynamically assigned IP address to a static IP address.
You can use a utility program to do this.
The following is from AXIS IP Utility:
The following is from the Axis camera's web UI:
- Configure then network camera to turn the dynamically assigned IP address to a static IP address.
- Start using the Wi-Fi. Unplug the Ethernet cable, move the camera to your desired location (unplug and plug in the power cable if needed).
- Find the new IP again. Some network cameras obtain new IPs for Wi-Fi different from the ones for wired connections. You may need to know new IP for configuration.
Enable ONVIF Services (for some models of Axis).
Some ONVIF cameras (e.g. some from Axis) have ONVIF services disabled by default. You will need to enable ONVIF as shown by the following figures for Axis 1031-W:
Axis cameras require a set of users for ONVIF services different from that for other types of access (e.g. web UI, proprietary API). It is critical to add users for ONVIF services because these cameras have no users for ONVIF services by default. The following figure shows how to add ONVIF users.
Most users want to access their network cameras outside their LANs (e.g. outside their homes). The next section will explain how to access the cameras via Wide Area Network (WAN) (e.g. via cellular connections). Unless you are experienced with the camera and its configuration, it is extremely important to make sure the camera works on your LAN first. This is because the WAN access will never work if the LAN access does not work. If it works on your LAN, it will be very easy to diagnose any issues with the WAN access.
Many apps have automated the setup process to a great degree, and it usually takes less than 1 minute to set up a camera before starting enjoying its video.
The following is for setting up a camera with apps Onvier for Android, and IP CENTCOM for Windows 8.1/10 and Windows Phone.
The first step is choosing the type of device for the configuration as shown by the following figure:
ONVIF is the recommended one. Almost all new modern network cameras are ONVIF conformant. Please note most ONVIF cameras can also be used as generic RTSP stream or generic MJPEG. Older network cameras support RTSP, MJPEG, or both.
Once the type is selected, input the few required parameters (e.g. user name, password), the setup will usually be completed in seconds. The following figures show the setup screens for Onvier, IP CENTCOM for Windows Phone and Windows 8.1/10 respectively:
Configure WAN Access (i.e. Remote Access)
Most users want to access their network cameras outside their LAN (e.g. home network). They may access via a cellular connection, a Wi-Fi hotspot, workplace network, etc. We have received far more questions about this topic than any others.
The following are the quick steps to set up WAN access:
If you happen to use one of our apps, you can click button WAN Access after the video test on the setup screen is finished successfully as following figures show for Onvier for Android, and IP CENTCOM for Windows and Windows Phone respectively:
You will get specific step-by-step instructions for the configured network camera as following:
We hope you will read the following to gain fundamental understanding of WAN access configuration regardless of whether you use our apps. It may look daunting to configure the WAN access, but it actually takes only a few minutes to do it once you know how. This section may be a bit long because we try to help you understand the principles behind the process. The specific steps highly depend on your camera and router.
Please note that most instructions here regarding configuring WAN access are NOT specific to our apps. They are applicable no matter which app (including browsers) you use to access your device remotely unless you use technologies such as P2P that maintain a constant connection between your camera and a server of a company that is usually unknown to users.
Let us have some basic understanding of how network cameras are accessed first. Every network camera has an IP address (e.g. 192.168.0.100) on a LAN. Non-technical users can treat this IP address as a street address, and their LAN (e.g. home network) as a city. Every computing device on your LAN can find the network camera by its IP address, just like everyone in your city can locate a home by its street address.
A network camera may use more than one port (the default port is HTTP default port 80). Each port offers a unique service. For example, one port for web UI, one port for RTSP. Non-technical people can treat ports as doors of a home. You get different services by entering different doors.
The IP address of a network camera is a private IP. The most common range is 192.168.0.0 - 192.168.255.255, followed by 10.0.0.0 - 10.255.255.255. They are least likely in the private IP range of 172.16.0.0 - 172.31.255.255. Private IPs are good for a LAN. It is like that a street address "101 5th Avenue" is good for locating a home in a city, but you cannot use it to locate a home in another city because every city may have "101 5th Avenue". Every LAN may have a device using a private IP address such as 192.168.0.101.
Now, we can talk about how to access a network camera outside its LAN, or access a home outside its city.
Each LAN is behind a router (or gateway), and the router has an IP address and that IP address is public IP address, not a private IP address like that of a network camera though the IP address's format is the same. Since it is a public IP, the router can be accessed on the Internet anywhere in the world. How do we tell a router that we want to communicate with a specific network camera on the LAN behind it? The trick is port forwarding.
The only way to access a computing device on a network is through its IP address and ports. If there is only one network camera on a LAN, we can ask the router to forward everything to the camera, and everything will be the same as accessing the camera on the LAN except using the public IP address of the router. This would not work for multiple network cameras.
To deal with multiple cameras, we need to allocate different ports for different cameras. In other words, you will access every network camera with exactly the same IP address - the public IP address of the router, but with different ports. Using the city analogy, you will send/request packages to different homes of a city by using its different doors. For example, doors 8080 and 5556 of the city to doors 80 and 556 of address 101 5th Ave, doors 8082 and 5558 of the city to doors 80 and 556 of 102 5th Ave, and so on.
Most cameras allow modifying its used ports. Port 80 is usually used for HTTP and ONVIF, and port 554 is used for RTSP. Though it is not necessary theoretically, it is the best to change a camera's ports to match their external forwarding ports. For example, if port 8080 is forwarded to a camera's HTTP port, it would be the best to change the camera's HTTP port to 8080; if port 5554 is forwarded to a camera's RTSP port, it would be the best to change the camera's RTSP port to 5554. The following two figures show how to configure port forwarding for multiple cameras after modifying their ports to match the external ports.
Some cameras do not allow the modification of their ports, in this case you can forward different external ports to the fixed ports of cameras, but it is critical to tell apps to overwrite the RTSP ports informed by the cameras with their corresponding external RTSP forwarding ports (e.g. 5554, 5556…) in apps. This is because the cameras are not aware of port forwarding, so they always tell apps to use their ports. All of our apps support RTSP port overwriting. The following figure shows the port forwarding configuration of this scenario.
Each router has its own port forwarding UI. All of them have the same pattern - each port forwarding entry allows forwarding one port or a range of ports from the router (called external or public) to one port or a range of ports of a device.
The following is the port forwarding page of Netgear N300 Wireless Gigabit Router WNR3500Lv2, a popular low cost router. It represents the simplest port forwarding UI
The following represents a more complex port forwarding UI from Quantum Gateway (Fios-G1100). It shows that port 60163 is forwarded to port 80 of an Axis camera following the WAN access instructions of our app. Other ports can be forwarded in exactly the same way.
Enter router web UI > Firewall > PortForwarding > Select the Axis camera 192.168.1.163 > Custom Ports > Advanced
Protocol: Both > Source Ports: Any (i.e. you do not care which port the connection is from) > Destination Ports: Specify 60163 (i.e. the port reached by a remote connection) > Forward to Port: Specify 80 > Schedule: Always > Add+
A port forwarding entry for this Axis camera is added to the list:
All network cameras of major brands use one port for everything - Web UI, ONVIF services, RTSP and snapshot because they use only one transport protocol - HTTP. They support RTSP over HTTP. Some cameras, especially many made in Shenzhen, China require up to three ports - one port for web UI and maybe snapshot, one port ONVIF services, and one port for RTSP.
Finding the required ports sometimes is a bit tricky. Fortunately, all of our apps list the required ports as shown by the following screenshots:
Now you can use your router's public IP address to access your network camera. If you do not know your router's public IP, there are a few ways to find it:
- Use a browser to visit any one of these websites:
- Visit the Internet configuration tab of your router's configuration page.
- Use command "nslookup myip.opendns.com resolver1.opendns.com" in Windows Command Prompt. The address for "myip.opendns.com" is your public IP.
Suppose your router's public IP is 22.214.171.124 and you have forwarded external port 8080 to the camera's ONVIF port 80, you can set up your camera with address 126.96.36.199:8080, and access it anywhere in the world.
The above method of WAN access assumes the public IP address of the router is static (i.e. does not change). This is not the case for most consumer homes. Public IP addresses are dynamically assigned to home routers except for those who obtain static public IP addresses by paying fees to their ISPs.
Fortunately, there is a way to deal with this. It is Dynamic DNS (DDNS). The details of DDNS are beyond the scope of this article. For the purpose of network camera WAN access, users only need to know that DDNS offers a static host name (e.g. mycamera.myddns.com) to replace a router's public IP address, so the address to a network camera remains constant.
When a DDNS host name is used, it is resolved to the dynamically assigned IP address of a router. It essentially tracks the change of the router's IP address. Many network camera manufacturers offer free DDNS service. One can also subscribe to paid or free DDNS service such as dyndns.org, freedns.afraid.org, dynu.com
There are three common ways for DDNS services to track routers' IP address changes:
- DDNS support of a router. Here is how to Setup a NETGEAR Dynamic DNS account.
DDNS support of network camera.
The following is the Axis camera's DDNS configuration UI:
The following is the generic camera's DDNS configuration UI:
- Running a small client app on a computer on the LAN gated by the router.
All of them use the same mechanism - sending the router's dynamic IP address to a DDNS server upon its change or periodically. Each DDNS or service or router usually has detailed setup instructions. Some network camera manufacturers also provide detailed instructions for DDNS. Please see the last section "The Axis Internet Dynamic DNS service" of this Axis document for an example.
Once the WAN configuration is successfully created, we suggest using it under all circumstances including being on the same LAN as the camera. This is because most routers nowadays support hairpinning that routes WAN configuration’s traffic within the LAN (i.e. not going out) if the router detects the camera is on the same LAN. This is why we do not combine WAN configuration and LAN configuration in our apps. Automatic detecting whether the WAN or the LAN configuration should be used for streaming may take a few seconds under certain circumstances though it is instant in most cases.