×

INDI Library v1.9.2 Released (14 Sep 2021)

Bimonthly Stable INDI Library release introduces new drivers and fixes for existing ones.

Linking two R-Pis with an ethernet cable

  • Posts: 507
  • Thank you received: 55
Hi all!

I'm currently using 2 R-Pis at my telescope, both connected to my LAN via wifi. For various reasons, I'd like to connect them to each other with an ethernet cable. I find ways to do that when searching the internet, but only by creating a separate subnet. What I would want is for both of them to be on my LAN. So I'd like to access the second, from my laptop on the LAN, via wifi to the first and then through the ethernet cable to the second.

In essence, I am using one as a wifi access point to which the second is connected with a cable...

Any ideas on how this could be implemented?

Magnus

Celestron C11, Skywatcher 100 ED Pro
Losmandy G11
Atik 383L+, ASI294
7 months 2 weeks ago #66855

Please Log in or Create an account to join the conversation.

  • Posts: 1941
  • Thank you received: 416
Magnus,

Two distinct network interfaces (for instance eth0 for the fixed network and wlan0 for WIFI) can have IP addresses in the same subnet but the problem is that there can be only one route for that subnet. In general that route is via eth0 when both eth0 and wlan0 are connected. The reason is that the TCP/IP stack in the kernel needs to know how to reach other devices in the same subnet so if both network interfaces are in the same subnet then the network traffic should only be routed via one of the interfaces. This means that if a certain device can only be reached via one interface but the default route goes via the other, that certain device becomes unreachable.

I suppose you could set up a fixed ip address on eth0, delete the default route via eth0 and set it up to go vian wlan0 and then add a route via eth0 to our other rpi. That afaik would all have to be done manually though, or it would require quite a bit of scripting to make it possible. This is why a different subnet is suggested because that is much easier to set up.

I suppose you'd prefer not to use a different subnet so the second rpi can be connected to your home network as well if necessary?


Wouter
Wouter van Reeven

ASI6200MM and 7 slot 2" filter wheel with a SkyWatcher Esprit 80 ED on a SkyWatcher HEQ5-Pro
ASI1600MM-Pro Cooled and 5 slot 1.25" filter wheel with an 8" TS Ritchey-Chrétien on a SkyWatcher EQ6-R
7 months 2 weeks ago #66856

Please Log in or Create an account to join the conversation.

  • Posts: 197
  • Thank you received: 96
If you want full connectivity on the second Rpi you need to run the routed service in the RPi with both connection to transform it in router. Then every computer in the network need to know the route to go to the other subnet.
There is other possibility if you not need full connectivity, for example using ssh tunnel to the first Rpi that end to the second. Or for http run a proxy on the Rpi with both connection.

This is not exactly your configuration but this can help to understand the router concept:
www.raspberrypi.org/documentation/config...cess-point-routed.md

Patrick
7 months 2 weeks ago #66857

Please Log in or Create an account to join the conversation.

  • Posts: 507
  • Thank you received: 55
Thanks!

Not trivial, that is one thing I realize.

Another option would perhaps be to have a wifi extender/access point at the telescope, to which the two Raspberrys could be connected with ethernet cables. If such a device exists that can run on 12 V.... ?

Main point here is that I want wifi from the house to the telescope, but high speed between the Raspeberries while also being able to control both via VNC from indoors.

Magnus

Celestron C11, Skywatcher 100 ED Pro
Losmandy G11
Atik 383L+, ASI294
7 months 2 weeks ago #66859

Please Log in or Create an account to join the conversation.

  • Posts: 1941
  • Thank you received: 416
You could install WIFI mesh devices. Those are access point-like devices that replicate the WIFI network wherever you install them. I use them as well and have my Raspberry Pis at the telescopes connected to them via ethernet cables.
Wouter van Reeven

ASI6200MM and 7 slot 2" filter wheel with a SkyWatcher Esprit 80 ED on a SkyWatcher HEQ5-Pro
ASI1600MM-Pro Cooled and 5 slot 1.25" filter wheel with an 8" TS Ritchey-Chrétien on a SkyWatcher EQ6-R
Last edit: 7 months 2 weeks ago by Wouter van Reeven.
7 months 2 weeks ago #66866

