5.2. Configuring RIP

Overview

Function Introduction

Routing Information Protocol (RIP) is an IP route exchange protocol that uses a distance vector (a number representing distance) to measure the cost of a given route. The cost is a distance vector because the cost is often equivalent to the number of router hops between the source and the destination networks. RIP can receive multiple paths to a destination. The system evaluates the paths, selects the best path, and saves the path in the IP route table as the route to the destination. Typically, the best path is the path with the fewest hops. A hop is another router through which packets must travel to reach the destination. If RIP receives a RIP update from another router that contains a path with fewer hops than the path stored in the route table, the system replaces the older route with the newer one. The system then includes the new path in the updates it sends to other RIP routers. RIP routers also can modify a route’s cost, generally by adding to it, to bias the selection of a route for a given destination. In this case, the actual number of router hops may be the same, but the route has an administratively higher cost and is thus less likely to be used than other, lower-cost routes. A RIP route can have a maximum cost of 15. Any destination with a higher cost is considered unreachable. Although limiting to larger networks, the low maximum hop count prevents endless loops in the network.

This chapter contains basic RIP configuration examples. To see details on the commands used in these examples, or to see the outputs of the Validation commands, refer to the RIP Command Reference. To avoid repetition, some Common commands, like configure terminal, have not been listed under the Commands Used section.

Principle Description

Reference to RFC 2453

Configuration

Enabling RIP

image

Fig. 5.2 RIP

step 1 Enter the configure mode

Switch# configure terminal

step 2 Enter the interface configure mode, set the attributes and ip address

Configure on Switch1:

Switch(config)# interface eth-0-1
Switch(config-if)# no switchport
Switch(config-if)# no shutdown
Switch(config-if)# ip address 10.10.10.10/24
Switch(config-if)# exit
Switch(config)# interface eth-0-9
Switch(config-if)# no switchport
Switch(config-if)# no shutdown
Switch(config-if)# ip address 10.10.11.10/24
Switch(config-if)# exit

Configure on Switch2:

Switch(config)# interface eth-0-1
Switch(config-if)# no switchport
Switch(config-if)# no shutdown
Switch(config-if)# ip address 10.10.12.10/24
Switch(config-if)# exit
Switch(config)# interface eth-0-9
Switch(config-if)# no switchport
Switch(config-if)# no shutdown
Switch(config-if)# ip address 10.10.11.50/24
Switch(config-if)# exit

step 3 Enable RIP routing process and associate networks

Configure on Switch1:

Switch(config)# router rip
Switch(config-router)# network 10.10.10.0/24
Switch(config-router)# network 10.10.11.0/24
Switch(config-router)# exit

Configure on Switch2:

Switch(config)# router rip
Switch(config-router)# network 10.10.11.0/24
Switch(config-router)# network 10.10.12.0/24
Switch(config-router)# exit

step 5 Exit the configure mode

Switch(config)# end

step 6 Validation

Use the following command to display the database of rip on Switch1:

Switch# show ip rip database
Codes  R - RIP, Rc - RIP connected, Rs - RIP static, K - Kernel,
C - Connected, S - Static, O - OSPF, I - IS-IS, B - BGP
Network Next Hop Metric From If Time
Rc 10.10.10.0/24 1 eth-0-1
Rc 10.10.11.0/24 1 eth-0-9
R 10.10.12.0/24 10.10.11.50 2 10.10.11.50 eth-0-9 00 02 52

Use the following command to display the protocol state of rip process on Switch1:

Switch# show ip protocols rip
Routing protocol is "rip"
Sending updates every 30 seconds with +/-5 seconds, next due in 17 seconds
Timeout after 180 seconds, Garbage collect after 120 seconds
Outgoing update filter list for all interface is not set
Incoming update filter list for all interface is not set
Default redistribution metric is 1
Redistributing 
Default version control  send version 2, receive version 2
Interface Send Recv Key-chain
eth-0-1   1    1
eth-0-9   1    1
Routing for Networks 
10.10.10.0/24
10.10.11.0/24
Routing Information Sources 
Gateway Distance Last Update Bad Packets Bad Routes
10.10.11.50 120 00 00 22 0 0
Number of routes (including connected)  3
Distance  (default is 120)

Use the following command to display the interface of rip on Switch1:

Switch# show ip rip interface
eth-0-1 is up, line protocol is up
Routing Protocol  RIP
Receive RIP packets
Send RIP packets
Passive interface  Disabled
Split horizon  Enabled with Poisoned Reversed
IP interface address 
10.10.10.10/24
eth-0-9 is up, line protocol is up
Routing Protocol  RIP
Receive RIP packets
Send RIP packets
Passive interface  Disabled
Split horizon  Enabled with Poisoned Reversed
IP interface address 
10.10.11.10/24

Use the following command to display routes on Switch1:

Switch# show ip route
Codes  K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
 [*] - [AD/Metric]
  * - candidate default

C 10.10.10.0/24 is directly connected, eth-0-1
C 10.10.10.10/32 is in local loopback, eth-0-1
C 10.10.11.0/24 is directly connected, eth-0-9
C 10.10.11.10/32 is in local loopback, eth-0-9
R 10.10.12.0/24 [120/2] via 10.10.11.50, eth-0-9, 00 25 50

Configuring The RIP Version

image

Fig. 5.3 RIP Version

Configure the receive and send specific versions of packets on an interface.

In this example, Switch2 is configured to receive and send RIP version 1 and 2 on eth-0-9 and eth-0-20.

step 1 Enter the configure mode

The following commands operate on Switch2:

Switch# configure terminal

step 2 Enable RIP routing process

Switch(config)# router rip
Switch(config-router)# exit

step 3 Enter the interface configure mode and set the version for sending and receiving rip packets

Switch(config)# interface eth-0-9
Switch(config-if)# ip rip send version 1
Switch(config-if)# ip rip receive version 1
Switch(config-if)# quit
Switch(config)# interface eth-0-20
Switch(config-if)# ip rip send version 1
Switch(config-if)# ip rip receive version 1
Switch(config-if)# quit

step 4 Exit the configure mode

Switch(config)# end

step 5 Validation

Use the following command to display the configuration on Switch1:

Switch# show running-config
interface eth-0-9
no switchport
ip address 10.10.11.10/24

 !

router rip
network 10.10.11.0/24

Use the following command to display the database of rip on Switch2:

Switch# show ip rip database
Codes  R - RIP, Rc - RIP connected, Rs - RIP static, K - Kernel,
C - Connected, S - Static, O - OSPF, I - IS-IS, B - BGP
Network Next Hop Metric From If Time
R 10.0.0.0/8 1 eth-0-9
Rc 10.10.11.0/24 1 eth-0-9
Rc 10.10.12.0/24 1 eth-0-20

Use the following command to display the protocol state of rip process on Switch2:

Switch# show ip protocols rip
Routing protocol is "rip"
Sending updates every 30 seconds with +/-5 seconds, next due in 1 seconds

Timeout after 180 seconds, Garbage collect after 120 seconds
Outgoing update filter list for all interface is not set
Incoming update filter list for all interface is not set
Default redistribution metric is 1
Redistributing 
Default version control  send version 2, receive version 2
Interface Send Recv Key-chain
eth-0-9   1     1 
eth-0-20  1     1
Routing for Networks 
10.10.11.0/24
10.10.12.0/24
Routing Information Sources 
Gateway Distance Last Update Bad Packets Bad Routes
10.10.11.10 120 00 00 22 0 0
10.10.12.50 120 00 00 27 0 0
Number of routes (including connected)  3
Distance  (default is 120)

Use the following command to display the interface of rip on Switch2:

Switch# show ip rip interface
eth-0-9 is up, line protocol is up
Routing Protocol  RIP
Receive RIPv1 and RIPv2 packets
Send RIPv1 and RIPv2 packets
Passive interface  Disabled
Split horizon  Enabled with Poisoned Reversed
IP interface address 
10.10.11.50/24
eth-0-20 is up, line protocol is up
Routing Protocol  RIP
Receive RIPv1 and RIPv2 packets
Send RIPv1 and RIPv2 packets
Passive interface  Disabled
Split horizon  Enabled with Poisoned Reversed
IP interface address 
10.10.12.10/24

Use the following command to display the configuration on Switch2:

Switch# show run
interface eth-0-9
no switchport
ip address 10.10.11.50/24
ip rip send version 1
ip rip receive version 1

 !

interface eth-0-20
no switchport
ip address 10.10.12.10/24
ip rip send version 1
ip rip receive version 1

 !

router rip
network 10.10.11.0/24
network 10.10.12.0/24

Use the following command to display the configuration on Switch3:

Switch# show running-config
interface eth-0-20
no switchport
ip address 10.10.12.50/24

 !

router rip
network 10.10.12.0/24

Configuring Metric Parameters

image

Fig. 5.4 Metric Parameters

A RIP offset list allows you to add to the metric of specific inbound or outbound routes learned or advertised by RIP. RIP offset lists provide a simple method for adding to the cost of specific routes and therefore biasing the router’s route selection away from those routes. An offset list consists of the following parameters:

  • An ACL that specifies the routes to which to add the metric. The direction:

  • In: applies to routes the router learns from RIP neighbors.

  • Out: applies to routes the router is advertising to its RIP neighbors.

  • The offset value that will be added to the routing metric of the routes that match the ACL.

  • The interface that the offset list applies (optional).

If a route matches both a global offset list (without specified interface) and an interface-based offset list, the interface-based offset list takes precedence. The interface-based offset list’s metric is added to the route in this case.

This example Switch1 will advertise route 1.1.1.0 out of int eth-0-13 with metric 3.

step 1 precondition

Switch1:

interface eth-0-1
no switchport
ip address 1.1.1.1/24

 !

interface eth-0-9
no switchport
ip address 10.10.11.10/24

 !

interface eth-0-13
no switchport
ip address 13.1.1.1/24

 !

router rip
network 1.1.1.0/24
network 10.10.11.0/24
network 13.1.1.0/24

Switch2:

interface eth-0-9
no switchport
ip address 10.10.11.50/24

 !

interface eth-0-20
no switchport
ip address 10.10.12.10/24

 !

router rip
network 10.10.11.0/24
network 10.10.12.0/24

Switch3:

interface eth-0-13
no switchport
ip address 13.1.1.2/24

 !

interface eth-0-20
no switchport
ip address 10.10.12.50/24

 !

router rip
network 10.10.12.0/24
network 13.1.1.0/24

Display the routes on Switch3:

Switch# show ip route rip
R 1.1.1.0/24 [120/2] via 13.1.1.1, eth-0-13, 00 07 46
R 10.10.11.0/24 [120/2] via 13.1.1.1, eth-0-13, 00 07 39

 [120/2] via 10.10.12.10, eth-0-20, 00 07 39

Change router 1.1.1.0/24 via 10.10.12.10

step 2 Enter the configure mode

The following commands operate on Switch1:

Switch# configure terminal

step 3 Configuring access list

Switch(config)ip# access-list ripoffset
Switch(config-ip-acl)# permit any 1.1.1.0 0.0.0.255 any

step 4 Enable RIP routing process and set offset list and offset value for an interface

Switch(config-ip-acl)# router rip
Switch(config-router)# offset-list ripoffset out 3 eth-0-13

step 5 Exit the configure mode

Switch(config-router)# end

step 6 Validation

Display the routes on Switch3. The metric for the route which distributed by Switch1 is 3 now.

Switch# show ip route rip
R 1.1.1.0/24 [120/3] via 10.10.12.10, eth-0-20, 00 00 02
R 10.10.11.0/24 [120/2] via 13.1.1.1, eth-0-13, 00 11 40

 [120/2] via 10.10.12.10, eth-0-20, 00 11 40

Configuring the Administrative Distance

image

Fig. 5.5 Administrative Distance

By default, RIP assigns the default RIP administrative distance (120) to RIP routes. When comparing routes based on administrative distance, the router selects the route with the lower distance. You can change the administrative distance for RIP routes.

This example all Switches have two router protocols, RIP and OSPF, OSPF route has higher priority, Switch3 will change route 1.1.1.0 with administrative distance 100.

step 1 precondition

Switch1:

interface eth-0-1
no switchport
ip address 1.1.1.1/24

 !

interface eth-0-9
no switchport
ip address 10.10.11.10/24

 !

router ospf
network 1.1.1.0/24 area 0
network 10.10.11.0/24 area 0

 !

router rip
network 1.1.1.0/24
network 10.10.11.0/24

Switch2:

interface eth-0-9
no switchport
ip address 10.10.11.50/24

 !

interface eth-0-20
no switchport
ip address 10.10.12.10/24

 !

router ospf
network 10.10.11.0/24 area 0
network 10.10.12.0/24 area 0

 !

router rip
network 10.10.11.0/24
network 10.10.12.0/24

Switch3:

interface eth-0-20
no switchport
ip address 10.10.12.50/24

 !

router ospf
network 10.10.12.0/24 area 0

 !

router rip
network 10.10.12.0/24

Display the routes on Switch3:

Switch# show ip route
Codes  K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
 [*] - [AD/Metric]
 * - candidate default

O 1.1.1.0/24 [110/3] via 10.10.12.10, eth-0-20, 01 05 49
O 10.10.11.0/24 [110/2] via 10.10.12.10, eth-0-20, 01 05 49
C 10.10.12.0/24 is directly connected, eth-0-20
C 10.10.12.50/32 is in local loopback, eth-0-20

step 2 Enter the configure mode

The following commands operate on Switch3:

Switch# configure terminal

step 3 Configuring access list

Switch(config)# ip access-list ripdistancelist
Switch(config-ip-acl)# permit any 1.1.1.0 0.0.0.255 any

step 4 Enable RIP routing process and set administrative distance

Switch(config-ip-acl)# router rip
Switch(config-router)# distance 100 0.0.0.0/0 ripdistancelist

step 5 Exit the configure mode

Switch(config-router)# end

step 6 Validation

Display the routes on Switch3. The distance for the rip route is 100 now.

Switch# show ip route
Codes  K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
 [*] - [AD/Metric]
  * - candidate default

R 1.1.1.0/24 [100/3] via 10.10.12.10, eth-0-20, 00 00 02
O 10.10.11.0/24 [110/2] via 10.10.12.10, eth-0-20, 01 10 42
C 10.10.12.0/24 is directly connected, eth-0-20
C 10.10.12.50/32 is in local loopback, eth-0-20

Configuring Redistribution

image

Fig. 5.6 Redistribution

You can configure the router to redistribute static routes, direct connected routes or routes learned through Open Shortest Path First (OSPF) into RIP. When you redistribute a route from one of these other protocols into RIP, the router can use RIP to advertise the route to its RIP neighbors.

Change the default redistribution metric (optional). The router assigns a RIP metric of 1 to each redistributed route by default. You can change the default metric to a value up to 16.

Enable specified routes to redistribute with default or specified metric. This example the router will set the default metric to 2 for redistributed routes and redistributes static routes and direct connected routes to RIP with default metric 2, redistributes OSPF routes with specified metric 5.

step 1 precondition

Switch1:

interface eth-0-9
no switchport
ip address 10.10.11.10/24

 !

router rip
network 10.10.11.0/24

Switch2:

interface eth-0-1
no switchport
ip address 2.2.2.2/24

 !

interface eth-0-9
no switchport
ip address 10.10.11.50/24

 !

interface eth-0-20
no switchport
ip address 10.10.12.10/24

 !

router ospf
network 10.10.12.0/24 area 0

 !

router rip
network 10.10.11.0/24

 !

ip route 20.20.20.0/24 10.10.12.50

Switch3:

interface eth-0-1
no switchport
ip address 3.3.3.3/24

 !

interface eth-0-2
no switchport
ip address 20.20.20.20/24

 !

interface eth-0-20
no switchport
ip address 10.10.12.50/24

 !

router ospf
network 3.3.3.0/24 area 0
network 10.10.12.0/24 area 0

Display the routes on Switch1:

Switch# show ip route
Codes  K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
 [*] - [AD/Metric]
  * - candidate default
C 10.10.11.0/24 is directly connected, eth-0-9
C 10.10.11.10/32 is in local loopback, eth-0-9

Display the routes on Switch2:

Switch# show ip route
Codes  K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
 [*] - [AD/Metric]
  * - candidate default

C 2.2.2.0/24 is directly connected, eth-0-1
C 2.2.2.02/32 is in local loopback, eth-0-1
O 3.3.3.0/24 [110/2] via 10.10.12.50, eth-0-20, 01 05 41
C 10.10.11.0/24 is directly connected, eth-0-9
C 10.10.11.50/32 is in local loopback, eth-0-9
C 10.10.12.0/24 is directly connected, eth-0-20
C 10.10.12.10/24 is in local loopback, eth-0-20
S 20.20.20.0/24 [1/0] via 10.10.12.50, eth-0-20

step 2 Enter the configure mode

The following commands operate on Switch2:

Switch# configure terminal

step 3 Enable RIP routing process and set metric and enable redistribute

Switch(config)# router rip
Switch(config-router)# default-metric 2
Switch(config-router)# redistribute static
Switch(config-router)# redistribute connected
Switch(config-router)# redistribute ospf metric 5

Redistribute connected routes by ospf (optional):

Switch(config)# router ospf
Switch(config-router)# redistribute connected

step 4 Exit the configure mode

Switch(config-router)# end

step 5 Validation

