0

I have managed to configure an old router (linksys WRT160NL) as a wifi client using OpenWrt 17.01.4 to connect my raspberry pi to my network and have internet. The configuration is as follows

Main router is at 192.168.0.1 (wan).

Raspberry is at 192.168.1.222 (lan), connected via cable to the OpenWrt router which I can access with 192.168.1.1 or 192.168.0.30 from my main pc.

But I can't connect to my raspberry from my main pc on wan. My configs are

/etc/config/firewall: https://pastebin.com/NUgCsnUQ

/etc/config/network: https://pastebin.com/pCRsaAWs

I followed this guide.

1 Answer 1

1

According to the guide you linked, you set up your OpenWrt router with masquerade. In other words, for every connection the RaspPi initiates, the OpenWrt will pretend that itself is making the requests instead of the RaspPi. By design, this doesn't work the other way round: When you access the OpenWrt from your main PC, it's really the OpenWrt; and the IP address of the RaspPi is not accessible.

In general, what you are trying to do (bridging a LAN to a WLAN station in client mode) is difficult to do for technical reasons (the WLAN protocol only uses 3 MAC addresses instead of the 4 MAC addresses needed to make this work properly).

There are workarounds, but they all have their gotchas and drawbacks. Which of them to use depend on what exactly are you trying to achieve by putting a RaspPi behind a WLAN router: Is the RaspPi the only device for which you want to do that? Do you only need to access special ports on the RaspPi? Etc.

Edit

Two options for the purpose mentioned in the comments:

1) To use the old Router as a glorified Wifi-Dongle for the RaspPi, have a look at wlan_kabel. This is a program that uses packet sockets to directly bridge the WLAN network interface to the LAN network interface. As a consequence, the Router won't be reachable over WLAN anymore.

I've no idea if this program is available for OpenWrt, or if you need to cross-compile it.

2) To access the application on the RaspPi that controls the printer, find out which port it uses, then use port forwarding to make this port (or several ports) accessible under the IP of the Router.

1
  • I am using the router basically as a wifi dongle. I just need to connect to it from my main pc. I may want to use a second port on the WLAN to give a notebook stronger signal. but my main concer is being able to see the raspi from my main network since it controls the printer. Mar 7, 2018 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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