Please Log in or Create an account to join the conversation.

  • Posts: 230
  • Thank you received: 31
I think what you want to do here is create a layer-2 bridge between wlan0 and eth0 on the Pi that connects to your Wifi.

Then you can run a Ethernet cable between the two Pis and they should all appear to be on the same subnet.

The Pi wifi chipset has limitations on this, but there are some workarounds / hacks that you can search for:

raspberrypi.stackexchange.com/questions/...roxy-arp/88955#88955

raspberrypi.stackexchange.com/questions/...a-server/81518#81518
__
I blog my progress: www.coochey.net
7 months 2 weeks ago #66876

Please Log in or Create an account to join the conversation.

  • Posts: 507
  • Thank you received: 55
OK, so what kind of mesh-device do you use? Preferably it should be one that could run on 12 V....

Magnus

Celestron C11, Skywatcher 100 ED Pro
Losmandy G11
Atik 383L+, ASI294
7 months 2 weeks ago #66877

Please Log in or Create an account to join the conversation.

  • Posts: 1941
  • Thank you received: 416
I use TP-Link Deco M5 devices but I am pretty sure that any other will work fine as well.
Wouter van Reeven

ASI6200MM and 7 slot 2" filter wheel with a SkyWatcher Esprit 80 ED on a SkyWatcher HEQ5-Pro
ASI1600MM-Pro Cooled and 5 slot 1.25" filter wheel with an 8" TS Ritchey-Chrétien on a SkyWatcher EQ6-R
Last edit: 7 months 2 weeks ago by Wouter van Reeven.
7 months 2 weeks ago #66881

Please Log in or Create an account to join the conversation.

  • Posts: 507
  • Thank you received: 55
Hi!

Thanks. I'll have a look at the briding-solution as well!

As for mesh-devices: I'm thinking that since I don't have a full observatory but take all electronics inside when not observing, it needs to be some device that I can easily disconnect and re-connect, and that works with my Ubiquity-network. This is not the kind of use mesh devices are designed for, really... so I'm curious about how well that would work. Do you leave your in place, or do as I do?

Magnus

Celestron C11, Skywatcher 100 ED Pro
Losmandy G11
Atik 383L+, ASI294
7 months 2 weeks ago #66883

Please Log in or Create an account to join the conversation.

  • Posts: 1941
  • Thank you received: 416
I leave mine in place. Fortunately my backyard is not very big so I can connect my RPis to the mesh device inside my living room with a 10 meter ethernet cable.
Wouter van Reeven

ASI6200MM and 7 slot 2" filter wheel with a SkyWatcher Esprit 80 ED on a SkyWatcher HEQ5-Pro
ASI1600MM-Pro Cooled and 5 slot 1.25" filter wheel with an 8" TS Ritchey-Chrétien on a SkyWatcher EQ6-R
7 months 2 weeks ago #66886

Please Log in or Create an account to join the conversation.

  • Posts: 54
  • Thank you received: 4
Check here for dual homing a PI
PI routing

I set up a PI ZeroW with its internal wifi and a dongle wifi
In your case it would be the eth0 interface

A very cryptic snippet of the commands I used

sudo apt-get install hostapd dnsmasq -y

My secondary network force set IP, secondary network serves DHCP to connected clients
sudo vi /etc/dhcpcd.conf
#interface wlan1
static ip_address=192.168.100.1/24
nohook wpa_supplicant # don't call the wpa_supplicant hook

cd /etc/
mv dnsmasq.conf dnsmasq.conf.orig
vi dnsmasq.conf
interface=wlan1
dhcp-range=192.168.100.2,192.168.100.20,255.255.255.0,24h



vi /etc/hostapd/hostapd.conf
vi /etc/default/hostapd
DAEMON_CONF="/etc/hostapd/hostapd.conf"

sudo systemctl unmask hostapd.service
sudo enable unmask hostapd.service
sudo systemctl enable hostapd.service
vi /etc/sysctl.conf
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1

sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan1 -o wlan0 -j ACCEPT
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
vi /etc/rc.local
iptables-restore < /etc/iptables.ipv4.nat
7 months 2 weeks ago #66889

Please Log in or Create an account to join the conversation.

Time to create page: 0.304 seconds