So you want to integrate a video stream from an IP camera to your code – but if you have never done it before, what should you expect from it?
Setting up IP addresses might sound daunting, but fear not. Here is a guide that will take you through the process, step by step, with a focus on understanding your Ethernet interface, link-local, DHCP, and IP addresses for both your camera and your laptop. For reference sake, this tutorial is made with Ubuntu 20.04 in mind.
What do you need?
- You camera and its ethernet connection cable
- PoE switch plugged to the wall
- A Ethernet cable for your computer
1. Connect Your PoE Network Switch
First things first, let’s get that PoE network switch connected. Plug it into the Ethernet port on your wall to get it hooked up to the network.
2. Connect Your Camera and PC to the Switch
Next, connect your IP camera to the switch using an Ethernet cable. Then, hook up your PC to the switch using another Ethernet cable.
3. Configuring Your PC’s Ethernet Interface
Now, let’s dive into configuring your PC’s Ethernet interface settings, such that you camera and PC and communicate – this can be done through you. To make them communicate both devices must be on the same subnet, i.e. the first part of their IP addresses, the network address, should be the same. If you want to learn more about basic networking, I highly recommend the free Cisco Packet Tracer course. Here are some common camera configurations and how to set up your PC to connect:
Cameras with static IPs: This is when the camera provider configure their camera to a static IP (i.e. XXX.XXX.XXX.22), written in the manual. In this case you would want to set the IP address on you ethernet interface to an address that starts with the same network address, but with a different ending host address (i.e. XXX.XXX.XXX.24)
Consult the camera’s manual or online resources to find the default IP address of the camera model if available. A common default address for cameras is 192.168.1.108, so try setting your interface address to something on 192.168.XXX.XX.
Cameras with link-local IPs: Other times, the camera provider have configured the camera to set up a link-local address, which starts with 169.254.XXX.X. In this case you can set your ethernet interface to link-local only under the IPv4 tab and it will assign the IP address to follow suit.
Camera with DHCP server: Some camera vendors have DHCP servers that assign connected PCs IP addresses. In this case, all you have to do is set your our ethernet interface to Automatic (DHCP Server).
Camera without configured address: Finally, some times the camera’s themselves must be assigned and IP address from a DHCP server. In this case, set your our ethernet interface to Automatic (DHCP Server). Then find an extra Ethernet Cable and connect the PoE switch to your LAN network. This will assign both your PC and the camera an IP-address on the same network!
Use ifconfig
to check out the status of the ethernet interface’s IP address!
5. Scanning for Devices and their IP addresses
With your Ethernet interface up and running, you can now scan for other devices connected to the switch to find your camera. Use a tool like arp-scan -l
to scan for devices on your network. Look for the MAC address or vendor information that matches your camera and the device IP address.
Tip 1 : Disconnect your WiFi & LAN connection to only scan for devices on the PoE Switch.
Tip 2: If you don’t find the Camera Vendors name, test another setup from step 4.
6. Accessing Your Camera’s web interface
Once you’ve identified your camera’s IP address using arp-scan
, open your web browser and enter the IP address. If you don’t get a response, double-check your arp-scan results and cable connections to see the camera is still accessible for the PC.
You should now see a login page. Use the credentials provided by your camera manufacturer or from the user manual.
7. Enjoy Your Camera
Congratulations! You now have access to software that displays your camera feed and allows for easy configuration. From the web browser interface you can configure settings for the cameras, including configuring the camera’s IP address to you liking. Curious to learn more about how to access the camera stream programmatically? Check out the next blog post to learn more
Best of luck!
Laksiya