# RIP - Routing Information Protocol

> Configure RIP on VyOS: RIPv2, RIPng, authentication, timers, redistribution, and dynamic routing for small networks in Yandex Cloud and VK Cloud

Source: https://opennix.org/en/docs/vyos/routing/vyos-rip/


RIP (Routing Information Protocol) is one of the oldest dynamic routing protocols and relies on the distance-vector algorithm.

## Overview

RIP is a simple routing protocol suited to small networks with a predictable topology.

### RIP Characteristics

**Key parameters**:
- Distance-vector algorithm (Bellman-Ford)
- Metric is hop count (the number of routers to a network)
- Maximum of 15 hops (16 = unreachable)
- Periodic updates every 30 seconds
- Split horizon and poison reverse to prevent loops

**Protocol versions**:
- **RIPv1** (RFC 1058) - classful, no VLSM, broadcast updates
- **RIPv2** (RFC 2453) - classless, VLSM, CIDR, multicast (224.0.0.9), authentication
- **RIPng** (RFC 2080) - for IPv6 networks, multicast (FF02::9)

### When to Use RIP

**Suitable for**:
- Small networks (up to 15 routers)
- Simple topologies (no redundancy)
- Legacy equipment
- Training labs
- Temporary test networks

**Not suitable for**:
- Large enterprise networks
- Networks with redundant paths
- High-load networks
- Networks that require fast convergence

### RIP Limitations

1. **Hop count limit** - a maximum of 15 routers
2. **Slow convergence** - up to 3 minutes
3. **Periodic updates** - generate constant traffic
4. **Simple metric** - does not account for bandwidth or latency
5. **No VLSM support** in RIPv1

## RIPv2 Configuration

VyOS uses RIPv2 by default.

### Basic Configuration

**Minimal configuration**:
```
set protocols rip interface eth0
set protocols rip interface eth1
set protocols rip network 192.168.1.0/24
set protocols rip network 192.168.2.0/24

commit
save
```

**Network statement**:
```
set protocols rip network 10.0.0.0/8
set protocols rip network 172.16.0.0/12
set protocols rip network 192.168.0.0/16

commit
```

A network statement includes every interface whose IP falls within the specified networks in the RIP process.

### Interface Configuration

**Enable RIP on an interface**:
```
set protocols rip interface eth0
set protocols rip interface eth1
commit
```

**Exclude an interface**:
```
delete protocols rip interface eth2
commit
```

### RIP Version

**Set the RIP version**:
```
set protocols rip version 2
commit
```

By default, VyOS uses RIPv2.

### Neighbor Configuration

**Unicast neighbor** (instead of multicast):
```
set protocols rip neighbor 192.168.1.2
set protocols rip neighbor 192.168.2.2
commit
```

Useful for:
- Point-to-point links
- Networks where multicast is unavailable
- VPN tunnels

### Passive Interface

The interface advertises its network but does not send RIP updates.

**Per-interface**:
```
set protocols rip interface eth2 passive
commit
```

**All interfaces passive by default**:
```
set protocols rip passive-interface default
commit
```

Then activate the ones you need:
```
set protocols rip passive-interface eth0 disable
set protocols rip passive-interface eth1 disable
commit
```

**Recommendation**: Use passive mode for LAN interfaces that have no RIP neighbors.

## Authentication

Protection against unauthorized RIP updates.

### Plaintext Authentication

**Not recommended** (the password is sent in cleartext):

```
set interfaces ethernet eth0 ip rip authentication plaintext-password 'MyPassword'
commit
```

Use it only for compatibility with legacy devices.

### MD5 Authentication

**Recommended**:

```
set interfaces ethernet eth0 ip rip authentication md5 1 password 'SecureRIPPassword123!'
commit
```

The **Key ID** (1-255) allows a smooth password rotation:

```
# Old key
set interfaces ethernet eth0 ip rip authentication md5 1 password 'OldPassword'

# Add the new key
set interfaces ethernet eth0 ip rip authentication md5 2 password 'NewPassword'
commit

# After updating all routers, remove the old one
delete interfaces ethernet eth0 ip rip authentication md5 1
commit
```

**Important**: Authentication must match on all neighboring routers.

### Authentication Example

**Router 1**:
```
set interfaces ethernet eth1 ip rip authentication md5 1 password 'RIP-Secure-2024'
commit
```

**Router 2**:
```
set interfaces ethernet eth1 ip rip authentication md5 1 password 'RIP-Secure-2024'
commit
```

## Split Horizon

A mechanism for preventing routing loops.

### Default Split Horizon

Enabled by default:
```
# The router does not advertise routes back through the interface it learned them from
```

### Disable Split Horizon

```
set interfaces ethernet eth0 ip rip split-horizon disable
commit
```

**When to disable it**:
- Hub-and-spoke topologies
- Frame Relay NBMA networks
- Some VPN configurations

### Poison Reverse

An aggressive version of split horizon:

```
set interfaces ethernet eth0 ip rip split-horizon poison-reverse
commit
```

Advertises routes back with a metric of 16 (unreachable).

**When to use it**:
- Faster convergence on failures
- Explicitly signaling that a route is unreachable

## Timers

Controlling RIP timers for convergence.

### Update Timer

The interval for sending RIP updates:

```
set protocols rip timers update 30
commit
```

Default: 30 seconds.

**A lower value**:
- Faster convergence
- More traffic
- Higher CPU usage

### Timeout Timer

The time to wait for an update from a neighbor:

```
set protocols rip timers timeout 180
commit
```

Default: 180 seconds (6x the update timer).

After the timeout, the route is marked unreachable (metric 16).

### Garbage Collection Timer

The time before an unreachable route is removed:

```
set protocols rip timers garbage-collection 120
commit
```

Default: 120 seconds.

### Timers Configuration Example

```
set protocols rip timers update 30
set protocols rip timers timeout 180
set protocols rip timers garbage-collection 120

commit
save
```

**Aggressive timers** (for fast convergence):
```
set protocols rip timers update 10
set protocols rip timers timeout 60
set protocols rip timers garbage-collection 40

commit
```

**Caution**: Shorter timers increase the load on the network and the CPU.

## Route Redistribution

Importing routes from other sources into RIP.

### Redistribute Connected

Advertise directly connected networks:

```
set protocols rip redistribute connected
commit
```

**With a metric**:
```
set protocols rip redistribute connected metric 2
commit
```

### Redistribute Static

Advertise static routes:

```
set protocols rip redistribute static
commit
```

**With a metric**:
```
set protocols rip redistribute static metric 3
commit
```

### Redistribute OSPF

Import OSPF routes into RIP:

```
set protocols rip redistribute ospf
commit
```

**With a metric**:
```
set protocols rip redistribute ospf metric 5
commit
```

### Redistribute BGP

Import BGP routes:

```
set protocols rip redistribute bgp
commit
```

**Caution**: A BGP full table (900K+ routes) is not suitable for RIP (a limit of 15 hops).

### Redistribute Kernel

Kernel routes (e.g., from DHCP):

```
set protocols rip redistribute kernel
commit
```

### Route-map for Selective Redistribution

**Create a route-map**:
```
set policy route-map STATIC-TO-RIP rule 10 action permit
set policy route-map STATIC-TO-RIP rule 10 match ip address prefix-list ALLOWED-NETWORKS

set policy prefix-list ALLOWED-NETWORKS rule 10 action permit
set policy prefix-list ALLOWED-NETWORKS rule 10 prefix 192.168.0.0/16 le 24

commit
```

**Apply it to redistribution**:
```
set protocols rip redistribute static route-map STATIC-TO-RIP
commit
```

### Metric for Redistribution

**Default**: metric 1 (for all redistributed routes).

**Set a custom metric**:
```
set protocols rip redistribute connected metric 2
set protocols rip redistribute static metric 3
set protocols rip redistribute ospf metric 5
commit
```

## Default Information Originate

Advertising a default route (0.0.0.0/0) into RIP.

### Basic Default Route

```
set protocols rip default-information originate
commit
```

Advertises the default route **only if** it exists in the routing table.

**Create a static default route**:
```
set protocols static route 0.0.0.0/0 next-hop 203.0.113.1
commit
```

### Always Originate

Always advertise the default route (even if it is not in the routing table):

```
set protocols rip default-information originate always
commit
```

### Default Route Example

**Internet Gateway Router**:
```
# Static default route to the ISP
set protocols static route 0.0.0.0/0 next-hop 198.51.100.1

# Advertise into RIP
set protocols rip default-information originate

commit
save
```

**Branch routers** will receive the default route automatically.

## Distance (Administrative Distance)

The priority of RIP routes relative to other protocols.

### Default Distance

**RIP default distance**: 120 (higher than OSPF at 110, lower than eBGP at 20).

### Change RIP Distance

```
set protocols rip distance 130
commit
```

**A lower value** means a higher priority:
- Connected: 0
- Static: 1
- eBGP: 20
- OSPF: 110
- **RIP: 120**
- iBGP: 200

### Network-specific Distance

```
set protocols rip network-distance 192.168.10.0/24 distance 90
commit
```

Set a custom distance for a specific network.

### Distance Example

```
# Prefer OSPF over RIP
set protocols ospf distance global 110
set protocols rip distance 120

# Except for a specific network - prefer RIP
set protocols rip network-distance 10.10.0.0/16 distance 80

commit
```

## Access List (Distribute List)

Filtering RIP routes.

### Inbound Filter

**Filter incoming updates**:

```
set policy access-list 10 rule 10 action permit
set policy access-list 10 rule 10 source any
set policy access-list 10 rule 10 destination 192.168.0.0/16

set protocols rip distribute-list interface eth0 access-list in 10

commit
```

Accept only routes from 192.168.0.0/16.

### Outbound Filter

**Filter outgoing updates**:

```
set policy access-list 20 rule 10 action deny
set policy access-list 20 rule 10 source any
set policy access-list 20 rule 10 destination 10.0.0.0/8

set policy access-list 20 rule 20 action permit
set policy access-list 20 rule 20 source any
set policy access-list 20 rule 20 destination any

set protocols rip distribute-list interface eth1 access-list out 20

commit
```

Do not advertise 10.0.0.0/8; advertise everything else.

### Prefix-list Filter

**More flexible filtering**:

```
set policy prefix-list ALLOWED-IN rule 10 action permit
set policy prefix-list ALLOWED-IN rule 10 prefix 192.168.0.0/16 le 24

set protocols rip distribute-list interface eth0 prefix-list in ALLOWED-IN

commit
```

Accept 192.168.0.0/16 and all subnets down to /24.

## RIPng (IPv6)

RIPng is RIP for IPv6 networks.

### RIPng Overview

**Characteristics**:
- Distance-vector for IPv6
- Multicast FF02::9
- UDP port 521 (vs 520 for RIPv2)
- Logic similar to RIPv2
- Hop count limit of 15

**Usage**:
- Small IPv6 networks
- Legacy IPv6 routing (modern networks use OSPFv3/BGP)

### RIPng Basic Configuration

**Router 1**:
```
set protocols ripng interface eth0
set protocols ripng interface eth1
set protocols ripng network 2001:db8:1::/64
set protocols ripng network 2001:db8:2::/64

commit
save
```

**Router 2**:
```
set protocols ripng interface eth0
set protocols ripng interface eth2
set protocols ripng network 2001:db8:1::/64
set protocols ripng network 2001:db8:3::/64

commit
save
```

### RIPng Timers

```
set protocols ripng timers update 30
set protocols ripng timers timeout 180
set protocols ripng timers garbage-collection 120

commit
```

### RIPng Redistribution

**Connected networks**:
```
set protocols ripng redistribute connected
commit
```

**Static routes**:
```
set protocols ripng redistribute static
commit
```

**OSPFv3**:
```
set protocols ripng redistribute ospfv3
commit
```

### RIPng Default Route

```
set protocols ripng default-information originate
commit
```

### RIPng Aggregate Address

Summarizing IPv6 prefixes:

```
set protocols ripng aggregate-address 2001:db8::/32
commit
```

### RIPng Passive Interface

```
set protocols ripng interface eth2 passive
commit
```

### RIPng Split Horizon

```
set interfaces ethernet eth0 ipv6 ripng split-horizon disable
commit
```

**Poison reverse**:
```
set interfaces ethernet eth0 ipv6 ripng split-horizon poison-reverse
commit
```

## Configuration Examples

### Simple Two-Router RIP Network

**Topology**:
```
[Router1: eth0 192.168.1.1/24] --- [eth1 10.0.0.1/30 - 10.0.0.2/30 eth1] --- [Router2: eth0 192.168.2.1/24]
```

**Router 1**:
```
# Interfaces
set interfaces ethernet eth0 address 192.168.1.1/24
set interfaces ethernet eth1 address 10.0.0.1/30

# RIP
set protocols rip interface eth0
set protocols rip interface eth1

set protocols rip network 192.168.1.0/24
set protocols rip network 10.0.0.0/30

# Authentication
set interfaces ethernet eth1 ip rip authentication md5 1 password 'RipSecure2024!'

# Passive on the LAN
set protocols rip interface eth0 passive

commit
save
```

**Router 2**:
```
# Interfaces
set interfaces ethernet eth0 address 192.168.2.1/24
set interfaces ethernet eth1 address 10.0.0.2/30

# RIP
set protocols rip interface eth0
set protocols rip interface eth1

set protocols rip network 192.168.2.0/24
set protocols rip network 10.0.0.0/30

# Authentication
set interfaces ethernet eth1 ip rip authentication md5 1 password 'RipSecure2024!'

# Passive on the LAN
set protocols rip interface eth0 passive

commit
save
```

### RIP with Default Route

**Internet Gateway Router**:
```
# WAN interface
set interfaces ethernet eth0 address dhcp

# LAN interface
set interfaces ethernet eth1 address 192.168.1.1/24

# Static default route
set protocols static route 0.0.0.0/0 dhcp-interface eth0

# RIP
set protocols rip interface eth1
set protocols rip network 192.168.1.0/24

# Originate the default route
set protocols rip default-information originate

# Passive on the LAN
set protocols rip interface eth1 passive

commit
save
```

**Branch Router**:
```
# WAN to the gateway
set interfaces ethernet eth0 address 192.168.1.2/24

# LAN
set interfaces ethernet eth1 address 192.168.10.1/24

# RIP
set protocols rip interface eth0
set protocols rip interface eth1

set protocols rip network 192.168.1.0/24
set protocols rip network 192.168.10.0/24

set protocols rip interface eth1 passive

commit
save
```

### RIP Redistribution Example

**Core Router** (RIP + OSPF):
```
# Interfaces
set interfaces ethernet eth0 address 192.168.1.1/24
set interfaces ethernet eth1 address 10.0.0.1/30

# RIP domain
set protocols rip interface eth0
set protocols rip network 192.168.1.0/24

# OSPF domain
set protocols ospf parameters router-id 10.0.0.1
set protocols ospf interface eth1 area 0
set protocols ospf area 0 network 10.0.0.0/30

# Redistribute RIP into OSPF
set protocols ospf redistribute rip metric 100 metric-type 2

# Redistribute OSPF into RIP
set protocols rip redistribute ospf metric 5

commit
save
```

**Caution**: Two-way redistribution can create routing loops. Use route-maps.

### RIP over VPN (VTI)

**Site A**:
```
# VTI tunnel
set interfaces vti vti0 address 172.16.0.1/30

# IPsec VPN (configured separately)

# RIP over VTI
set protocols rip interface vti0
set protocols rip network 172.16.0.0/30
set protocols rip network 192.168.1.0/24

# Authentication
set interfaces vti vti0 ip rip authentication md5 1 password 'VPN-RIP-Pass'

# LAN interface
set interfaces ethernet eth1 address 192.168.1.1/24
set protocols rip interface eth1 passive

commit
save
```

**Site B**:
```
# VTI tunnel
set interfaces vti vti0 address 172.16.0.2/30

# RIP over VTI
set protocols rip interface vti0
set protocols rip network 172.16.0.0/30
set protocols rip network 192.168.2.0/24

# Authentication
set interfaces vti vti0 ip rip authentication md5 1 password 'VPN-RIP-Pass'

# LAN interface
set interfaces ethernet eth1 address 192.168.2.1/24
set protocols rip interface eth1 passive

commit
save
```

### RIP Filtering Example

**HQ Router** (advertises only internal networks):
```
# Prefix list for filtering
set policy prefix-list INTERNAL-ONLY rule 10 action permit
set policy prefix-list INTERNAL-ONLY rule 10 prefix 192.168.0.0/16 le 24

set policy prefix-list INTERNAL-ONLY rule 20 action permit
set policy prefix-list INTERNAL-ONLY rule 20 prefix 10.0.0.0/8 le 24

# Apply to RIP outbound
set protocols rip distribute-list interface eth1 prefix-list out INTERNAL-ONLY

# RIP configuration
set protocols rip network 192.168.0.0/16
set protocols rip network 10.0.0.0/8

commit
save
```

### RIPng IPv6 Example

**Router 1**:
```
# IPv6 interfaces
set interfaces ethernet eth0 address 2001:db8:1::1/64
set interfaces ethernet eth1 address 2001:db8:100::1/64

# RIPng
set protocols ripng interface eth0
set protocols ripng interface eth1

set protocols ripng network 2001:db8:1::/64
set protocols ripng network 2001:db8:100::/64

# Passive on the LAN
set protocols ripng interface eth0 passive

commit
save
```

**Router 2**:
```
# IPv6 interfaces
set interfaces ethernet eth0 address 2001:db8:2::1/64
set interfaces ethernet eth1 address 2001:db8:100::2/64

# RIPng
set protocols ripng interface eth0
set protocols ripng interface eth1

set protocols ripng network 2001:db8:2::/64
set protocols ripng network 2001:db8:100::/64

# Passive on the LAN
set protocols ripng interface eth0 passive

commit
save
```

## Yandex Cloud Example: Legacy Network Migration

Scenario: Migrating a legacy RIP network into Yandex Cloud with a gradual transition to OSPF.

### Topology

```
Internet
   |
[Yandex Cloud VPC]
   |
[Gateway Router - RIP + OSPF]
   |
+--+----------+----------+
   |          |          |
[Legacy1]  [Legacy2]  [OSPF Zone]
 (RIP)      (RIP)      (OSPF)
```

### Gateway Router Configuration

**Gateway Router** (dual protocol):
```
# External interface
set interfaces ethernet eth0 address 10.128.0.10/24
set protocols static route 0.0.0.0/0 next-hop 10.128.0.1

# RIP zone interface
set interfaces ethernet eth1 address 192.168.1.1/24

# OSPF zone interface
set interfaces ethernet eth2 address 10.10.0.1/24

# Loopback
set interfaces loopback lo address 10.255.255.1/32

# RIP configuration
set protocols rip interface eth1
set protocols rip network 192.168.1.0/24

# RIP authentication
set interfaces ethernet eth1 ip rip authentication md5 1 password 'YC-RIP-Legacy2024'

# RIP passive
set protocols rip interface eth1 passive disable

# Default route into RIP
set protocols rip default-information originate

# OSPF configuration
set protocols ospf parameters router-id 10.255.255.1
set protocols ospf interface eth2 area 0
set protocols ospf area 0 network 10.10.0.0/24
set protocols ospf area 0 network 10.255.255.1/32

# OSPF authentication
set protocols ospf interface eth2 authentication md5 key-id 1 md5-key 'YC-OSPF-Secure'

# Redistribute RIP into OSPF (controlled)
set policy prefix-list RIP-TO-OSPF rule 10 action permit
set policy prefix-list RIP-TO-OSPF rule 10 prefix 192.168.0.0/16 le 24

set policy route-map RIP-TO-OSPF rule 10 action permit
set policy route-map RIP-TO-OSPF rule 10 match ip address prefix-list RIP-TO-OSPF

set protocols ospf redistribute rip route-map RIP-TO-OSPF metric 100 metric-type 2

# Redistribute OSPF into RIP (controlled)
set policy prefix-list OSPF-TO-RIP rule 10 action permit
set policy prefix-list OSPF-TO-RIP rule 10 prefix 10.10.0.0/16 le 24

set policy route-map OSPF-TO-RIP rule 10 action permit
set policy route-map OSPF-TO-RIP rule 10 match ip address prefix-list OSPF-TO-RIP

set protocols rip redistribute ospf route-map OSPF-TO-RIP metric 3

commit
save
```

### Legacy RIP Router

**Legacy Router** (RIP only):
```
# Management interface (Yandex Cloud)
set interfaces ethernet eth0 address dhcp

# LAN interface
set interfaces ethernet eth1 address 192.168.10.1/24

# Uplink to the Gateway
set interfaces ethernet eth2 address 192.168.1.10/24

# RIP configuration
set protocols rip interface eth2
set protocols rip interface eth1

set protocols rip network 192.168.1.0/24
set protocols rip network 192.168.10.0/24

# Authentication
set interfaces ethernet eth2 ip rip authentication md5 1 password 'YC-RIP-Legacy2024'

# Passive on the LAN
set protocols rip interface eth1 passive

commit
save
```

### Migration Plan

**Phase 1**: Dual protocol on the Gateway (the current state).

**Phase 2**: Move the legacy routers one by one:
```
# On each legacy router
delete protocols rip
set protocols ospf parameters router-id 192.168.10.1
set protocols ospf interface eth2 area 0
set protocols ospf area 0 network 192.168.1.0/24
set protocols ospf interface eth2 authentication md5 key-id 1 md5-key 'YC-OSPF-Secure'
commit
```

**Phase 3**: After migrating all routers, remove RIP from the Gateway:
```
delete protocols rip
delete protocols ospf redistribute rip
commit
```

## VK Cloud Example: Small Office RIP Deployment

Scenario: A simple small-office network on VK Cloud using RIP.

### Topology

```
[VK Cloud VPC 10.0.0.0/16]
          |
    [Main Router]
     10.0.1.1/24
          |
    +-----+-----+
    |           |
[Office1]   [Office2]
10.0.2.1/24  10.0.3.1/24
```

### Main Router Configuration

**Main Router**:
```
# Interfaces
set interfaces ethernet eth0 address 10.0.1.1/24
set interfaces ethernet eth1 address 10.0.10.1/30
set interfaces ethernet eth2 address 10.0.10.5/30

# Internet via VK Cloud NAT
set protocols static route 0.0.0.0/0 next-hop 10.0.1.254

# RIP configuration
set protocols rip interface eth1
set protocols rip interface eth2

set protocols rip network 10.0.10.0/30
set protocols rip network 10.0.10.4/30

# Authentication for security
set interfaces ethernet eth1 ip rip authentication md5 1 password 'VKCloud-RIP-2024'
set interfaces ethernet eth2 ip rip authentication md5 1 password 'VKCloud-RIP-2024'

# Default route into RIP for the branch offices
set protocols rip default-information originate

# Timers (aggressive for a small network)
set protocols rip timers update 15
set protocols rip timers timeout 90
set protocols rip timers garbage-collection 60

commit
save
```

### Office Router 1

```
# Interfaces
set interfaces ethernet eth0 address 10.0.2.1/24
set interfaces ethernet eth1 address 10.0.10.2/30

# RIP
set protocols rip interface eth0
set protocols rip interface eth1

set protocols rip network 10.0.2.0/24
set protocols rip network 10.0.10.0/30

# Authentication
set interfaces ethernet eth1 ip rip authentication md5 1 password 'VKCloud-RIP-2024'

# Passive on the LAN
set protocols rip interface eth0 passive

# Timers (match the main router)
set protocols rip timers update 15
set protocols rip timers timeout 90
set protocols rip timers garbage-collection 60

# NAT for internet access
set nat source rule 100 outbound-interface name eth1
set nat source rule 100 source address 10.0.2.0/24
set nat source rule 100 translation address masquerade

commit
save
```

### Office Router 2

```
# Interfaces
set interfaces ethernet eth0 address 10.0.3.1/24
set interfaces ethernet eth1 address 10.0.10.6/30

# RIP
set protocols rip interface eth0
set protocols rip interface eth1

set protocols rip network 10.0.3.0/24
set protocols rip network 10.0.10.4/30

# Authentication
set interfaces ethernet eth1 ip rip authentication md5 1 password 'VKCloud-RIP-2024'

# Passive on the LAN
set protocols rip interface eth0 passive

# Timers
set protocols rip timers update 15
set protocols rip timers timeout 90
set protocols rip timers garbage-collection 60

# NAT
set nat source rule 100 outbound-interface name eth1
set nat source rule 100 source address 10.0.3.0/24
set nat source rule 100 translation address masquerade

commit
save
```

### Firewall for RIP

On all routers:
```
# Allow RIP multicast (224.0.0.9)
set firewall ipv4 input filter rule 100 action accept
set firewall ipv4 input filter rule 100 destination address 224.0.0.9
set firewall ipv4 input filter rule 100 protocol udp
set firewall ipv4 input filter rule 100 destination port 520

# Allow from specific interfaces only
set firewall ipv4 input filter rule 100 inbound-interface interface-name eth1

commit
```

## Verification Commands

### Show RIP Status

**Overall RIP status**:
```
show ip rip status
```

Output:
```
Routing Protocol is "rip"
  Sending updates every 30 seconds with +/-50%, next due in 18 seconds
  Timeout after 180 seconds, garbage collect after 120 seconds
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Default redistribution metric is 1
  Redistributing: connected, static
  Default version control: send version 2, receive version 2
  Interface        Send  Recv  Key-chain
  eth0              2     2
  eth1              2     2
  Routing for Networks:
    192.168.1.0/24
    192.168.2.0/24
    10.0.0.0/8
  Routing Information Sources:
    Gateway          BadPackets BadRoutes  Distance Last Update
    192.168.1.2             0         0       120   00:00:05
  Distance: (default is 120)
```

### Show RIP Routes

**RIP routing table**:
```
show ip rip
```

Output:
```
Codes: R - RIP, C - connected, S - Static, O - OSPF, B - BGP
       > - selected route, * - FIB route

R>* 192.168.2.0/24 [120/1] via 192.168.1.2, eth0, 00:00:15
R>* 192.168.3.0/24 [120/2] via 192.168.1.2, eth0, 00:00:15
R>* 10.10.0.0/24 [120/1] via 192.168.1.2, eth0, 00:00:15
```

### Show RIP Database

**RIP database entries**:
```
show ip protocols
```

Information about all routing protocols, including RIP.

### Show IP Route

**All routes** (including RIP):
```
show ip route
```

**RIP routes only**:
```
show ip route rip
```

Output:
```
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup

R>* 192.168.2.0/24 [120/1] via 192.168.1.2, eth0, weight 1, 00:02:15
R>* 192.168.3.0/24 [120/2] via 192.168.1.2, eth0, weight 1, 00:02:15
```

### Show RIP Interface

**RIP on the interfaces**:
```
show ip rip interface
```

### Debug RIP

**Enable RIP debugging**:
```
monitor protocol rip
```

**RIP packet debug**:
```
debug rip packet
```

**RIP events**:
```
debug rip events
```

**Stop debugging**:
```
no debug rip all
```

### Clear RIP Routes

**Clear the RIP process** (restart):
```
restart rip
```

Removes all learned routes and restarts the RIP process.

## Troubleshooting

### RIP Neighbors Not Visible

**Check 1 - Connectivity**:
```
ping <neighbor-ip>
```

**Check 2 - The RIP process is active**:
```
show ip rip status
```

**Check 3 - Network statements**:
```
show configuration protocols rip
```

Make sure the interfaces are included in RIP:
```
set protocols rip interface eth0
set protocols rip network 192.168.1.0/24
```

**Check 4 - Authentication**:
```
show configuration interfaces ethernet eth0 ip rip authentication
```

Authentication must match on both routers.

**Check 5 - Firewall**:
```
# Allow RIP (UDP 520)
set firewall ipv4 input filter rule 100 action accept
set firewall ipv4 input filter rule 100 destination address 224.0.0.9
set firewall ipv4 input filter rule 100 protocol udp
set firewall ipv4 input filter rule 100 destination port 520
commit
```

**Check 6 - Multicast**:
```
tcpdump -i eth0 -n 'udp port 520'
```

You should see RIP updates every 30 seconds.

### Routes Not Appearing

**Check 1 - RIP database**:
```
show ip rip
```

Is the route in RIP but not in the routing table?

**Check 2 - Administrative Distance**:
```
show ip route <network>
```

Another protocol (OSPF, static) may have a better distance.

**Check 3 - Hop count**:
```
show ip rip
```

If the metric is 16, the route is unreachable (too far away).

**Check 4 - Split horizon**:
```
set interfaces ethernet eth0 ip rip split-horizon disable
commit
```

Try disabling split horizon (for hub-and-spoke).

**Check 5 - Distribute list**:
```
show configuration protocols rip distribute-list
```

A route filter may be blocking the route.

### Slow Convergence

RIP convergence is slow (up to 3 minutes).

**Solution 1 - Aggressive timers**:
```
set protocols rip timers update 10
set protocols rip timers timeout 60
set protocols rip timers garbage-collection 40
commit
```

**Caution**: This increases the load on the network.

**Solution 2 - Poison reverse**:
```
set interfaces ethernet eth0 ip rip split-horizon poison-reverse
commit
```

**Solution 3 - Migrate to OSPF**:

RIP is not suitable for networks that require fast convergence. Use OSPF.

### Authentication Failures

**Check 1 - Logs**:
```
show log | grep RIP
```

Look for "authentication failed" messages.

**Check 2 - Passwords match**:
```
# Router 1
show configuration interfaces ethernet eth0 ip rip authentication

# Router 2
show configuration interfaces ethernet eth0 ip rip authentication
```

The passwords and key-id must match.

**Check 3 - Key rotation**:

If you are changing passwords, add the new key ID before removing the old one:
```
# Add the new one
set interfaces ethernet eth0 ip rip authentication md5 2 password 'NewPassword'
commit

# After updating all routers, remove the old one
delete interfaces ethernet eth0 ip rip authentication md5 1
commit
```

### Routing Loops

**Problem**: Packets circle between the routers.

**Solution 1 - Split horizon**:
```
# Make sure split horizon is enabled (the default)
delete interfaces ethernet eth0 ip rip split-horizon disable
commit
```

**Solution 2 - Maximum hop count**:

RIP automatically limits loops through the hop count (max 15).

**Solution 3 - Administrative distance**:

If you use redistribution between RIP and other protocols:
```
set protocols rip distance 120
set protocols ospf distance global 110
commit
```

### High Network Traffic

RIP generates constant traffic (updates every 30 seconds).

**Solution 1 - Passive interfaces**:
```
set protocols rip interface eth2 passive
commit
```

**Solution 2 - Unicast neighbors**:
```
set protocols rip neighbor 192.168.1.2
delete protocols rip interface eth0
commit
```

**Solution 3 - Increase the update interval**:
```
set protocols rip timers update 60
commit
```

**Caution**: This slows convergence.

**Solution 4 - Migrate to OSPF**:

OSPF uses triggered updates instead of periodic ones.

## Best Practices

### General Recommendations

1. **Use RIPv2** (not RIPv1):
   ```
   set protocols rip version 2
   ```

2. **MD5 Authentication** on all interfaces:
   ```
   set interfaces ethernet eth0 ip rip authentication md5 1 password 'StrongPassword'
   ```

3. **Passive interfaces** for the LAN:
   ```
   set protocols rip interface eth1 passive
   ```

4. **Limit the network size** - a maximum of 10-15 routers

5. **Use a default route** on branch routers:
   ```
   set protocols rip default-information originate
   ```

6. **Filter redistributed routes**:
   ```
   set protocols rip redistribute connected route-map CONNECTED-FILTER
   ```

7. **Monitor the hop count** - do not let it get close to 15

8. **Document the network topology** - RIP has no database visibility

9. **Plan a migration to OSPF** for growing networks

10. **Regular backups** of the configuration

### Security Best Practices

1. **Always use MD5 authentication**:
   ```
   set interfaces ethernet eth0 ip rip authentication md5 1 password 'Secure123!'
   ```

2. **Passive interfaces by default**:
   ```
   set protocols rip passive-interface default
   set protocols rip passive-interface eth0 disable
   ```

3. **Firewall for RIP**:
   ```
   set firewall ipv4 input filter rule 100 action accept
   set firewall ipv4 input filter rule 100 source address 192.168.1.0/24
   set firewall ipv4 input filter rule 100 destination address 224.0.0.9
   set firewall ipv4 input filter rule 100 protocol udp
   set firewall ipv4 input filter rule 100 destination port 520
   ```

4. **Filter redistributed routes**:
   ```
   set protocols rip distribute-list interface eth0 prefix-list ALLOWED-OUT out
   ```

5. **Limit the network statements** - only the networks you need

### Performance Best Practices

1. **Default timers** for most cases:
   ```
   set protocols rip timers update 30
   set protocols rip timers timeout 180
   set protocols rip timers garbage-collection 120
   ```

