home

Supported platforms

Vyatta documentation

Learn how to install, configure, and operate the Vyatta Network Operating System (Vyatta NOS) and Orchestrator, which help drive our virtual networking and physical platforms portfolio.

PBR routing example

The following figure shows a simple site that uses PBR on the Vyatta router (R1) to route traffic from two different internal subnets to two Internet links.

The following conditions apply to this scenario:

  • All Internet-bound traffic from subnet 192.168.10.0/24 is routed out interface dp0p1p1.
  • All Internet-bound traffic from subnet 192.168.20.0/24 is routed out interface dp0p1p2.
Figure 1. Routing using PBR

To configure the scenario, perform the following steps in configuration mode.

Table 1. Routing using PBR

Step

Command

Create Rule 10.

vyatta@R1# set policy route pbr myroute rule 10 address-family ipv4 
vyatta@R1# set policy route pbr myroute rule 10 action accept

Specify the source address to match. In this case, any address on subnet 192.168.10.0/24 is a match.

vyatta@R1# set policy route pbr myroute rule 10 source address 192.168.10.0/24

Specify that all matching packets use alternate routing table 1.

vyatta@R1# set policy route pbr myroute rule 10 table 1

Create rule 20.

vyatta@R1# set policy route pbr myroute rule 20 address-family ipv4

vyatta@R1# set policy route pbr myroute rule 20 action accept

Specify the source address to match. In this case, any address on subnet 192.168.20.0/24 is a match.

vyatta@R1# set policy route pbr myroute rule 20 source address 192.168.20.0/24

Specify that all matching packets use alternate routing table 2.

vyatta@R1# set policy route pbr myroute rule 20 table 2

Commit the changes.

vyatta@R1# commit

Show the policy-based routing configuration.

vyatta@R1# show policy route 
 route {
        pbr myroute {
                rule 10 {
                        action accept
                        address-family ipv4
                        source {
                                address 192.168.10.0/24
                        }
                        table 1
                }
                rule 20 {
                        action accept
                        address-family ipv4
                        source {
                                address 192.168.20.0/24
                        }
                        table 2
                }
        }
 }

Create the alternative routing table 1.

vyatta@R1# set protocols static table 1 route 12.34.56.0/24 next-hop 12.34.56.11

Create the alternative routing table 2.

vyatta@R1# set protocols static table 2 route 98.76.54.0/24 next-hop 98.76.54.22

Commit the change.

vyatta@R1# commit

Show the alternate routing table configuration.

vyatta@R1# show protocols static

 static {
     table 1 {
         route 12.34.56.0/24 {
             next-hop 12.34.56.11 
           }
       }
     table 2 {
         route 98.76.54.0/24 {
             next-hop 98.76.54.22
           }
       }
    }

Apply the IP addresses to the corresponding data plane interfaces.

vyatta@R1# set interfaces dataplane dp0p1p1 address 12.34.56.33/24
vyatta@R1# set interfaces dataplane dp0p1p2 address 98.76.54.44/24
vyatta@R1# set interfaces dataplane dp0p1p3 address 192.168.10.254/24
vyatta@R1# set interfaces dataplane dp0p1p4 address 192.168.20.254/24

Apply the policy route with dp0p1p3, and dp0p1p4 interfaces

vyatta@R1# set interfaces dataplane dp0p1p3 policy route pbr myroute
vyatta@R1# set interfaces dataplane dp0p1p4 policy route pbr myroute

Show the data plane interface configuration.

vyatta@R1# show interfaces dataplane 

 dataplane dp0p1p1 {
     address 12.34.56.33/24
}
 dataplane dp0p1p2 {
     address 98.76.54.44/24
}
 dataplane dp0p1p3 {
     address 192.168.10.254/24
     policy {
         route {
           pbr myroute
         }
     }
}
 dataplane dp0p1p4 {
     address 192.168.20.254/24
      policy {
         route {
           pbr myroute
        }
     }
}