Difference between revisions of "Policy Based Routing"

From Teltonika Networks Wiki
Line 145: Line 145:
 
By clicking [[File:Add Button.png|40x70px]] create 3 rules under '''Routing Rules for IPv4''' tab apply these changes to the rules:
 
By clicking [[File:Add Button.png|40x70px]] create 3 rules under '''Routing Rules for IPv4''' tab apply these changes to the rules:
 
======Policy Rule 1======
 
======Policy Rule 1======
-----
+
----
 
# Enter Priority: '''1'''
 
# Enter Priority: '''1'''
 
# Select Incoming interface: '''LAN_VLAN_ETH0'''
 
# Select Incoming interface: '''LAN_VLAN_ETH0'''
Line 163: Line 163:
 
[[File:POLICY_RULE_2.png|border|class=tlt-border|center]]
 
[[File:POLICY_RULE_2.png|border|class=tlt-border|center]]
 
======Policy Rule 3======
 
======Policy Rule 3======
-----
+
----
 
# Enter Priority: '''1'''
 
# Enter Priority: '''1'''
 
# Select Incoming interface: '''LAN_VLAN_5'''
 
# Select Incoming interface: '''LAN_VLAN_5'''
Line 172: Line 172:
  
 
'''NOTE: Delete all Autimatic or unrelated routing rules'''
 
'''NOTE: Delete all Autimatic or unrelated routing rules'''
 +
 +
===Configuration testing===
 +
----
 +
 +
Connect end device to physical port that is assingned to different routing policy. Open cmd and run this command: '''traceroute 8.8.8.8''', three physical ports that we assigned to diffrent Vlans route to 8.8.8.8 should be dispayed using different addresses.
 +
 +
 +
====LAN1 Test Result====
 +
----
 +
====LAN2 Test Result====
 +
----
 +
====LAN3 Test Result====
 +
----

Revision as of 15:00, 21 June 2024

The information on this page is updated in accordance with the 00.07.07.1 firmware version .

Introduction


Policy-based routing (PBR) is a technique used in computer networking to direct network packets based on defined criteria beyond the standard destination-based routing. Unlike traditional routing, which forwards packets solely based on their destination address, PBR allows administrators to customize routing decisions according to various factors such as source address, type of service, protocol, or application.

With policy-based routing, network administrators can implement specific rules or policies to dictate the path that packets should take through the network. This flexibility enables organizations to optimize traffic flow, prioritize certain types of traffic, enforce security measures, and manage network resources more efficiently.

Prerequisites & Topology


Before proceeding with the confuration, ensure that all requirements are met:

  1. Before starting you need to have 3 different WAN connections. In this case we are going to use: Wi-fi WAN, Wired WAN and Mobile WAN.
PBS model.png

Configuration


If you're having trouble finding this page or some of the parameters described here on your device's WebUI, you should turn on "Advanced WebUI" mode. You can do that by clicking the "Advanced" button, located at the top of the WebUI.

Networking rutos manual webui basic advanced mode 75.gif

Configuring VLANs


Open router‘s WebUI and navigate to Network → VLAN → Port Based configuration:

Port based VLAN


Add new VLANs by clicking Add Button.png and Make following changes:

  1. VLAN ID: 1 | lan1: Untagged | Lan2: Off | Lan3: Off | lan4: Untagged | Wan: Off
  2. VLAN ID: 3 | lan1: Off | Lan2: Untagged | Lan3: Off | lan4: Off | Wan: Off
  3. VLAN ID: 5 | lan1: Off | Lan2: Off | Lan3: Untagged | lan4: Off | Wan: Off


PBR VLAN.png

Configuring Different LAN Networks


Open router’s WebUI → Network → LAN click Pencil2.pngon current available LAN interface configuration:

LAN1 General Settings


Make the following changes:

  1. Enter Name : LAN_VLAN_ETH0
PBS LAN1 NAME.png

LAN1 Physical Settings


Make the following changes:

  1. Select Interface : eth0
PBS LAN1 PHYSICAL.png

Add new LAN netwrok by clicking Add Button.png and Make following changes:

LAN2 General Settings