Display the routes on Switch1:

Switch# show ip route
Codes  K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
[*] - [AD/Metric]
 * - candidate default

R 2.2.2.0/24 [120/3] via 10.10.11.50, eth-0-9, 00 02 36
R 3.3.3.0/24 [120/6] via 10.10.11.50, eth-0-9, 00 02 26
C 10.10.11.0/24 is directly connected, eth-0-9
C 10.10.11.10/32 is in local loopback eth-0-9
R 10.10.12.0/24 [120/3] via 10.10.11.50, eth-0-9, 00 02 36
R 20.20.20.0/24 [120/3] via 10.10.11.50, eth-0-9, 00 02 41

Configuring Split-horizon Parameters

image

Fig. 5.7 Split-horizon Parameters

Normally, routers that are connected to broadcast-type IP networks and that use distance-vector routing protocols employ the split horizon mechanism to reduce the possibility of routing loops. Split horizon blocks information about routes from being advertised by a router out of any interface from which that information originated. This behavior usually optimizes communications among multiple routers, particularly when links are broken. However, with non-broadcast networks (such as Frame Relay), situations can arise for which this behavior is less than ideal. For these situations, you might want to disable split horizon for RIP.

You can avoid including routes in updates sent to the same gateway from which they were learned. Using the split horizon command omits routes learned from one neighbor, in updates sent to that neighbor. Using the poisoned parameter with this command includes such routes in updates, but sets their metrics to infinity. Thus, advertising these routes means that they are not reachable.

step 1 precondition

Switch1:

interface eth-0-1
no switchport
ip address 1.1.1.1/24

 !

interface eth-0-9
no switchport
ip address 10.10.11.10/24

 !

router rip
network 10.10.11.0/24
redistribute connected

Switch2:

interface eth-0-9
no switchport
ip address 10.10.11.50/24

 !

router rip
network 10.10.11.0/24

step 2 Enabling debug on Switch2 (optional)

Switch# debug rip packet send detail
Switch# terminal monitor

step 3 Enter the configure mode

The following commands operate on Switch2:

Switch# configure terminal

step 4 Enter the interface configure mode and set split-horizon

Disable Split-horizon:

Switch(config)interface# eth-0-9
Switch(config-if)# no ip rip split-horizon

If debug is enabled, the following messages will be shown:

Apr 8 06 24 25 Switch RIP4-7  SEND[eth-0-9]  Send to 224.0.0.9 520

Apr 8 06 24 25 Switch RIP4-7  SEND[eth-0-9]  RESPONSE version 2
packet size 44

Apr 8 06 24 25 Switch RIP4-7  1.1.1.0/24 -> 0.0.0.0 family 2 tag 0
metric 2

Apr 8 06 24 25 Switch RIP4-7  10.10.11.0/24 -> 0.0.0.0 family 2
tag 0 metric 1

Enable Split-horizon and poisoned:

Switch(config-if)# ip rip split-horizon
Switch(config-if)# ip rip split-horizon poisoned

If debug is enabled, the following messages will be shown:

Apr 8 06 38 35 Switch RIP4-7  SEND[eth-0-9]  Send to 224.0.0.9 520

Apr 8 06 38 35 Switch RIP4-7  SEND[eth-0-9]  RESPONSE version 2
packet size 44
Apr 8 06 38 35 Switch RIP4-7  1.1.1.0/24 -> 0.0.0.0 family 2 tag 0
metric 16

Apr 8 06 38 35 Switch RIP4-7  10.10.11.0/24 -> 0.0.0.0 family 2
tag 0 metric 16

step 5 Exit the configure mode

Switch(config-router)# end

step 6 Validation

Use the following command to display the configuration:

Switch# show running-config
interface eth-0-9
no switchport
ip address 10.10.11.50/24

 !

router rip
network 10.10.11.0/24

 !

Use the following command to display the interface of rip:

Switch# show ip rip interface
eth-0-9 is up, line protocol is up
Routing Protocol  RIP
Receive RIP packets
Send RIP packets
Passive interface  Disabled
Split horizon  Enabled with Poisoned Reversed
IP interface address 
10.10.11.50/24

Configuring Timers

RIP use several timers that determine such variables as the frequency of routing updates, the length of time before a route becomes invalid, and other parameters. You can adjust these timers to tune RIP performance to better suit your internet-work needs. You can make the following timer adjustments:

  • The rate (time in seconds between updates) at which routing updates are sent.

  • The interval of time (in seconds) after which a route is declared invalid.

  • The amount of time (in seconds) that must pass before a route is removed from the routing table.

