2

I have Raspberry Pi (with osmc), turned on Tethering from WiFi to Ethernet. Raspberry is a WiFi client on my home WiFi network with IP 10.0.0.15 and gateway 10.0.0.138. I have connected MyBookWorld NAS to Raspberry Ethernet, the eth0 has IP 192.168.0.1 and NAS have 192.168.0.2. When I ssh to Raspberry over WiFi, ssh [email protected], I can ping NAS with ping 192.168.0.2. But I can not ping NAS from my other WiFi clients like Mac with IP 10.0.0.6. Routing to 192.168.0.2 does not work, probably because WiFi subnet is 255.255.255.0. I believe it would be a piece of cake for someone to advise me how to access NAS at 192.168.0.2 from 10.0.0.x clients through Raspberry as router. Thank you very much!

1
  • 1
    the issue is nothing to do with the network MASK of 255.255.255.0 ... how does your 10.x.x.x network "know" where to find 192.168.0.x? For a start, you need to set routing on your 10.x.x.x network to route traffic for 192.168.0.x to 10.0.0.15 Commented Mar 2, 2019 at 4:45

2 Answers 2

3

I assume you are using a Raspberry Pi 3B/3B+ with Raspbian.

The problem is not the RasPi. The problem is the home WiFi router with ip address 10.0.0.138. It does not know that it has to send ip packages with ip addresses from 192.168.0.0/24 to the RasPi so that can forward it to the NAS. You have to set a static route on the home WiFi router to the RasPi with destination 192.168.0.0/24 and with the gateway/next hop 10.0.0.15.

If you do not have access to the home WiFi router or if it doesn't support setting static routes then you could use a bridge on the RasPi that would bridge interfaces wlan0 and eth0 so all devices incl. the NAS have all ip addresses from 10.0.0.0/24, means they are all connected to the same subnet. But the problem here is that the on-board chip does not support bridging of a client WiFi connection so we have to use workarounds. But they are not very easy to setup. Keywords here are NAT, port forwarding or proxy arp.

Another solution would be to invest into a USB/WiFi dongle that supports WDS/4addr, so you can bridge the WiFi client connection.

As you see, the best solution is setting a static route on the home WiFi router if possible. Tell me if you are not able to it.

1
  • Thanks very much! Configuring static route on wifi router solved the problem.
    – Jan
    Commented Mar 2, 2019 at 10:58
0

You didn't mention whether you've enabled IP forwarding on the Pi. Edit /etc/sysctl.conf, uncomment the line that has net.ipv4.ip_forward=1 commented out, and reboot.

2
  • setting forwarding on the pi won't allow devices on the 10.x.x.x network to magically know where to route traffic for 192.168.0.x Commented Mar 2, 2019 at 4:47
  • Indeed. I read the original question a bit too quickly. The WiFi router needs to have the routing established, as the answer above indicated.
    – bls
    Commented Mar 3, 2019 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.