Difference between revisions of "WireGuard Configuration Example"

From Teltonika Networks Wiki
Line 1: Line 1:
<!-- Template uses {{{name}}}, {{{series}}}  -->
 
{{Template:Networking_rutos_manual_fw_disclosure
 
| fw_version = {{{series}}}_R_00.02.04
 
| series    = {{{series}}}
 
}}
 
 
__TOC__
 
__TOC__
  

Revision as of 10:25, 3 July 2020

Introduction

WireGuard is simple, fast, lean, and modern VPN that utilizes secure and trusted cryptography. This page will show you an example on how to configure a basic tunnel between WireGuard interface and its peers.

Prerequisites

For this example you need:

  • Two RUTOS devices (this example will be written with RUTX09 and TRB141 in particular)
  • An end device to configure devices (PC, Laptop, Tablet or Smartphone)
  • One end device must have Public IP address
  • End results

    In the end there will be created a tunnel between RUTX09 and TRB141. RUTX09 will have 10.0.0.1 and TRB141 will have 10.0.0.2 tunnel IP addresses.

    WireGuard Instances

    To create Instance enter its name and click the Add button. Then click the Edit Networking rutx manual edit button v1.png button to configure it.

    In this example Instance is named by its device name to make it easier to follow images.

    RUTX09 Example


    Networking wireguard configuration example interface rutx09 v1.png

    TRB141 Example


    Networking wireguard configuration example interface trb141 v1.png

    Instance Configuration

    The following part of example applies to both devices.

    Before editing any fields click Networking rutx manual generate button v1.png button to generate Public and Private keys.

    After that you need to Enable this instance and in the Listen Port field enter your desired port. WireGuard by default uses 51820 port which will be used in this example.

    Lastly you need to enter IP Address for instance. As mentioned in the beginning, RUTX09 will have 10.0.0.1 and TRB141 will have 10.0.0.2 IP addresses.

    Note: enter IP address and its mask e.g. 10.0.0.1/24

    RUTX09 Example


    Networking wireguard configuration example interface general rutx09 v3.png

    Note: fields with numbers 1 and 2 will be used later when configuring remote peers.

    TRB141 Example


    Networking wireguard configuration example interface general trb141 v2.png

    Note: fields with numbers 3 and 4 will be used later when configuring remote peers.

    Peers

    Until now you have configured WireGuard instance itself, now you need to configure Peers which are going to connect to those instances.

    To create Peer enter its name and click the Add button. Then click the Edit Networking rutx manual edit button v1.png button to configure it.

    One Peer for each device will be created:

  • RUTX09 will have a Peer named trb1peer
  • TRB141 will have a Peer named rutxpeer
  • RUTX09 Example


    Networking wireguard configuration example interface peers rutx09 v1.png

    TRB141 Example


    Networking wireguard configuration example interface peers trb141 v1.png

    Peers Configuration

    General Setup

    In the General Setup section you need to enter Public Key and Allowed IPs from the Remote instance you want to connect to.

    In this example a peer from RUTX09 (named trb1peer) needs to connect to TRB141, which means trb1peer will enter Public Key and Allowed IPs from TRB141.

    Note: the numbers in the images below represent a number of field from which that value was taken from the images in Instance Configuration.

    RUTX09 Example


    Networking wireguard configuration example interface peers configuration rutx09 v2.png

    TRB141 Example


    Networking wireguard configuration example interface peers configuration trb141 v2.png

    Advanced Setup


    Lastly atleast one device has to enter Remote instance Public WAN IP address. Enter IP address, save and move to the Testing Configuration.

    Networking wireguard configuration example interface peers configuration advanced trb141 v1.png

    Testing Configuration