1
votes

I need to put the rPi into a bridge mode, so it can be accessible in a home LAN via its wifi interface while being physically connected to another computer (the target system) via its ethernet interface. The goal is to be able to send commands to the target system from mobile devices that are on the LAN.

  • Both the wifi and eth0 interfaces need to have static IPs, and in the case of the ethernet, the IP is in a completely different address range: the home network is all in the 192.168.* range, while the rPi's ethernet needs to be in a range that starts with 172...

  • The Pi is running an up-to-date version of Raspbian (it's been recently 'sudo apt-get-updated.'

I've been looking at documentation on routing, resetting IP tables, the network interface file, but I haven't been able to get both interfaces at the same time. I was also having trouble getting the ethernet interface to work with a static IP in the 172.* range.

I've read a fair amount about using the Pi's ethernet and wifi interfaces at the same time, but none of the documentation I've seen so far covers the exact setup we need here. Any thoughts or pointers would be appreciated.

1
Q: Is your "target system" a PC with two NICs (one NIC on 192.168.*, the other 172.*)? - paulsm4

1 Answers

2
votes

You don't "need to put the rPi into a bridge mode" to make a Pi accessible on both interfaces and route packets between networks. Bridging is something different. You could use bridging, but then you should use the same network address range which, apparently, is not what your plan to do.

I understand your problem like this :

  [   "Target system"     ]
  [ eth0 (192.168.a.b/16) ]
   |
   |
WiredNetwork
192.168.0.0/16
   |
   |
 [ eth0 (192.168.c.d/16) ]
 [     Raspberry PI      ]
 [ wlan0 (172.e.f.g/12)  ]
   |
   |
172.0.0.0/12
Wifi network 
   |
   |
 [ Mobile devices ]
 [  172.h.i.j/12  ]

Then you want routing : routing packets from 192.168.0.0/16 to 172.0.0.0/12 network (and back...).

Assuming, you don't have (and don't need IP filtering), here are the steps to check in order :

  1. ensure you can ping both networks from your Raspberry Pi
  2. ensure you have ip forwarding activated on the Pi (cat /proc/sys/net/ipv4/ip_forward should return 1, issue echo 1 > /proc/sys/net/ipv4/ip_forward if not).
  3. ensure "mobile" devices have a route pointing to the 192.168.0.0/16 network using your Raspberry Pi as a gateway (YMMV on how to do this, depending on OS)
  4. ensure "target system" has a route to send packats back to the 172.0.0.0/12 network.

Cheers