Posts: 24
Joined: Wed Jan 27, 2016 6:11 pm

RPi as OpenVPN Router

Thu Mar 02, 2017 12:48 pm

My objective is to use an RPi as a OpenVPN router. I'm using an RPi 3. For testing purposes this RPi has full Raspian Jessie, I will no doubt later run this headless.

Here's where I am now:
The RPi is functioning as a Router. The Wired connection goes to my DSL Modem, the RPi wireless is ad-hoc, routing is working. I can connect to ad-hoc and surf.

eth0 gets IP via DHCP from DSL router
wlan0 has static IP
RPi serves up IP addresses to wireless clients

I have installed OpenVPN and am set to configure, but every article I've read on setting up VPN Routing on RPi says something to the affect of "It's very important that eth0 have a static IP".

Now this is fine, I can set the IP of eth0 so it works on 'This' network, but I want to be able to take the RPi Router and plug it in to any active internet connection and have it function. For the life of me I can't figure out why it would be necessary to have a static IP on eth0? I have a tomato router running OpenVPN and the WAN port is using DHCP, why would the RPi be any different?

Any thoughts on this? Anyone using an RPi as an OpenVPN router?

Posts: 24
Joined: Wed Jan 27, 2016 6:11 pm

Re: RPi as OpenVPN Router

Thu Mar 02, 2017 2:16 pm


After several more hours of tinkering I discovered that wlan0 had no ip address (169.x.x.x) and as a result dnsmasq was unable to start and give out ip's to wireless clients. Wireless clients were still able to surf the net because the RPi is connected to my network which has a DHCP (different range than I specified in dnsmasq) and it was passing straight through enet0 and getting an address from another router since enet0 was on the same subnet as the working DHCP server. Strange that it even worked at all, I suppose it may have something to do with the defined br0 in /etc/network/interfaces.

More to the point though, there doesn't seem to be anyway to make this work.

If wlan0 is up and has valid IP assigned dnsmasq starts and runs and would presumably issue ip addy's. But then hostapd won't start. If I ifdown wlan0 then hostapd starts. Then I ifup wlan0 comes up in Master Mode instead of ad-hoc mode. It's as if they are mutually exclusive. So the only combination that works is to have hostapd start then start wlan0 in ad-hoc mode with a 169.x.x.x address. It's like chasing your tail. You can't have all of them the way you need them.

I've followed instructions from several different posts that claim to have this working, but none of them solve this particular issue. Has anyone successfully gotten an RPi to function as wireless router with a proper configuration?

Posts: 37
Joined: Wed Feb 15, 2017 3:44 am

Re: RPi as OpenVPN Router

Sun Mar 26, 2017 3:36 pm

I'm working on a similar project:


Did you get this figured out? I see myself running into the same issue(s), eventually. Currently, I'm interested in getting this to work on my current network. Sounds like that's working for you?


Return to “Beginners”