2. **Poison reverse** for faster convergence:
   ```
   set interfaces ethernet eth0 ip rip split-horizon poison-reverse
   ```

3. **Summarization** where possible (although RIPv2 has no explicit summarization)

4. **Unicast neighbors** for reducing multicast:
   ```
   set protocols rip neighbor 192.168.1.2
   ```

5. **Monitor the metrics**:
   ```
   show ip rip
   ```

### Migration Best Practices

**From RIP to OSPF**:

1. **Dual protocol phase**:
   ```
   # Keep RIP running
   set protocols rip network 192.168.0.0/16

   # Add OSPF
   set protocols ospf parameters router-id 10.0.0.1
   set protocols ospf area 0 network 10.0.0.0/8

   # Redistribute both ways (temporary)
   set protocols rip redistribute ospf metric 5
   set protocols ospf redistribute rip metric 100
   ```

2. **Migrate the routers one by one**

3. **Remove RIP after all are migrated**:
   ```
   delete protocols rip
   delete protocols ospf redistribute rip
   ```

**From RIP to static routes** (small networks):

1. **Document the current RIP routes**:
   ```
   show ip rip
   ```

2. **Create static routes**:
   ```
   set protocols static route 192.168.2.0/24 next-hop 192.168.1.2
   ```

3. **Disable RIP**:
   ```
   delete protocols rip
   ```

## When to Migrate from RIP

### Signs You Need OSPF/BGP

1. **Network growth** - more than 10 routers
2. **Slow convergence** - unacceptable downtime
3. **Multiple paths** - need load balancing
4. **VLSMs required** - complex subnetting
5. **Hop count limit** - hitting 15 hop barrier
6. **High bandwidth links** - need better metrics
7. **Large routing tables** - RIP updates too big
8. **Require fast failover** - seconds not minutes
9. **Integration with ISP** - need BGP
10. **Security requirements** - need better authentication

### Migration Path

**Small networks (2-5 routers)**:
```
RIP → Static Routes
```

**Medium networks (5-20 routers)**:
```
RIP → OSPF (single area)
```

**Large networks (20+ routers)**:
```
RIP → OSPF (multi-area) → BGP for external
```

**Cloud deployments**:
```
RIP → Cloud-native routing (VPC routing tables + BGP)
```

## Comparison with Other Protocols

### RIP vs OSPF

| Feature | RIP | OSPF |
|---------|-----|------|
| Algorithm | Distance-vector | Link-state |
| Metric | Hop count | Cost (bandwidth) |
| Max hops | 15 | No limit |
| Convergence | Slow (minutes) | Fast (seconds) |
| Scalability | Small (10-15) | Large (100+) |
| CPU usage | Low | Medium |
| Configuration | Simple | Complex |
| Updates | Periodic (30s) | Triggered |
| VLSM | RIPv2 yes | Yes |
| Areas | No | Yes |

**Recommendation**: Use OSPF for any network with more than 10 routers.

### RIP vs BGP

**RIP** is an Interior Gateway Protocol (IGP) for internal routing.

**BGP** is an Exterior Gateway Protocol (EGP) for inter-AS routing.

**Use case**:
- RIP - small internal networks
- BGP - ISP connectivity, multi-homed networks

### RIP vs Static Routes

| Feature | RIP | Static Routes |
|---------|-----|---------------|
| Configuration | Automatic | Manual |
| Failover | Automatic | Manual or with tracking |
| Scalability | Low | Very low |
| Convergence | Slow | Instant (if tracked) |
| Maintenance | Low | High |

**When to use static**:
- 2-3 routers
- No redundancy needed
- Predictable topology

**When to use RIP**:
- 5-15 routers
- Some redundancy
- Simple failover needed

## Summary

**RIP Summary**:
- Simple distance-vector protocol
- Suitable for small networks (5-15 routers)
- Maximum 15 hops
- Slow convergence (minutes)
- Use RIPv2 with MD5 authentication
- Passive interfaces on LAN
- Plan migration to OSPF as network grows

**Key Commands**:
```
# Enable RIP
set protocols rip interface <interface>
set protocols rip network <network>

# Authentication
set interfaces ethernet <int> ip rip authentication md5 <id> password '<pass>'

# Passive interface
set protocols rip interface <int> passive

# Default route
set protocols rip default-information originate

# Verification
show ip rip
show ip rip status
show ip route rip
```

**Migration Path**:
```
Small network: RIP → Static Routes
Growing network: RIP → OSPF
Large network: RIP → OSPF + BGP
```

## Next Steps

- [OSPF Configuration](/docs/vyos/routing/vyos-ospf) - for growing networks
- [BGP Configuration](/docs/vyos/routing/vyos-bgp) - for ISP connectivity
- [Static Routes](/docs/vyos/routing/vyos-static) - basic routing
- [Policy Routing](/docs/vyos/policy/) - route-maps and filtering