step 1 Enter the configure mode

Switch# configure terminal

step 2 Enable RIP routing process and set the timers

Specify the routing table update timer in 10 seconds. Specifies the routing information timeout timer in 180 seconds. Specifies the routing garbage collection timer in 120 seconds:

Switch(config)# router rip
Switch(config-router)# timers basic 10 180 120

step 3 Exit the configure mode

Switch(config-router)# end

step 4 Validation

Use the following command to display the protocol state of rip process:

Switch# show ip protocols rip
Routing protocol is "rip"
Sending updates every 10 seconds with +/-5 seconds, next due in 2 seconds
Timeout after 180 seconds, Garbage collect after 120 seconds
Outgoing update filter list for all interface is not set
Incoming update filter list for all interface is not set
Default redistribution metric is 1
Redistributing 
Default version control  send version 2, receive version 2
Interface Send Recv Key-chain
eth-0-9 2 2
Routing for Networks 
10.10.11.0/24
Routing Information Sources 
Gateway Distance Last Update Bad Packets Bad Routes
10.10.11.50 120 00 00 02 0 0
Number of routes (including connected)  5
Distance  (default is 120)

Configuring RIP Route Distribute Filters

image

Fig. 5.8 RIP Route Distribute Filters

A RIP distribute list allows you to permit or deny learning or advertising of specific routes. A distribute list consists of the following parameters:

  • An ACL or a prefix list that filter the routes.

  • The direction:

In: filter applies to learned routes.

Out: filter applies to advertised routes - The interface that the filer applies (optional).

step 1 precondition

Switch1:

interface eth-0-9
no switchport
ip address 10.10.11.10/24

 !

router rip
network 10.10.11.0/24

Switch2:

interface eth-0-1
no switchport
ip address 1.1.1.1/24

 !

interface eth-0-2
no switchport
ip address 2.2.2.2/24

 !

interface eth-0-3
no switchport
ip address 3.3.3.3/24

 !

interface eth-0-9
no switchport
ip address 10.10.11.50/24

 !

router rip
network 1.1.1.0/24
network 2.2.2.0/24
network 3.3.3.0/24
network 10.10.11.0/24

Display the routes on Switch1:

Switch# show ip route
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
 [*] - [AD/Metric]
  * - candidate default

R 1.1.1.0/24 [120/2] via 10.10.11.50, eth-0-9, 00:01:50
R 2.2.2.0/24 [120/2] via 10.10.11.50, eth-0-9, 00:01:50
R 3.3.3.0/24 [120/2] via 10.10.11.50, eth-0-9, 00:01:50
C 10.10.11.0/24 is directly connected, eth-0-9
C 10.10.11.10/32 is in local loopback, eth-0-9

step 2 Enter the configure mode

The following commands operate on Switch2:

Switch# configure terminal

step 3 Configuring prefix list

Switch(config)# ip prefix-list 1 deny 1.1.1.0/24
Switch(config)# ip prefix-list 1 permit any

step 4 Apply prefix list

Switch(config)# router rip
Switch(config-router)# distribute-list prefix 1 out

step 5 Exit the configure mode

Switch(config-router)# end

step 6 Validation

Display the routes on Switch1:

Switch# show ip route
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
 [*] - [AD/Metric]
  * - candidate default

R 2.2.2.0/24 [120/2] via 10.10.11.50, eth-0-9, 00:00:08
R 3.3.3.0/24 [120/2] via 10.10.11.50, eth-0-9, 00:00:08
C 10.10.11.0/24 is directly connected, eth-0-9
C 10.10.11.10/32 is in local loopback, eth-0-9

Configuring RIPv2 authentication (single key)

image

Fig. 5.9 RIPv2 authentication

RIPv2 supports 2 authentication methods: plaintext and MD5 encryption.

The following example shows how to enable plaintext authentication.

To using this feature, the following steps are required:

  • Specify an interface and set the authentication string

  • Specify the authentication mode as “text”

step 1 Enter the configure mode

Switch# configure terminal

step 2 Enter the interface configure mode, set the attributes and ip address

Switch1:

Switch(config)# interface eth-0-1
Switch(config-if)# no switchport
Switch(config-if)# no shutdown
Switch(config-if)# ip address 1.1.1.1/24
Switch(config-if)# exit
Switch(config-if)# interface eth-0-9
Switch(config-if)# no switchport
Switch(config-if)# no shutdown
Switch(config-if)# ip address 10.10.11.10/24
Switch(config-if)# exit