Make the following changes:

  1. Enable Interface: on
  2. Enter Name : LAN_VLAN_3
  3. Enter IPV4 address: 192.168.3.1
  4. Select IPV4 netmask: 255.255.255.0
  5. Enable DHCPv4: on
PBS LAN3 GENERAL.png

LAN2 Physical Settings


Make the following changes:

  1. Select Interface : eth0.3
PBS LAN3 PHYSICAL.png

Add new LAN netwrok by clicking Add Button.png and Make following changes:

LAN3 General Settings


Make the following changes:

  1. Enable Interface: on
  2. Enter Name : LAN_VLAN_5
  3. Enter IPV4 address: 192.168.5.1
  4. Select IPV4 netmask: 255.255.255.0
  5. Enable DHCPv4: on
PBS LAN5 GENERAL.png

LAN3 Physical Settings


Make the following changes:

  1. Select Interface : eth0.5
PBS LAN5 PHYSICAL.png

After configuring all LAN interfaces the end result should look something like this:

PBS LAN CON.png

Configuring Policy Based Routing


Open WebUI → Network → Routing → Policy based routing → Add new instance and create new instances for each available WAN in this case Wi-Fi WAN, Wired-WAN and Mobile:

Creating Wifi Wan Routing Table


Add new instance:

  1. Enter ID: 1
  2. Enter New configuration name: WifiWan
PBR IMAGE WIFI.png

click Add Button.png in the new window make following changes:

Static IPv4 Routes

click Add Button.png and aplly this to the route:

  1. Select Interface: WifiWan | Enter Target: '0.0.0.0 | Enter IPv4-Netmask: 0.0.0.0 | Enter IPv4-Gateway: 192.168.100.1
PBR P ROUTE 1.png

Creating Wired Wan Routing Table


Add new instance:

  1. Enter ID: 3
  2. Enter New configuration name: WiredWan
PBS WAN ROUTE1.png

click Add Button.png in the new window make following changes:

Static IPv4 Routes

click Add Button.png and aplly this to the route:

  1. Select Interface: wan | Enter Target: '0.0.0.0 | Enter IPv4-Netmask: 0.0.0.0 | Enter IPv4-Gateway: 192.168.3.1
PBR P ROUTE 2.png

Creating Mobile Wan Routing Table


Add new instance:

  1. Enter ID: 5
  2. Enter New configuration name: MwWan
PBR MOBILE 1.png

click Add Button.png in the new window make following changes:

Static IPv4 Routes

click Add Button.png and aplly this to the route:

  1. Select Interface:mob1s1a1 | Enter Target: '0.0.0.0 | Enter IPv4-Netmask: 0.0.0.0
PBS TABLES WAN.png

Creating Routing Rules for IPv4


Routing Rules for IPv4

By clicking Add Button.png create 3 rules under Routing Rules for IPv4 tab apply these changes to the rules:

Policy Rule 1

  1. Enter Priority: 1
  2. Select Incoming interface: LAN_VLAN_ETH0
  3. Select Outgoing interface: None
  4. Select Matched Traffic Action: Lookup Table
  5. Lookup Table: WanWifi(1)
POLICY RULE 11.png
Policy Rule 2

  1. Enter Priority: 1
  2. Select Incoming interface: LAN_VLAN_3
  3. Select Outgoing interface: None
  4. Select Matched Traffic Action: Lookup Table
  5. Lookup Table: WiredWan(3)
POLICY RULE 2.png
Policy Rule 3

  1. Enter Priority: 1
  2. Select Incoming interface: LAN_VLAN_5
  3. Select Outgoing interface: None
  4. Select Matched Traffic Action: Lookup Table
  5. Lookup Table: MWan(5)
POLICY RULE 3.png

NOTE: Delete all Autimatic or unrelated routing rules

Configuration testing


Connect end device to physical port that is assingned to different routing policy. Open cmd and run this command: traceroute 8.8.8.8, three physical ports that we assigned to diffrent Vlans route to 8.8.8.8 should be dispayed using different addresses.


LAN1 Test Result


LAN2 Test Result


LAN3 Test Result