You are here

Raspberry Pi for remote access to mesh - routing issue?

5 posts / 0 new
Last post
KJ6WEG
KJ6WEG's picture
Raspberry Pi for remote access to mesh - routing issue?

Hi, I'm trying to set up a Raspberry Pi for remote access to my mesh nodes. I think I have it most of the way there, but am stuck trying to get the Pi to route internet traffic through its WiFi interface, and mesh traffic through its Ethernet interface. Would love help with that, or advice on better ways to do all this.  

My current mesh setup is two NanoStations M5 and M2 on the roof, connected directly to eachother, with one PoE cable coming down into the house. There, it goes through the PoE injector with the Lan port continuing on to a Mikrotik hAP routerboard.  At home, I can access the mesh by connecting directly to the hAP's wifi hotspot, or by plugging directly into one of the hAP's LAN ports.

I also have a Raspberry Pi 4 that's connected to my home internet using WiFi, and connected to the hAP using the Ethernet port.  The Pi is set up for remote access using VNC, which works great, and allows me to connect to it from work or from my phone using VNC's cloud service.  In order for it to work right (and maintain the cloud connection), I had to set the WiFi interface (wlan0) as the primary interface instead of defaulting to the Ethernet interface (eth0) as primary.  I did this by adding the following two lines to /etc/dhcpcd.conf: 

  interface wlan0
  metric 200


But... now what happens is that when I open the browser on the Pi, I can get to the hAP by entering the IP address (10.x.x.x).  But I cannot access it via localnode:8080, nor localnode.local.mesh:8080.  And even when I'm connected to the hAP, I can't follow any of the links to other nodes at xxxxx.local.mesh.  :8080

So my question is... is there a way to set up my Raspberry Pi to route any requests for xxxxx.local.mesh to the Ehternet (eth0) interface, and all other requests to the primary WiFi (wlan0) interface?  I've tried to read about routing tables and such, but haven't found anything that looks promising for routing the whole .local.mesh domain. 

Or... if someone has other ideas for how I can easily access my mesh nodes remotely using my Raspberry Pi and its VNC connections (or other options), I would love to hear about those too.  

Thanks! -Chris KJ6WEG

EA2EKH
EA2EKH's picture
Routing tables don't deal
Routing tables don't deal with names, but with IP addresses. 

On the wireless interface you must use IP addresses in a range not used by AREDN. As both 192.168.0.0/16 and 10.0.0.0/8 are used, you still have an available private address range: 172.16.0.0/12.

So, for example, if you set up the wireless interface using 172.16.0.0/24 (say, 172.16.0.1 for the Raspberry) it will work. 

Of course you need to deal with a default route in case you want access to the Internet. And you must choose which will be the interface used. But that's a diferent issue.
 
KJ6WEG
KJ6WEG's picture
Thanks for the reply, EA2EKH!
Thanks for the reply, EA2EKH!  
Ok, I'm learning.  Got it that routing tables are for IP addresses only.  I was hoping there might be something similar to control routing by domain but I'm not finding anything... at least nothing simple.  Unfortunately I can't change the IP range on my home network right now, but will keep that in mind for future setups.  

That said, I think I have achieved my goal another way.  I got brave and finally connected my hAP to the internet (Ethernet from home network into Port 1)... and I think I have it set up right to prevent connecting the mesh to the internet.  Then, I wired the Pi directly to one of the LAN ports on the hAP (and turned off the Pi's WiFi)...  and now it gets both its internet as well as its mesh connections through that port. So the Pi is "online" and can access the mesh, which is what I wanted.  After some fiddling, I can again access the Pi remotely with VNC, so I can use it to access the mesh from anywhere.  

Thanks again! -Chris KJ6WEG
WA4OPQ
WA4OPQ's picture
Thanks!

Normally I wouldn't jump into a forum when I've been in the group less than a week, but your post really helped me and I was able to use it to solve one of my frustrations.
I have a Raspberry Pi sitting here that is used for an APRS node so I put it to work, It's WiFi is on my home network and the ethnernet goes to port 2 of my hAP.  So I can set in my recliner and use VNC on my laptop to connect to the RasPi and from there bring up hAP on the mesh. 

Had I not seen your post I would be struggling with routing tables with no luck. This works so well, thanks for posting.

AE6XE
AE6XE's picture
Chris,  the problem to solve
Chris,  the problem to solve is how the Pi resolves a hostname to an IP address.  This the "DNS" settings.    With the PI-wifi connected to your home router as the primary, it will go though this path by default to resolve a hostname to find its IP address.  Since the mesh network is not in this path, the mesh IP  addresses can't be found by using hostnames.

Probably a couple of options:

A) If the nanostations are connected via a switch to your home router, then setting the DNS path to make primary Pi-eth0 -> nanostation -> home router should work.  DNS on each device of this path knows about the mesh, hosts on your home router,  and internet.   

B) figure out how to configure DNS on the Pi so that hostname.local.mesh  or all hosts in the local.mesh domain will be forwarded and resolved on the IP address of your nanostation.   You'd have to always use the Fully Qualified Domain Name (FQDM) or always use local.mesh in a hostname "hostname.local.mesh" when accessing the host on the AREDN mesh.  This way, on the Pi, the Nanostation is consulted for mesh IP addresses and your home router is consulted for everything else.
 
Joe AE6XE

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer