1

I want to route all traffic on my OpenWRT router via my Raspberry Pi that has a OpenVPN client connection.

I have a simple setup:

+-------------------+            +---------------+
|                   |  Connected |               |
|     ISP MODEM     +------------+OpenWRT Router |
|    192.168.1.1    | to lan port| 192.168.1.2   |
+-------------------+            +--+-----------++
                                    |           |
                                    |           |
                                    |           |
                             +------+-------+   |  +-------------------+
                             | Raspberry Pi |   |  | All other devices |
                             | with OpenVPN |   +--+ connected via WiFi|
                             | 192.168.1.3  |      |    192.168.1.*    |
                             +--------------+      +-------------------+

I literally followed this guide to setup a bridged AP on OpenWRT and this tutorial to setup OpenVPN on my Raspberry Pi. I believe that the settings on the Raspberry Pi are correct.

I tried to change the default gateway as following on my OpenWRT router:

root@OpenWrt:~# ip route del default
root@OpenWrt:~# ip route add default via 192.168.1.3
root@OpenWrt:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.3     0.0.0.0         UG    0      0        0 br-lan
192.168.1.0     *               255.255.255.0   U     0      0        0 br-lan

On my router I see that this worked because it now has an IP of the VPN provider

root@OpenWrt:~# wget -qO- http://canihazip.com/s
46.166.186.213

However on all my devices that are connected to the OpenWRT router's WiFi or cable, I still get my old ISP's IP.

I realize that there are many similar questions here, however non off the solutions worked for me. I know little about networks and start to think that what I want is not possible with a bridged AP.

9
  • Read this article sitepoint.com/setting-up-a-home-vpn-using-your-raspberry-pi
    – Narzan Q.
    Commented Feb 19, 2017 at 12:14
  • I think it wouldn't work. You have to add one more interface on raspberry pi and put it in between ISP modem and AP router. Why you don't use openWRT as openVPN client in router mode? AFAIK openWRT supported it
    – Alex
    Commented Feb 19, 2017 at 12:34
  • @narzan thanks for the link, but that guide helps in setting up a VPN server, which I already have (because I pay for it).
    – johnbaltis
    Commented Feb 19, 2017 at 12:42
  • "To access the VPN from other computers and devices on the network, it will need a client that these devices can connect through" < are you sure you checked this step!
    – Narzan Q.
    Commented Feb 19, 2017 at 12:45
  • @Alex thanks for your comment, how sure are you about it not being possible? I have tried setting up OpenVPN on the router, but I probably ran into the same problem: I have it set up as a bridged AP. Should I set it up as a Routed AP or Routed Client or something else?
    – johnbaltis
    Commented Feb 19, 2017 at 12:46

1 Answer 1

1

It is not possible to do this with a bridged access point set-up.

And to do this you don't need the Raspberry Pi at all.

Make the following setup:

+-------------------+            +---------------+
|                   |  Connected |               |
|     ISP MODEM     +------------+OpenWRT Router |
|    192.168.1.1    | to wan port| 192.168.2.1   |
+-------------------+            +-------+-------+
                                         |
                                         |
                                         |
                              +----------+--------+
                              | All other devices |
                              | connected via WiFi|
                              |    192.168.2.*    |
                              +-------------------+

On a router with default settings:

  1. Open /etc/config/network and find config interface 'lan'.
  2. There you change option ipaddr '192.168.1.1' to option ipaddr '192.168.2.1'.
  3. Then follow a guide to set-up OpenVPN on the OpenWRT router. I used this guide on GitHub which is for the Private Internet Access provider, but it should apply to all providers that support OpenVPN. Note that in the tutorial I link, they use 192.168.1.1, instead you should now use 192.168.2.1.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .