Quantcast
Viewing all articles
Browse latest Browse all 5103

Networking and servers • Using a Pi to act as bridge between 2 separate networks

Need some help regarding networking using a Pi. I got two group of computers.
  1. Primary group are computers connected via a wifi router and able to access internet.
  2. Secondary group are old computers only able to connected via LAN switch, no internet.
  3. They are physically separate from each other, and the wifi signal from primary group are too weak to reach secondary group of computers.
My band aid idea is to connect a Pi in between two groups of computer where the Pi wifi interface is connected to the wifi router of primary group of computer, and the Pi ethernet is connected to the LAN switch of secondary group of computers using a long LAN cable.

After some digging on the internet, I managed to get the secondary group of computer to access the internet via the Pi using dnsmasq and iptables. However, there is one small problem. I usually need to use remote desktop or ssh within these two group of computers and current setup does not allow that because they are using two different subnet and cannot reach each other. I had to ssh into the Pi first before I can reach the computer of either side.

Here is some details for both network.
  1. Primary group network subnet 10.128.9.0/24. I have no admin access to this network so I can't change anything on the wifi router.
  2. Secondary group network subnet 192.168.25.0/24.
    • The Pi in between is installed with dnsmasq and provide IP address to the computers connected to the LAN switch.
    • I run the iptables command below on the Pi to allow computers connected to secondary computer to access the internet.

      Code:

      iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADEiptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPTiptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT
What can I do to configure the Pi to allow each group of computers to talk to each other without the need to ssh into the Pi? I've google for quite a while now and can't find the solution for this particular use case.

Statistics: Posted by rasp14 — Thu May 09, 2024 2:44 am



Viewing all articles
Browse latest Browse all 5103

Trending Articles