Vyatta Network OS Documentation

Learn how to install, configure and operate the Vyatta NOS, which helps drive our virtual networking & physical platforms portfolio.

Configuring policy-based routing on a routing instance

An example of configuring policy-based routing on a routing instance and the related commands.

In this example, the R1 vRouter is connected to the R2 vRouter through the dp0s7 interface that is bound to the GREEN routing instance.

The following steps show how to create an alternate routing table in the GREEN routing instance on dp0s7.
Figure 1. Configuring policy-based routing on a routing instance
To configure policy-based routing on a vRouter perform the following configuration and then reproduce the configuration as described in .
Table 1. Configuring policy-based static routes on a routing instance
Step Command

Define the dp0s7 interface and bind it to the GREEN routing instance.

vyatta@R1# set interfaces dataplane dp0s7
vyatta@R1# set routing routing-instance GREEN interface dp0s7

Define an interface based static route.

vyatta@R1# set routing routing-instance GREEN protocols static table 10 interface-route 20.1.1.0/24 next-hop-interface dp0s7
vyatta@R1# set routing routing-instance GREEN protocols static table 10 interface-route6 2010::/64 next-hop-interface dp0s7

Create IPv4 and IPv6 PBR static routes under the GREEN routing instance.

vyatta@R1# set routing routing-instance GREEN protocols static table 10 route 20.1.1.0/24 next-hop 10.1.1.2 interface dp0s7
vyatta@R1# set routing routing-instance GREEN protocols static table 10 route6 2010::/64 next-hop 1010::2 interface dp0s7

Create the IPv4 and IPv6 static routes with distance in the GREEN routing instance in the 10 PBR table.

vyatta@R1# set routing routing-instance GREEN protocols static table 10 route 20.1.1.0/24 next-hop 10.1.1.2 distance 8
vyatta@R1# set routing routing-instance GREEN protocols static table 10 route6 2010::/64 next-hop 1010::2 distance 8

Create IPv4 and IPv6 black hole PBR static route configurations under the GREEN routing instance.

vyatta@R1# set routing routing-instance GREEN protocols static table 10 route 20.1.1.0/24 blackhole
vyatta@R1# set routing routing-instance GREEN protocols static table 10 route6 2010::/64 blackhole

Create unreachable IPv4 and IPv6 PBR static routes under the GREEN routing instance.

vyatta@R1# set routing routing-instance GREEN protocols static route table 10 route 20.1.1.0/24 unreachable
vyatta@R1# set routing routing-instance GREEN protocols static route6 table 10 route6 2010::/64 unreachable

View the configuration.

vyatta@R1# show routing
 routing {
       routing-instance GREEN {
               interface dp0s7
               protocols {
                       static {
                            table 10 {
                               interface-route 20.1.1.0/24 {
                                       next-hop-interface dp0s7
                               }
                               interface-route6 2010::/64 {
                                       next-hop-interface dp0s7
                               }
                               route 20.1.1.0/24 {
                                       blackhole
                                       next-hop 10.1.1.2 {
                                                distance 10
                                                interface dp0s7
                                       }
                                       unreachable
                               }
                               route6 2010::/64 {
                                       blackhole
                                       next-hop 1010::2 {
                                                distance 10
                                                interface dp0s5
                                      }
                                      unreachable

                               }
                               
                       }
               }
       }
}