How to Set up a Router to Have Video Surveillance That Works Flawlessly
One of the advantages of IP (Internet Protocol) cameras compared to classic analog video surveillance is the possibility of independent operation by directly connecting the camera to the router.
Although just connecting the camera is very simple, to access the camera from a remote location you need to set up a couple of options on your router, and we’ll try to explain the whole procedure in this article.
Advantages of IP Cameras
First of all, let’s say a few words about IP cameras. Unlike classic analog cameras, whose operation depends directly on the DVR recorder, IP cameras can operate independently of the recorder or computer. Thanks to this, you can connect these cameras directly to your router and access them via the Internet from any location, which makes them suitable not only for providing space when no one’s at home but also for monitoring the elderly, children or pets when you’re at work or on a trip.
Just connecting the camera to your router is very easy and can be wired, i.e. via a standard network cable, or wirelessly if the camera also has a built-in Wi-Fi connection. The problem most users encounter is blocked access to the camera from a remote location due to Firewall protection in the router.
By default, the router will automatically block access if you try to access your router from another location via the Internet. This mode is great for the day-to-day security of your home network but it also prevents access to network cameras. The solution to this problem is a special function in your router called Port-Forwarding and in the continuation of the article, we’ll explain how to set it up.
Things to Keep in Mind When Setting up Remote Access to the Camera
There are 3 main things to keep in mind when setting up remote access to your camera:
- Local area network (LAN)
- Firewall protection (within the router)
- Global Network (WAN)
Below we’ll explain each of these units and the settings related to them but before we start with that, let’s first look at the access to the router itself.
To access the control panel of your router, you need to open any Internet browser and enter the IP address of the router in the address field, which is usually 192.168.1.1 or 192.168.0.1. If you’ve entered the correct address, a small window will appear asking for a username and password to access the control panel.
The factory default username is usually admin and the password can also be admin, password, or not required (leave the field blank). Some router manufacturers have this information printed on a sticker located on the bottom of the router itself.
How to Store Images and Videos
Images and videos captured by your IP camera can be stored in various ways. For example, images and videos that emerge from an IP camera streaming can be stored in a database. MySQL database and PHP scripting language are used a lot for this purpose. There are many advantages to storing data that MySQL offers, especially when collections include more than 100,000 items.
Hosting plans based on MySQL will keep these collections secure. However, when you decide it’s time to choose one, storage and performance are the two most important factors to consider. Uploading images to the server using MySQL and PHP is usually done through the admin section of the hosting account you purchased. The same process is necessary for uploading videos.
Local Area Network (LAN)
A local area network is basically a set of interconnected devices that you have at home. It usually consists of one or more desktop/laptop computers, a router connected to the Internet, and of course your IP camera.
As far as the local network is concerned, it’s necessary to set up the camera for external access, and here we distinguish the following steps:
- Assigning a local static IP address to the camera
- Entering the correct Subnet Mask and Default Gateway addresses
- Setting the DNS server address
- Configuring port
1. Static IP Address
If your network is set to automatically assign IP addresses, there’s a chance that the network will assign a different IP address to the camera each time you turn it off. This isn’t good for Port-Forwarding and it’s necessary to set a static IP address of the camera so that you can later route the router to that address to access the camera.
The static address has to be set in the camera itself and the name of the function is usually “static” or “use this address”, but it can also vary depending on the model of your IP camera, so it’s best to look at the accompanying user manual for the camera.
2. Subnet Mask/Default Gateway
The Subnet Mask is almost always 255.255.255.0 (also known as class C). This allows the user 254 usable addresses that can be assigned to networked devices, which is more than enough for the average home application.
The Default Gateway (also called the Default Router) is the IP address of your router.
Be sure to enter both values in your IP camera when setting a static IP address.
3. DNS Server Addresses
There are typically two such addresses in the camera, although this isn’t always the case. DNS servers take the names we give to websites and turn them into their original IP addresses. This means that we don’t have to remember a bunch of complicated numbers and that we can simply visit websites and networks by name instead of by number.
DNS server addresses come from your Internet service provider (ISP). If you aren’t sure what your DNS addresses are, it’s best to enter the local IP address of your router in DNS server 1 (or primary DNS server) and the router will set them up automatically.
4. Port Configuration
Typically, when one computer communicates with another over a network, information is transmitted through a specific port. Many ports have specific purposes, such as email or FTP services. Most network devices accessed through an Internet browser are mostly set up on port 80, including IP cameras, routers, etc. This is because it’s a standard port for HTTP, i.e. information displayed through an Internet browser.
It’s good practice to change the standard camera port to another less used port. Changing the port has several advantages. For example, 1) Ports and IP addresses must be unique, so if both the IP camera and the router remain on the same port, you can only access one device at a time; 2) Better security because if someone tries to access your router, the camera will be on another port. Even if they somehow reach the port where the camera is, they won’t be able to access the camera without an adequate password.
It’s also important to note that when you change the port on the camera, the URL to access the camera will also change both internally and externally. For example, after changing the port from 80 to 4040, to access the camera it’s necessary to specify the port number at the end of the address - in this case, 4040. This also applies to access the camera from a remote location.
Firewall
The firewall in your router perfectly blocks unwanted access to your network. A good comparison would be to look at the Firewall as a hotel reception. To enter your room you must first talk to the receptionist who’ll check your details and then give you the key to the room. If you try to enter without authorization, you’ll be stopped and kicked out of the building.
Given that it isn’t safe to completely turn off the Firewall, what you want to do is provide access to the camera but still keep filtering the rest of the incoming Internet traffic. This is achieved by adding a special rule in the Firewall.
Since the appearance of the user interface differs depending on the router model, it’s not possible to make a detailed universal procedure, but the principle of operation is the same for all routers - for each WAN user accessing the IP camera port, access should be allowed and redirected to the local IP address.
Global Network (WAN)
Global Network (WAN) is essentially the Internet and all you need to access your IP camera through it is to know what your external IP address is. This is a unique IP address for your network and you can use it anywhere on the Internet. It’s also often called a public IP address.
Your IP address depends on your ISP and/or is assigned to you when you sign the contract (static), and/or is automatically assigned to you each time you connect to the Internet (dynamic). There are several ways to find out what your current address is.
Dynamic and Static IP Address
Most current ISPs assign dynamic IP addresses to users. This means that your public IP address will change from time to time, which is problematic for accessing your network and camera via the Internet. There are two ways to solve this problem - a static IP address or dynamic DNS.
Static IP address: The best solution is to change your IP address to a static one by an ISP. Most providers offer this service, but they also charge extra in addition to the standard subscription. A static IP address means that your external IP address won’t change, so you won’t have problems accessing your network and camera from a remote location.
Dynamic DNS (DDNS): This feature gives your IP address a specific name while automatically tracking any IP address changes in the background. Most routers support the DDNS function and offer links to well-known DNS services whose basic free account is sufficient for home users.
Alternatively, some well-known IP camera manufacturers also offer their DDNS services for free, so you can also check if your camera supports them.
Camera Access
When you finally get to your public IP address, accessing the camera is very easy. Just type that address or DDNS address anywhere on the Internet, along with the port number if it differs from 80, and you should get access to your camera.
NAT Loopback
Another important thing to note is that when you access your camera via a public IP address, you may encounter a small problem called NAT Loopback. This means that, when you use a public IP address to access a camera that’s connected to the same local network you’re accessing, you may not be able to connect. It’s normal because the router automatically blocks this type of traffic.
The solution to such an issue is a router that supports the NAT Loopback function. If your router doesn’t support this feature, you access the camera via the camera’s local IP address when you’re on the same network, or via a public IP address when accessing from a remote location on the Internet.