Lab Objective:
The focus of this lab is to understand Cisco Policy Based Routing (PBR) implementation and configuration in Cisco IOS routers. Additional technologies include traffic filtering.
Lab Topology:
The lab network topology is illustrated below:
|
IMPORTANT NOTE If you are using the www.howtonetwork.net racks, please bring up the LAN interfaces connected to the routers by issuing the no shutdown command on the connected switches. If you are using a home lab with no interface fastethernet 0/0 Alternately, you can simply connect the interfaces to a hub or switch if you have one available in your own lab. |
Task 1
Configure hostnames, IP addressing on all routers as illustrated in the network topology.
Task 2
Enable EIGRP using AS 254 on all routers as illustrated in the topology. Do NOT enable EIGRP on the link between R2 and R3. EIGRP packets should NOT be sent out of the LAN interfaces of R2 or R3. Verify the configuration using the appropriate commands.
Task 3
Management is concerned about network security and using the default Telnet port of 23. All routers are configured to accept Telnet connections on port 3023 instead as a result. Management would like to ensure that all Telnet traffic received ingressing R1s LAN interface be discarded. However, Telnet traffic using port 3023 should be forwarded via Serial 0/1 with an IP Precedence value of 4. You are NOT allowed to use inbound or bound ACLs to complete this task – you MUST use PBR. Implement the solution required to complete this task on R1 and verify and test your configuration.
Task 4
For security purposes, Management has requested that locally originated Telnet connections from R2 or R3 to R4 only be discarded. However, these routers should be able to Telnet to other devices or subnets. You are NOT allowed to use inbound or outbound ACLs to complete this task – you MUST use PBR. Implement the solution required to complete this task on both R2 and R3 then verify and test your configuration.
Lab Validation
Task 1
Please refer to previous labs for basic IPv4, IPv6 addressing and hostname configuration. This will not be included in this section to avoid being redundant.
Task 2
Please refer to previous labs for basic EIGRP configuration. Following this, verify your EIGRP configuration using the show ip eigrp neighbors andshow ip route commands. Following this configuration, your route tables should show the following path information:
| R1#show ip route eigrp 150.2.0.0/24 is subnetted, 1 subnets D 150.2.2.0 [90/2172416] via 10.0.0.2, 01:38:15, Serial0/0 150.3.0.0/24 is subnetted, 1 subnets D 150.3.3.0 [90/2172416] via 10.0.0.6, 00:07:58, Serial0/1 |
| R2#show ip route eigrp 10.0.0.0/30 is subnetted, 3 subnets D 10.0.0.4 [90/2681856] via 10.0.0.1, 00:08:11, Serial0/0 150.1.0.0/24 is subnetted, 1 subnets D 150.1.1.0 [90/2172416] via 10.0.0.1, 01:38:28, Serial0/0 150.3.0.0/24 is subnetted, 1 subnets D 150.3.3.0 [90/2684416] via 10.0.0.1, 00:08:11, Serial0/0 |
| R3#show ip route eigrp 10.0.0.0/30 is subnetted, 3 subnets D 10.0.0.0 [90/21024000] via 10.0.0.5, 00:08:15, Serial1/0 150.1.0.0/24 is subnetted, 1 subnets D 150.1.1.0 [90/20514560] via 10.0.0.5, 00:08:15, Serial1/0 150.2.0.0/24 is subnetted, 1 subnets D 150.2.2.0 [90/21026560] via 10.0.0.5, 00:08:15, Serial1/0 |
| R4#show ip route eigrp 10.0.0.0/30 is subnetted, 2 subnets D 10.0.0.0 [90/2172416] via 150.1.1.1, 01:36:10, FastEthernet0/0 D 10.0.0.4 [90/2172416] via 150.1.1.1, 00:08:19, FastEthernet0/0 150.2.0.0/24 is subnetted, 1 subnets D 150.2.2.0 [90/2174976] via 150.1.1.1, 01:36:10, FastEthernet0/0 150.3.0.0/24 is subnetted, 1 subnets D 150.3.3.0 [90/2174976] via 150.1.1.1, 00:08:18, FastEthernet0/0 |
Task 3
The requirements of this task are quite straightforward. First, an ACL is required to match the Telnet traffic (port 23). This should be forwarded to the Null0 interface, which is a bit bucket. All traffic sent to the Null0 interface is discarded.
The second requirement is that Telnet traffic using port 3023 should be forwarded via Serial 0/1 with an IP Precedence value of 4. This task is completed as follows:
| R1(config)#access-list 100 permit tcp any any eq telnet R1(config)#access-list 101 permit tcp any any eq 3023 R1(config)#route-map LAN-PBR permit 10 R1(config-route-map)#match ip address 100 R1(config-route-map)#set interface null0 %Warning:Use P2P interface for routemap set interface clause R1(config-route-map)#exit |
Next, verify your route map configuration using the show route-map <name> command:
| R1#show route-map LAN-PBR route-map LAN-PBR, permit, sequence 10 Match clauses: ip address (access-lists): 100 Set clauses: interface Null0 Policy routing matches: 0 packets, 0 bytes route-map LAN-PBR, permit, sequence 20 route-map LAN-PBR, deny, sequence 30 |
Following this, test your configuration by attempting to Telnet from R4 to either R2 or R3 using first the default standard port number (23) and then the custom port number (3023). To configure Cisco IOS routers to accept connections on port xx23, e.g. 1023, 2023, 3023, 4023, etc, you simply add the rotary 23 command under the VTY configuration as follows:
| R2(config)#line vty 0 4 R2(config-line)#rotary 23 R2(config-line)#exit |
You can then use the show line vty <line number> command to verify the configuration:
| R2#show line vty 0 Tty Typ Tx/Rx A Modem Roty AccO AccI Uses Noise Overruns Int 66 VTY – – 23 – – 0 0 0/0 – Line 66, Location: “”, Type: “” |
Next, test your configuration by attempting to first Telnet from R4 to either R2 or R3 while you are running PBR debugging:
| R4#telnet 10.0.0.6 Trying 10.0.0.6 … % Connection timed out; remote host not responding |
| R1#debug ip policy Policy routing debugging is on R1# R1# R1# *Jun 3 01:49:36.646: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6, len 44, FIB policy match *Jun 3 01:49:36.646: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6 (Null0), len 44, FIB policy routed(drop) *Jun 3 01:49:38.646: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6, len 44, FIB policy match *Jun 3 01:49:38.646: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6 (Null0), len 44, FIB policy routed(drop) *Jun 3 01:49:42.646: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6, len 44, FIB policy match *Jun 3 01:49:42.646: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6 (Null0), len 44, FIB policy routed(drop) *Jun 3 01:49:50.646: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6, len 44, FIB policy match *Jun 3 01:49:50.646: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6 (Null0), len 44, FIB policy routed(drop) |
Notice that in the output above the traffic is policy routed; however, because it is routed to the Null0 interface, the traffic is essentially dropped, hence the drop in parenthesis (brackets).
Next, initiate a Telnet connection from R4 to R2 or R3, this time using TCP port 3023 instead:
| R4#telnet 10.0.0.6 3023 Trying 10.0.0.6, 3023 … Open
Password required, but none set |
| R1#debug ip policy Policy routing debugging is on R1# R1# R1# *Jun 3 01:47:44.138: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6, len 44, FIB policy match *Jun 3 01:47:44.138: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6 (Serial0/1), len 44, FIB policy routed *Jun 3 01:47:44.150: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6, len 40, FIB policy match *Jun 3 01:47:44.150: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6 (Serial0/1), len 40, FIB policy routed *Jun 3 01:47:44.154: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6, len 40, FIB policy match *Jun 3 01:47:44.154: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6 (Serial0/1), len 40, FIB policy routed *Jun 3 01:47:44.170: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6, len 43, FIB policy match *Jun 3 01:47:44.170: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6 (Serial0/1), len 43, FIB policy routed *Jun 3 01:47:44.170: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6, len 43, FIB policy match *Jun 3 01:47:44.170: IP: s=150.1.1.4 (FastEthernet0/0), d=10.0.0.6 (Serial0/1), len 43, FIB policy routed |
Task 4
To complete this task, the PBR configuration must be applied globally using the ip local policy <route-map-name> global configuration command, otherwise it will not match traffic originated by the router. This task is completed as follows:
| R2(config)#ip access-list extended NO-TELNET-TO-R4-ONLY R2(config-ext-nacl)#permit tcp any host 150.1.1.4 eq 23 R2(config-ext-nacl)#exit R2(config)#route-map LOCAL-PBR-POLICY permit 10 R2(config-route-map)#match ip address NO-TELNET-TO-R4-ONLY R2(config-route-map)#set interface null 0 %Warning:Use P2P interface for routemap set interface clause R2(config-route-map)#exit |
| R3(config)#ip access-list extended NO-TELNET-TO-R4-ONLY R3(config-ext-nacl)#permit tcp any host 150.1.1.4 eq telnet R3(config-ext-nacl)#exit R3(config)#route-map LOCAL-PBR-POLICY permit 10 R3(config-route-map)#match ip address NO-TELNET-TO-R4-ONLY R3(config-route-map)#set interface null 0 %Warning:Use P2P interface for routemap set interface clause R3(config-route-map)#exit |
Next, verify your route map configuration using the show route-map <name> command:
| R2#show route-map LOCAL-PBR-POLICY route-map LOCAL-PBR-POLICY, permit, sequence 10 Match clauses: ip address (access-lists): NO-TELNET-TO-R4-ONLY Set clauses: interface Null0 Policy routing matches: 0 packets, 0 bytes route-map LOCAL-PBR-POLICY, deny, sequence 20 |
| R3#show route-map LOCAL-PBR-POLICY route-map LOCAL-PBR-POLICY, permit, sequence 10 Match clauses: ip address (access-lists): NO-TELNET-TO-R4-ONLY Set clauses: interface Null0 Policy routing matches: 0 packets, 0 bytes route-map LOCAL-PBR-POLICY, deny, sequence 20 |
Finally, test your solution by attempting to Telnet from R2 or R3 to R4 using the standard TCP port number (23). Use the debug ip policy command to view PBR operation real-time:
| R2#debug ip policy Policy routing debugging is on R2# R2# R2# R2#telnet 150.1.1.4 Trying 150.1.1.4 … *May 17 08:26:14.323: IP: route map LOCAL-PBR-POLICY, item 10, permit % Connection timed out; remote host not responding |
Next, attempt to Telnet to R4 using any other port number, for example, using TCP port 3023:
| R2#telnet 150.1.1.4 3023 Trying 150.1.1.4, 3023 … Open
Password required, but none set *May 17 08:28:09.635: IP: s=10.0.0.2 (local), d=150.1.1.4, len 44, policy match [Connection to 150.1.1.4 closed by foreign host] |
Final Router Configurations
R1
|
R1#term len 0 Current configuration : 1320 bytes R1# |
R2
|
R2#term len 0 Current configuration : 1187 bytes R2# |
R3
|
R3#term len 0 Current configuration : 1546 bytes R3# |
R4
|
R4#term len 0 Current configuration : 854 bytes R4# |
