Policy Based Routing
MikroTik ECMP Recursive Load Balancing & Failover
PCC Load Balancing & Failover
1. What is Policy Based Routing (PBR)?
Policy Based Routing (PBR) is a method used in networking to control the path of traffic based on defined policies instead of relying only on the destination IP address. Normally, routers use routing tables to decide the path, but PBR allows administrators to override this behavior and make routing decisions based on conditions like source IP, protocol, or application.
2. Why PBR is Needed
In real networks, sometimes we need more control over traffic flow. For example, you may want certain users to use a different internet link or send specific application traffic through a secure firewall. PBR helps achieve these requirements by applying customized rules instead of default routing.
3. How PBR Works
PBR works by checking incoming packets against defined policies. These policies are usually configured using access control lists (ACLs) or match conditions. If a packet matches the policy, the router applies a specific action such as forwarding it to a particular next-hop IP address. If no match is found, normal routing is used.
4. Components of PBR
PBR mainly uses three components:
- Match Criteria: Conditions like source IP, destination IP, protocol, or port number.
- Set Actions: Defines what to do with matched traffic (e.g., set next-hop, change interface).
- Route Map: A configuration structure that ties match and set rules together.
5. Example of PBR
Suppose a company has two internet links: ISP1 and ISP2. You can configure PBR so that:
- Employees’ traffic goes through ISP1
- Guest users’ traffic goes through ISP2
This ensures better bandwidth management and network performance.
6. Advantages of PBR
PBR provides flexibility and control over traffic routing. It allows load balancing, improves security by directing sensitive traffic through firewalls, and helps optimize network performance by using multiple links efficiently.
7. Disadvantages of PBR
PBR increases configuration complexity and can consume more CPU resources on routers. It may also make troubleshooting harder because routing decisions are not based only on routing tables.
8. Where PBR is Used
PBR is commonly used in enterprise networks, service provider environments, and data centers. It is useful for traffic engineering, QoS policies, and enforcing security rules.
9. PBR vs Normal Routing
In normal routing, decisions are made based only on the destination IP address using routing tables. In PBR, decisions can be based on multiple parameters like source, protocol, or application, giving more control to the network administrator.
10. Conclusion
Policy Based Routing is a powerful feature that allows customized traffic control in networks. While it adds complexity, it is very useful for managing modern networks where simple destination-based routing is not enough.
Router A
.........
configure terminal
interface GigabitEthernet 0/0/0
no ip address
interface GigabitEthernet 0/0.100
encapsulation dot1Q 100
ip address 192.168.1.100 255.255.255.0
interface GigabitEthernet 0/0.100
ip address 192.168.2.200 255.255.255.0
exit
interface GigabitEthernet 0/0/1
ip address 10.0.0.1 255.255.255.0
no shutdown
interface GigabitEthernet 0/0/2
ip address 20.0.0.1 255.255.255.0
no shutdown
exit
ACL
...
access-list 1 permit 192.168.1.0 0.0.0.255
access-list 2 permit 192.168.2.0 0.0.0.255
Routemap
........
route-map IPCisco_PBR permit 10
match ip address 1
set ip next-hop 10.0.0.100
route-map IPCisco_PBR permit 20
match ip address 2
set ip next-hop 20.0.0.100
route-map IPCisco_PBR permit 30
set default interface null0
exit
Apply to policy
...............
interface GigabitEthernet 0/0/0.100
ip policy route-map IPCisco_PBR
interface GigabitEthernet 0/0/0.200
ip policy route-map IPCisco_PBR
end
write