I have the following setup:
Device A (sensor, static ip=192.168.6.83)
| Enet connection
Device B (raspberry)
Device C (laptop)
I have managed to setup the raspberrys wifi as an acces point so I can connect with device C to device B. When connected to the access point I can ssh to the raspberry (device B). When I am connected through ssh I can access device A through ssh from the raspberry (B). What I want is to ssh directly from device C (laptop) to device A (sensor).
The sensor is connected through the ethernet port of the raspi and is set the a fixed ip (eth0 = 192.168.6.2) The laptop is connected through the wifi of the raspi and is also set to an fixed ip (wlan0- 192.168.6.1)
I have been reading about bridging and routing and if I understood it right you use bridging to connect different subnets, while in my case everything is located on the same subnet. I simply want the eth0 and wlan0 to share the same network.
So my question is:
How do I connect these two interface to each other (eth0 and wlan0) so that I can access device A and B from device C?
- Is the assigning of a static ip to eth0 and wlan0 ok?
- Or should I solve this by assigning different subnets to the interfaces and bridge?
Things that should be noted:
- No device is connected to the internet.
- I still want to be able to access device B (raspberry) from the laptop (device C)
- I am using buildroot to create an OS.
Update 2: almost there... The contents of some important files/commands:
iface br0 inet static
bridge_ports eth0 wlan0
pre-up brctl addbr br0
pre-up brctl addif br0 eth0 wlan0
post-down brctl delif br0 br0 eth0 wlan0
post-down brctl delbr br0
iface lo inet loopback
iface eth0 inet manual
iface wlan0 inet static
Ok, so I almost have it working (thank @eftshift0). I use the above config files and I am able to do what I wanted. There is only one BUT...:
The setup works if:
- first connect to the wifi
- Then activate the bridge
The has as effect that I can access both the Pi and the sensor. However I do not want to activate the bridge manually. It seems that the handing out of the IP addresses does not work when the bridge is active. This is further confirmed by the fact that if I use an static IP I can make the connection. So now the question comes down to this: Why is the dhcp server not working of the bridge is active?