I have an RTSP camera connected through ethernet to a computer. This computer is set up to allow connections over WiFi. What I want is to be able to reach the camera from a laptop that is connected over WiFi.
HostAPd is used to provide an access point over WiFi. DNSmasq is used to give IP's as DHCP server. Cloudconfig is disabled network and systemd-resolved is disabled.
/etc/sysctl.conf has the line "net.ipv4.ip_forward=1".
iptables is set to allow all incoming and outgoing. (iptables -F, iptables -X).
I tried to create a bridge like this, but it doesn't allow me to reach the camera:
sudo nano /etc/netplan/00-installer-config-wifi.yaml
network:
ethernets:
eno2:
dhcp4: false
optional: true
addresses:
- 10.5.193.1/24
version: 2
wifis:
wlo1:
dhcp4: true
optional: true
access-points:
"fishcounterwifi":
password: "xxx"
addresses:
- 10.5.193.2/24
bridges:
br0:
interfaces: [eno2, wlo1]
addresses: [10.5.193.1/24]
routes:
- to: default
via: 10.5.193.2/24
mtu: 1500
nameservers:
search: [10.5.193.1]
addresses: [8.8.8.8]
dhcp4: no
dhcp6: no
Perhaps something is wrong there... It does allow me to connect to the computer, and using SSH on the computer I can use the camera, however I am not able to reach the camera directly from the laptop. But when I read the documentation about netplan I see that there is a possibility to add routing. The only thing I need is to forward traffic from the camera with fixed IP 10.5.193.39 to the WiFi (which is always giving IP 10.5.193.200 to the laptop).
What are the situations where I should use routing, or bridges, with netplan? Which of these alternatives would be best for my current case?
This other question seems to suggest using routing, but no explanation of why it would be better than a bridge and the link to netplan.io gives med 404 not found.
Since I am using the same IP-range, it seems to me like a bridge should be the way to go, because I supposed it would be easiest to make the whole setup appear like one single network, but since it doesn't work I am wondering if I should have looked at routing first, and then I don't understand why routing would be a better choice, which is why I am asking.
Disclaimer: I am a biologist trying to set up a fish counter, I don't really know anything about networking just trying to understand.
EDIT: I have changed the netplan configuration to use routing and that option works, where the bridge didn't. Part of making it work was to change the IP range of the WiFi to 10.5.1.0/24. I still don't understand what the preferable option would be.