R1#configure terminal | Enter configure mode. |
R1(config)#feature pbr | Enable PBR support |
R1(config)#hardware-profile filter ingress- ipv4-ext enable | Enable Ingress IPv4 group extended for PBR support |
R1(config)#ip access-list 123 | Create ip access-list named 123 |
R1(config-ip-acl)#10 permit any 101.1.1.0/24 201.1.1.0/24 | Create an access rule to permit IP packets with source 101.1.1.0/24 and destination 201.1.1.0/24 |
R1(config-ip-acl)#commit | Commit the candidate configuration to the running configuration. |
R1(config-ip-acl)#exit | Exit access-list mode |
R1(config)#route-map 123 permit 10 | Configure route-map with name 123 and sequence number 10 |
R1(config-route-map)#match ip address 123 | Match ip address with ACL 123 |
R1(config-route-map)#set ip next-hop 13.1.1.2 | Set next-hop to forward the matching IP packets |
R1(config-route-map)#commit | Commit the candidate configuration to the running configuration. |
R1(config-route-map)#exit | Exit route-map mode |
R1(config)#interface lo | Enter interface mode. |
R1(config-if)#ip address 1.1.1.1/32 | Configure the IP address of the interface. |
R1(config-if)#exit | Exit interface mode. |
R1(config)#interface eth1 | Enter interface mode. |
R1(config-if)#ip address 2.1.1.1/24 | Configure the IP address of the interface. |
R1(config)#interface eth2 | Enter interface mode. |
R1(config-if)#ip address 6.1.1.1/24 | Configure the IP address of the interface. |
R1(config-if)#ip ospf cost 2 | Configuring ospf cost as 2 |
R1(config)#interface eth3 | Enter interface mode. |
R1(config-if)#ip address 13.1.1.1/24 | Configure the IP address of the interface. |
R1(config-if)#ip ospf cost 3 | Configuring ospf cost as 3 |
R1(config)#interface eth4 | Enter interface mode. |
R1(config-if)#ip address 101.1.1.2/24 | Configure the IP address of the interface. |
R1(config-if)#ip policy route-map 123 | Attach PBR on the ingress interface |
R1(config-if)#exit | Exit interface mode. |
R1(config)#router ospf 1 | Set the routing process ID . |
R1(config-router)# ospf router-id 1.1.1.1 | Configure OSPF router-id |
R1(config-router)#network 1.1.1.1/32 area 0.0.0.0 | Configure OSPF network in area 0 |
R1(config-router)# network 2.1.1.0/24 area 0.0.0.0 | Configure OSPF network in area 0 |
R1(config-router)#network 6.1.1.0/24 area 0.0.0.0 | Configure OSPF network in area 0 |
R1(config-router)#network 13.1.1.0/24 area 0.0.0.0 | Configure OSPF network in area 0 |
R1(config-router)#network 101.1.1.0/24 area 0.0.0.0 | Configure OSPF network in area 0 |
R1(config-router)#commit | Commit the candidate configuration to the running configuration. |
R1(config-router)#exit | Exit router mode. |
R2#configure terminal | Enter configure mode. |
R2(config)#interface lo | Enter interface mode. |
R2(config-if)#ip address 2.2.2.2/32 | Configure the IP address of the interface. |
R2(config-if)#exit | Exit interface mode. |
R2(config)#interface eth1 | Enter interface mode. |
R2(config-if)#ip address 2.1.1.2/24 | Configure the IP address of the interface. |
R2(config-if)#exit | Exit interface mode. |
R2(config)#interface eth2 | Enter interface mode. |
R2(config-if)#ip address 10.1.1.1/24 | Configure the IP address of the interface. |
R2(config-if)#exit | Exit interface mode. |
R2(config)#router ospf 1 | Set the routing process ID . |
R2(config-router)# ospf router-id 2.2.2.2 | Configure OSPF router-id |
R2(config-router)#network 2.2.2.2/32 area 0.0.0.0 | Configure OSPF network in area 0 |
R2(config-router)# network 2.1.1.0/24 area 0.0.0.0 | Configure OSPF network in area 0 |
R2(config-router)#network 10.1.1.0/24 area 0.0.0.0 | Configure OSPF network in area 0 |
R2(config-router)#commit | Commit the candidate configuration to the running configuration. |
R2(config-router)#exit | Exit router mode. |
R3#configure terminal | Enter configure mode. |
R3(config)#interface lo | Enter interface mode. |
R3(config-if)#ip address 3.3.3.3/32 | Configure the IP address of the interface. |
R3(config-if)#exit | Exit interface mode. |
R3(config)#interface eth1 | Enter interface mode. |
R3(config-if)#ip address 6.1.1.2/24 | Configure the IP address of the interface. |
R3(config-if)#exit | Exit interface mode. |
R3(config)#interface eth2 | Enter interface mode. |
R3(config-if)#ip address 12.1.1.1/24 | Configure the IP address of the interface. |
R3(config-if)#exit | Exit interface mode. |
R3(config)#router ospf 1 | Set the routing process ID . |
R3(config-router)# ospf router-id 3.3.3.3 | Configure OSPF router-id |
R3(config-router)#network 3.3.3.3/32 area 0.0.0.0 | Configure OSPF network in area 0 |
R3(config-router)# network 6.1.1.0/24 area 0.0.0.0 | Configure OSPF network in area 0 |
R3(config-router)#network 12.1.1.0/24 area 0.0.0.0 | Configure OSPF network in area 0 |
R3(config-router)#commit | Commit the candidate configuration to the running configuration. |
R3(config-router)#exit | Exit router mode. |
R4#configure terminal | Enter configure mode. |
R4(config)#interface lo | Enter interface mode. |
R4(config-if)#ip address 4.4.4.4/32 | Configure the IP address of the interface. |
R4(config-if)#exit | Exit interface mode. |
R4(config)#interface eth1 | Enter interface mode. |
R4(config-if)#ip address 13.1.1.2/24 | Configure the IP address of the interface. |
R4(config-if)#exit | Exit interface mode. |
R4(config)#interface eth2 | Enter interface mode. |
R4(config-if)#ip address 15.1.1.1/24 | Configure the IP address of the interface. |
R4(config-if)#exit | Exit interface mode. |
R4(config)#router ospf 1 | Set the routing process ID . |
R4(config-router)# ospf router-id 4.4.4.4 | Configure OSPF router-id |
R4(config-router)#network 4.4.4.4/32 area 0.0.0.0 | Configure OSPF network in area 0 |
R4(config-router)# network 13.1.1.0/24 area 0.0.0.0 | Configure OSPF network in area 0 |
R4(config-router)#network 15.1.1.0/24 area 0.0.0.0 | Configure OSPF network in area 0 |
R4(config-router)#commit | Commit the candidate configuration to the running configuration. |
R4(config-router)#exit | Exit router mode. |
R5#configure terminal | Enter configure mode. |
R5(config)#interface lo | Enter interface mode. |
R5(config-if)#ip address 5.5.5.5/32 | Configure the IP address of the interface. |
R5(config-if)#exit | Exit interface mode. |
R5(config)#interface eth1 | Enter interface mode. |
R5(config-if)#ip address 10.1.1.2/24 | Configure the IP address of the interface. |
R4(config-if)#exit | Exit interface mode. |
R5(config)#interface eth2 | Enter interface mode. |
R5(config-if)#ip address 12.1.1.1/24 | Configure the IP address of the interface. |
R5(config-if)#exit | Exit interface mode. |
R5(config)#interface eth3 | Enter interface mode. |
R5(config-if)#ip address 15.1.1.2/24 | Configure the IP address of the interface. |
R5(config-if)#exit | Exit interface mode. |
R5(config)#interface eth4 | Enter interface mode. |
R5(config-if)#ip address 202.1.1.2/24 | Configure the IP address of the interface. |
R5(config-if)#exit | Exit interface mode. |
R5(config)#router ospf 1 | Set the routing process ID . |
R5(config-router)# ospf router-id 5.5.5.5 | Configure OSPF router-id |
R5(config-router)#network 5.5.5.5/32 area 0.0.0.0 | Configure OSPF network in area 0 |
R5(config-router)# network 10.1.1.0/24 area 0.0.0.0 | Configure OSPF network in area 0 |
R5(config-router)# network 12.1.1.0/24 area 0.0.0.0 | Configure OSPF network in area 0 |
R5(config-router)#network 15.1.1.0/24 area 0.0.0.0 | Configure OSPF network in area 0 |
R5(config-router)#network 202.1.1.0/24 area 0.0.0.0 | Configure OSPF network in area 0 |
R5(config-router)#commit | Commit the candidate configuration to the running configuration. |
R5(config-router)#exit | Exit router mode. |