Saturday, May 25, 2019

Setting up OpenVPN on a Softbank router

This is really more a "note to self" to remind myself how I got everything working.

For months, I have been trying, on and off, to get OpenVPN to work on a Orange Pi Lite which I had lying around. For months, I had not been able to get port forwarding to work on my setup. The main problem seemed to be the Softbank E-WMTA2.3 router that Softbank provided. No matter how I tried, it just would not allow the packets to come through to my OpenVPN server.

First, a note: I have Internet WAN connection via my Softbank E-WMTA2.3 router, which is connected to a ASUS WiFi router that serves as my internal LAN. All devices are connected to the ASUS router. Only the ASUS router is directly connected to the Softbank E-WMTA2.3 router.

I first tried to set up port forwarding on the E-WMTA2.3 router to forward OpenVPN port to the ASUS router, and on the ASUS router, port forward that to my OpenVPN server. But it didn't work no matter how I tried to tweak the settings on my E-WMTA2.3 router.

Then I came across this post (Japanese only) on how to get it working.

Basically, it is to set up PPPoE passthrough on the E-WMTA2.3 router, and then use the ASUS router to connect via PPPoE to the Internet. For that, you will need your PPPoE username and password provided by Softbank. The username should end in "@sbb.ne.jp" or something like that. The password is just a string of random numbers and characters given by Softbank, unless you have changed it subsequently.

Steps (not a detailed walkthrough, more a concept guide):
1. Set up WiFi on the ASUS router. Enable it.
2. Disable WiFi on E-WMTA2.3 router, since the ASUS router will be used.
3. Enable PPPoE passthrough on E-WMTA2.3 router.
4. Set up PPPoE on the ASUS router using the username and password given by Softbank.
5. Set up static IP address for OpenVPN server so that it gets assigned a fixed IP all the time internally. Else port forwarding may get lost.
6. Set up port forwarding to port forward OpenVPN port to the OpenVPN server on the server's static IP.
7. Note down your public IP address. This should be shown in the ASUS router's settings page.
8. Install OpenVPN on the server (in my case, Orange Pi Lite). Use the public IP noted down in Step 7.
(Alternatively, you can use a DDNS service to point a domain name to this address. In my case, I have a domain name registered with enom, so I use their settings page to point a certain hostname to this address instead. There are methods to update enom or DDNS services with current public IP address, Google should provide some answers.)
9. Generate the OVPN files, copy them to the computers you want to use OpenVPN clients on, install the client software and import the OVPN files. This should allow your client computer to connect to the OpenVPN server.

I believe this should work for other services requiring port forwarding, like cloud servers at home. Next would be to try setting up my own NextCloud server. 😉

Tidbits:
Updating DDNS with an ESP32
HOW TO: Enom dynamic DNS updating
Enom Dynamic DNS Update Script
Easy installation script for OpenVPN
OpenVPN on a Asus router

No comments: