Sendreth
Posts: 6
Joined: Tue Feb 07, 2023 1:21 pm

Eth0 camera rpi static ip

Tue Feb 07, 2023 1:31 pm

Hi,
I have a problem connecting IP camera through eth0 port while simultaneously using VNC Viewer.

I tried to assign a static ip to eth0 port in dhcpcd.conf file, but it seems that my rpi4 is overriding the manually assigned IP.

Is it possible to access camera through eth0 while using VNC (Camera, rpi4, computer using same router, having 192.168.100.X ip). Or shold the camera be on different network (wont be able to view it on computer and router). Then the eth0 would have different adress, and on wlan0.

Should the manually assigned ip adress to eth0 port match camera ip adress?

Thanks in advance for help

User avatar
B.Goode
Posts: 14738
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Eth0 camera rpi static ip

Tue Feb 07, 2023 3:02 pm

Sendreth wrote:
Tue Feb 07, 2023 1:31 pm

Should the manually assigned ip adress to eth0 port match camera ip adress?


No!

And attempting to do so may be causing the static address assignment to fail.

All devices in a LAN must have unique IP addresses.

User avatar
thagrol
Posts: 8890
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: Eth0 camera rpi static ip

Tue Feb 07, 2023 6:29 pm

Sendreth wrote:
Tue Feb 07, 2023 1:31 pm
Is it possible to access camera through eth0 while using VNC (Camera, rpi4, computer using same router, having 192.168.100.X ip). Or shold the camera be on different network (wont be able to view it on computer and router). Then the eth0 would have different adress, and on wlan0.
eth0 and wlan0 on the Pi should always have different IP addresses. Whether they need to be in the same subnet or not (192.168.100.x vs 192.168.1.x for example) depends on your network configuration.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

Sendreth
Posts: 6
Joined: Tue Feb 07, 2023 1:21 pm

Re: Eth0 camera rpi static ip

Wed Feb 08, 2023 12:08 pm

Ok, so i tried to give static ip adress in dhcpcd.conf file

interface eth0
static_ipadress = 192.168.100.X/24

different from IP camera connected to that port, but still when i run ifconfig command
the eth0 inet is 169.254.94.Y. I think there is just no way i can have both wlan0 ip on 192.168.100X and eth0 on 192.168.100.Y so i can "see" the IP camera through ethernet port

epoch1970
Posts: 8387
Joined: Thu May 05, 2016 9:33 am
Location: France

Re: Eth0 camera rpi static ip

Wed Feb 08, 2023 12:13 pm

Sendreth wrote:
Wed Feb 08, 2023 12:08 pm
I think there is just no way i can have both wlan0 ip on 192.168.100X and eth0 on 192.168.100.Y so i can "see" the IP camera through ethernet port
You’re in error, that’s perfectly feasible. It’s what happens out of the box, when both wireless and Ethernet are connected and configured via DHCP.

Check for typos in dhcpcd.conf.

Select X and Y such that they are outside the DHCP address pool and not in use anywhere in the network.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

drgeoff
Posts: 13477
Joined: Wed Jan 25, 2012 6:39 pm

Re: Eth0 camera rpi static ip

Wed Feb 08, 2023 12:22 pm

Sendreth wrote:
Wed Feb 08, 2023 12:08 pm
static_ipadress = 192.168.100.X/24
You have 3 errors in that line.
Quis custodiet ipsos custodes?

Sendreth
Posts: 6
Joined: Tue Feb 07, 2023 1:21 pm

Re: Eth0 camera rpi static ip

Wed Feb 08, 2023 2:05 pm

epoch1970 wrote:
Wed Feb 08, 2023 12:13 pm
Sendreth wrote:
Wed Feb 08, 2023 12:08 pm
I think there is just no way i can have both wlan0 ip on 192.168.100X and eth0 on 192.168.100.Y so i can "see" the IP camera through ethernet port
You’re in error, that’s perfectly feasible. It’s what happens out of the box, when both wireless and Ethernet are connected and configured via DHCP.

Check for typos in dhcpcd.conf.

Select X and Y such that they are outside the DHCP address pool and not in use anywhere in the network.
My dhcpcd.conf file looks like that:

interface wlan0
noipv6

interface eth0
static ip_address = 192.168.100.30/24


The rpi adress on wlan0 i didint set it was automatically set when i connected it to the router. I use it to access rpi by vnc viewer.

The ip_address that i set is not occupied by any other device, but still when i check ifconfig the eth0 address is 169.254....


What I want is to connect the IP camera directly to eth port. When i connected it to router i could access it by its IP, but I want to do it directly through ethernet.
Sorry for my incompetence I am just getting started with rpi
The schematics of the system looks like this:
Attachments
Diagram.jpg
Diagram.jpg (14.92 KiB) Viewed 268 times

User avatar
thagrol
Posts: 8890
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: Eth0 camera rpi static ip

Wed Feb 08, 2023 2:55 pm

How many network interfaces does the IP camera have?

Does your router also act as a WiFi access point?

Frankly, with all devices connected to the router, especially if using a wired connection, you'll get better performance using just the wired connection. Especially if one link is 1000Mbps ethernet and the other 150Mbps (or less) WiFi.

With Linux, if both eth0 and wlan0 (or any two interfaces for that matter) have IP addressses in the same subnet which yours appear to be only one will be used - usually the fastest one.

Why do you feel you want two links between Pi and IP camera?

A 169.254... address is in the self assigned link local subnet which, in this case, likely mean something is broken in you /etc/dhcpcd.conf
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

Sendreth
Posts: 6
Joined: Tue Feb 07, 2023 1:21 pm

Re: Eth0 camera rpi static ip

Thu Feb 09, 2023 7:57 am

thagrol wrote:
Wed Feb 08, 2023 2:55 pm
How many network interfaces does the IP camera have?

Does your router also act as a WiFi access point?

Frankly, with all devices connected to the router, especially if using a wired connection, you'll get better performance using just the wired connection. Especially if one link is 1000Mbps ethernet and the other 150Mbps (or less) WiFi.

With Linux, if both eth0 and wlan0 (or any two interfaces for that matter) have IP addressses in the same subnet which yours appear to be only one will be used - usually the fastest one.

Why do you feel you want two links between Pi and IP camera?

A 169.254... address is in the self assigned link local subnet which, in this case, likely mean something is broken in you /etc/dhcpcd.conf

I use wired connection between router and computer, and camera-router. Only rpi is connected with wlan0 to router. Now what i want is to instead of connecting IP camera by cable with router i want it to connect it to eth0 port while still connecting rpi to router so i can use VNC. And here is my question. Do i have to set IP cameras ip on different network, eth0 port on different network (then i wouldnt be able to connect it back to router and use it from there). Or is it possible to have 2 ip's one on wlan0(for vnc) and one on eth0 (to be able to access camera)?

Camera model is : dahua ipc hfw2231s
Router is only for lan connection, no internet.

drgeoff
Posts: 13477
Joined: Wed Jan 25, 2012 6:39 pm

Re: Eth0 camera rpi static ip

Thu Feb 09, 2023 8:42 am

Camera, RPi and computer should all be on the same subnet, eg 192.168.100.
Quis custodiet ipsos custodes?

Sendreth
Posts: 6
Joined: Tue Feb 07, 2023 1:21 pm

Re: Eth0 camera rpi static ip

Thu Feb 09, 2023 10:07 am

drgeoff wrote:
Thu Feb 09, 2023 8:42 am
Camera, RPi and computer should all be on the same subnet, eg 192.168.100.
Ok, but when i tried to configure the dhcpcd.conf file to this:

interface wlan0
noipv6

interface eth0
static ip_address = 192.168.100.30/24

I still get the 169.254... address which is self assigned local subnet, and not the one i want to set in dhcpcd.conf file. Any ideas why?

User avatar
B.Goode
Posts: 14738
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Eth0 camera rpi static ip

Thu Feb 09, 2023 11:34 am

Sendreth wrote:
Thu Feb 09, 2023 10:07 am


I still get the 169.254... address which is self assigned local subnet, and not the one i want to set in dhcpcd.conf file. Any ideas why?

Clear documentation from Raspberry Pi here -
https://www.raspberrypi.com/documentati ... -addresses


The syntax you have used in your modified snippet from /etc/dhcpcd.conf does not correspond with that documentation

User avatar
thagrol
Posts: 8890
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: Eth0 camera rpi static ip

Thu Feb 09, 2023 12:51 pm

Sendreth wrote:
Thu Feb 09, 2023 7:57 am
I use wired connection between router and computer, and camera-router. Only rpi is connected with wlan0 to router. Now what i want is to instead of connecting IP camera by cable with router i want it to connect it to eth0 port while still connecting rpi to router so i can use VNC. And here is my question. Do i have to set IP cameras ip on different network, eth0 port on different network (then i wouldnt be able to connect it back to router and use it from there). Or is it possible to have 2 ip's one on wlan0(for vnc) and one on eth0 (to be able to access camera)?

Camera model is : dahua ipc hfw2231s
Router is only for lan connection, no internet.
Maybe it's me but I'm still confused about what your network configuration is and what you want to achieve.

What I think you currently have is all three devices in the same subnet and connected to the same router. Though "camera-router" suggest there is another router is involved somewhere.

What I think you goal might be is to have VNC access to the Pi. That should work over the existing network connection - VNC does not require a dedicated link or interface.

Your secondary goal appears to be to move the camera connection from the router to the Pi. As a WiFi interface in client mode cannot be part of a network bridge that means the Pi's eth0 and and the camera must be in a different subnet to the rest of yout network and that if you want the camera to be accessable from the rest of your network you must set up the Pi to act as a router between the two subnets.

As for the link local address, check your syntax as has already been suggested more than once.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

knute
Posts: 861
Joined: Thu Oct 23, 2014 12:14 am
Location: Texas

Re: Eth0 camera rpi static ip

Sat Feb 11, 2023 11:59 pm

eth0 is connected to the camera. That isn't going to work. Just connect the camera, the Pi and whatever else to the router. Then all the addressing will be taken care of for you. You'll be able to VNC into the Pi and HTTP into the camera, it will all just work.

Sendreth
Posts: 6
Joined: Tue Feb 07, 2023 1:21 pm

Re: Eth0 camera rpi static ip

Fri Mar 17, 2023 8:39 am

Hi Guys

I found a solution to my problem. Probably I didin't explain exactly what i wanted achieve. Here is the solution:

My dhcpcd.conf file:

interface wlan0
noipv6

interface eth0
static ip_address = 192.168.100.X/24
static routers = "wlan0 adress of RPI4 within the same network"

Now i can both have the camera connected directly to eth0 or to the router. The camera,rpi4,computer all within the same network. I am sorry for any inconvenience, its my first steps into rpi4. I didint have any previous experience with networking.

Return to “Troubleshooting”