Template:Networking rutos configuration example openvpn bridge wifi ap use case

From Teltonika Networks Wiki

Configuration overview and prerequisites

Prerequisites:

  • Two RUTX routers
  • A Public Static or Public Dynamic IP addresses
  • An end device to configure the router (PC, Laptop, Tablet, Smartphone)

The topology above depicts the OpenVPN scheme. The router with the Public IP address (RUTX) acts as the OpenVPN server and other RUTX acts as client. OpenVPN connects the networks of HQ Office and Remote Office. Remote Office will also have a separate WiFi AP for guests.

When the scheme is realized, remote office workers will be able to reach HQ’s internal network with all internal systems by connecting to the router via LAN port or by connecting to WiFi AP, which is used for work. All remote office's WAN and LAN traffic is going to travel through VPN tunnel. There will be a separate WiFi AP for guests, by connecting to it they will only be able to reach WAN, but they won't be able to reach HQ’s internal network.

Configuring HQ office router

Before you start configuring the router turn on "Advanced WebUI" mode. You can do that by clicking the "Basic" button under "Mode", which is located at the top-right corner of the WebUI.

Note: You will need to do that in both, HQ and remote office routers.

OpenVPN


Generating Static key


Login to the router's WebUI, navigate to the Services → CLI page and do the following:

  1. Enter username root .
  2. Write the Password of your router.

Write the following commands to create OpenVPN Static key, which will be used for authentication:

1) cd /etc/easy-rsa
2) openvpn --genkey --secret static.key

Extracting the key


Linux

If you are using a Linux-based OS, extracting files from the router is simple. Just go to the directory on your PC where you want to relocate the files, right click anywhere and choose the Open in Terminal option. In the Terminal command line use the Secure Copy (scp) command to copy the files from the router. The full command should look something like this:

$ scp [email protected]:/etc/easy-rsa/static.key ./

The [email protected]:/etc/easy-rsa/static.key specifies the path to where the Static key is located (replace the IP address with your router's LAN IP); the ./ denotes that you want to copy the contents to the directory you are in at the moment.

Windows

If you are using Windows, you can copy files from the router using WinSCP, an Open source freeware SFTP, SCP and FTP client for Windows OS. Use the same login information with WinSCP as with CLI or SSH.

Please note: You must select SCP as File Protocol in WinSCP Session settings.


Once you've connected to the router with WinSCP, copying the files should be simple enough: just go to /etc/easy-rsa/, select the Static key file and drag it to directory on your PC where you would like to store it.

Configuring OpenVPN server


Now go to Services → VPN → OpenVPN. There create a new configuration by selecting role Server, writing New configuration name and pressing Add button. It should appear after a few seconds. Then press Edit.


Now apply the following configuration:

  1. Enable instance.
  2. Set TUN/TAP to TAP (bridged).
  3. Enable LZO.
  4. Select Authentication: Static key.
  5. Add Keep alive interval: 10 120.
  6. Upload Static pre-shared key (use the Static.key file you created in previous steps).
  7. Save the changes.

Configuring remote office router

LAN


Go to Network → LAN and press Edit next to your LAN interface:


Apply the following steps:

  1. Change your LAN IP address to: 192.168.1.2
  2. Disable DHCP.
  3. Save the changes.

OpenVPN


Configuring OpenVPN client


Go to Services → VPN → OpenVPN. There create a new configuration by selecting role Client, writing New configuration name and pressing Add button. It should appear after a few seconds. Then press Edit.


Now apply the following configuration:

  1. Enable instance.
  2. Set TUN/TAP to TAP (bridged).
  3. Enable LZO.
  4. Select Authentication: Static key.
  5. Write Remote host/IP address (RUTX OpenVPN server public IP).
  6. Add Keep alive interval: 10 120.
  7. Upload Static pre-shared key (use the .txt file you created in previous steps).
  8. Save the changes.

Results

Remote office should now be able to access HQ network resources. To verify the connection you can ping remote RUTX HQ server LAN IP and if you get a reply, you have successfully connected to HQ‘s internal network. Also, all LAN addresses should now be leased to the LAN devices by HQ router.