CISCO VRF

Virtual Routing and Forwarding (VRF)

In IP-based computer networks, virtual routing and forwarding (VRF) is a technology that allows multiple instances of a routing table to co-exist within the same router at the same time.

R1

  • hostname R1

    int e0/0

    ip add 172.16.1.1 255.255.255.0

    no shutdown

  • R2

    • hostname R2

      int e0/0

      ip add 172.16.2.1 255.255.255.0

      no shutdown

    • R3

      • hostname R3

        int e0/0

        ip add 172.16.3.1 255.255.255.0

        no shutdown

      • R4

        • hostname R4

          int e0/0

          ip add 172.16.4.1 255.255.255.0

          no shutdown

        • R5

          • hostname R5

            ip vrf red

            ip vrf blue

            int e0/0

            ip vrf forwading blue

            ip add 172.16.4.2 255.255.255.0

            no shutdown

            int e0/1

            ip vrf forwading red

            ip add 172.16.2.2 255.255.255.0

            no shutdown

            ip vrf forwading blue

            int e0/2

            ip add 172.16.3.2 255.255.255.0

            no shutdown

            int e0/3

            ip vrf forwading red

            ip add 172.16.1.2 255.255.255.0

            no shutdown

          • Open Shortest Path First (OSPF)

            You need to set which region allocation to allow the interface when configuring any OSPF router. In region assignment, OSPF has a set of simple guidelines. Area setup must be achieved by OSPF. Now continue the command to set the OSPF,

            R1

            • router ospf 1

              network 172.16.1.0 0.0.0.255 area 0

              network 1.1.1.1 0.0.0.0 area 0

            • R2

              • router ospf 1

                network 172.16.2.0 0.0.0.255 area 0

                network 2.2.2.2 0.0.0.0 area 0

              • R3

                • router ospf 1

                  network 172.16.3.0 0.0.0.255 area 0

                  network 3.3.3.3 0.0.0.0 area 0

                • R4

                  • router ospf 1

                    network 172.16.4.0 0.0.0.255 area 0

                    network 4.4.4.4 0.0.0.0 area 0

                  • R5

                    • router ospf 1 vrf red

                      network 172.16.1.0 0.0.0.255 area 0

                      network 172.16.2.0 0.0.0.255 area 0

                      router ospf 2 vrf blue

                      network 172.16.3.0 0.0.0.255 area 0

                      network 172.16.4.0 0.0.0.255 area 0

                      do show ip ro vrf red ospf

                      do show ip ro vrf blue ospf

                      do ping vrf red 172.16.1.2

                      do ping vrf red 172.16.2.2

                      do ping vrf blue 172.16.3.2

                      do ping vrf blue 172.16.4.2

                    • You can see the picture result below,