Switch2:

Switch(config)# interface eth-0-1
Switch(config-if)# no switchport
Switch(config-if)# no shutdown
Switch(config-if)# ip address 2.2.2.2/24
Switch(config-if)# exit
Switch(config-if)# interface eth-0-9
Switch(config-if)# no switchport
Switch(config-if)# no shutdown
Switch(config-if)# ip address 10.10.11.50/24
Switch(config-if)# exit

step 3 Enable RIP routing process and set the parameters

Switch(config)# router rip
Switch(config-router)# network 10.10.11.0/24
Switch(config-router)# redistribute connected
Switch(config-router)# exit

step 4 Specify the authentication string and mode

Switch(config)# interface eth-0-9
Switch(config-if)# ip rip authentication string Auth1
Switch(config-if)# ip rip authentication mode text

step 5 Exit the configure mode

Switch(config-if)# end

step 6 Validation

Use the following command to display the database of rip:

Switch# show ip rip database
Codes: R - RIP, Rc - RIP connected, Rs - RIP static, K - Kernel,
C - Connected, S - Static, O - OSPF, I - IS-IS, B - BGP
Network Next Hop Metric From If Time
R 2.2.2.0/24 10.10.11.50 2 10.10.11.50 eth-0-9 00:02:52
Rc 10.10.11.0/24

Use the following command to display the protocol state of rip process:

Switch# show ip protocols rip
Routing protocol is "rip"
Sending updates every 30 seconds with +/-5 seconds, next due in 23 seconds

Timeout after 180 seconds, Garbage collect after 120 seconds
Outgoing update filter list for all interface is not set
Incoming update filter list for all interface is not set
Default redistribution metric is 1
Redistributing:
connected metric default
Default version control: send version 2, receive version 2
Interface Send Recv Key-chain
eth-0-9 2 2
Routing for Networks:
10.10.11.0/24
Routing Information Sources:
Gateway Distance Last Update Bad Packets Bad Routes
10.10.11.50 120 00:00:45 1 0
Number of routes (including connected): 2
Distance: (default is 120)
Switch# show ip rip interface
eth-0-9 is up, line protocol is up
Routing Protocol: RIP
Receive RIP packets
Send RIP packets
Passive interface: Disabled
Split horizon: Enabled with Poisoned Reversed
IP interface address:
10.10.11.10/24

Use the following command to display the interface of rip:

Switch# show ip route
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

Dc - DHCP Client

 [*] - [AD/Metric]
  * - candidate default

R 2.2.2.0/24 [120/2] via 10.10.11.50, eth-0-9, 00:02:28
C 10.10.11.0/24 is directly connected, eth-0-9
C 10.10.11.10/32 is in local loopback, eth-0-9

Configuring RIPv2 MD5 authentication (multiple keys)

image

Fig. 5.10 RIPv2 authentication

This example illustrates the md5 authentication of the routing information exchange process for RIP using multiple keys. Switch1 and B are running RIP and exchange routing updates. To configure authentication on Switch1, define a key chain, specify keys in the key chain and then define the authentication string or passwords to be used by the keys. Then set the time period during which it is valid to receive or send the authentication key by specifying the accept and send lifetimes.[optional].After defining the key string, specify the key chain (or the set of keys) that will be used for authentication on the interface and the authentication mode to be used. Configure Switch1 and B to have the same key ID and key string as Switch1 for the time that updates need to be exchanged.

In md5 authentication, both the key ID and key string are matched for authentication. R1 will receive only packets that match both the key ID and the key string in the specified key chain (within the accept lifetime) on that interface In the following example, Switch2 has the same key ID and key string as Switch1. For additional security, the accept lifetime and send lifetime are configured such that every fifth day the key ID and key string changes. To maintain continuity, the accept lifetimes should be configured to overlap; however, the send lifetime should not be overlapping.

step 1 Enter the configure mode

Switch# configure terminal

step 2 Enter the interface configure mode, set the attributes and ip address

Switch1:

Switch(config)# interface eth-0-1
Switch(config-if)# no switchport
Switch(config-if)# no shutdown
Switch(config-if)# ip address 1.1.1.1/24
Switch(config-if)# exit
Switch(config-if)# interface eth-0-9
Switch(config-if)# no switchport
Switch(config-if)# no shutdown
Switch(config-if)# ip address 10.10.11.10/24
Switch(config-if)# exit

Switch2:

Switch(config)# interface eth-0-1
Switch(config-if)# no switchport
Switch(config-if)# no shutdown
Switch(config-if)# ip address 2.2.2.2/24
Switch(config-if)# exit
Switch(config-if)# interface eth-0-9
Switch(config-if)# no switchport
Switch(config-if)# no shutdown
Switch(config-if)# ip address 10.10.11.50/24
Switch(config-if)# exit

step 3 Enable RIP routing process and set the parameters

Switch(config)# router rip
Switch(config-router)# network 10.10.11.0/24
Switch(config-router)# redistribute connected
Switch(config-router)# exit

step 4 Create a key chain and set the key string and lifetime

Switch(config)# key chain SUN
Switch(config-keychain)# key 1
Switch(config-keychain-key)# key-string key1
Switch(config-keychain-key)# accept-lifetime 12:00:00 Mar 2 2023 14:00:00 Mar 7 2023
Switch(config-keychain-key)# send-lifetime 12:00:00 Mar 2 2023 12:00:00 Mar 7 2023
Switch(config-keychain-key)# exit

Another key (optional):

Switch(config-keychain)# key 2
Switch(config-keychain-key)# key-string Earth
Switch(config-keychain-key)# accept-lifetime 12:00:00 Mar 7 2023 14:00:00 Mar 12 2023
Switch(config-keychain-key)# send-lifetime 12:00:00 Mar 7 2023 12:00:00 Mar 12 2023
Switch(config-keychain-key)# exit

Exit the keychain configure mode:

Switch(config-keychain)# exit

step 5 Specify the authentication string and mode

Switch(config)# interface eth-0-9
Switch(config-if)# ip rip authentication key-chain SUN
Switch(config-if)# ip rip authentication mode md5

step 6 Exit the configure mode

Switch(config-if)# end

step 7 Validation

Use the following command to display the database of rip:

Switch# show ip rip database
Codes: R - RIP, Rc - RIP connected, Rs - RIP static, K - Kernel,
C - Connected, S - Static, O - OSPF, I - IS-IS, B - BGP
Network Next Hop Metric From If Time
R 2.2.2.0/24 10.10.11.50 2 10.10.11.50 eth-0-9 00:01:10
Rc 10.10.11.0/24 1 eth-0-9

Use the following command to display the protocol state of rip process:

Switch# show ip protocols rip
Routing protocol is "rip"
Sending updates every 30 seconds with +/-5 seconds, next due in 17 seconds

Timeout after 180 seconds, Garbage collect after 120 seconds
Outgoing update filter list for all interface is not set
Incoming update filter list for all interface is not set
Default redistribution metric is 1
Redistributing:
connected metric default
Default version control: send version 2, receive version 2
Interface Send Recv Key-chain
eth-0-9 2 2 SUN
Routing for Networks:
10.10.11.0/24
Routing Information Sources:
Gateway Distance Last Update Bad Packets Bad Routes
Number of routes (including connected): 2
Distance: (default is 120)

Use the following command to display the interface of rip:

Switch# show ip rip interface
eth-0-9 is up, line protocol is up
Routing Protocol: RIP
Receive RIP packets
Send RIP packets
Passive interface: Disabled
Split horizon: Enabled with Poisoned Reversed
IP interface address:
10.10.11.10/24

Use the following command to display routes on the device:

Switch# show ip route
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

Dc - DHCP Client

 [*] - [AD/Metric]
  * - candidate default

C 1.1.1.0/24 is directly connected, eth-0-1
C 1.1.1.1/32 is in local loopback, eth-0-1
R 2.2.2.0/24 [120/2] via 10.10.11.50, eth-0-9, 00:02:27
C 10.10.11.0/24 is directly connected, eth-0-9
C 10.10.11.10/32 is in local loopback, eth-0-9

Use the following command to display key chain:

Switch# show key chain
key chain SUN:
key 1 -- text "key1"
accept-lifetime <12:00:00 Mar 02 2023> - <14:00:00 Mar 07 2023>
send-lifetime <12:00:00 Mar 02 2023> - < 12:00:00 Mar 07 2023>
key 2 -- text "Earth"
accept-lifetime <12:00:00 Mar 07 2023> - <14:00:00 Mar 12 2023>
send-lifetime <12:00:00 Mar 07 2023> - < 12:00:00 Mar 12 2023>
Switch#

Application cases

N/A