RIPv2 - Routing Information Protocol version 2

What is RIPv2?

RIPv2 (Routing Information Protocol version 2) is an enhanced version of RIPv1. It is a distance-vector routing protocol that supports classless routing and includes several improvements over RIPv1.

How is RIPv2 different from RIPv1?

  • Supports Classless Routing - RIPv2 includes subnet mask information in updates.

  • Multicast Updates - Sends updates to 224.0.0.9 instead of broadcasting.

  • Authentication - Supports plain text and MD5 authentication.

  • More Efficient - Reduces unnecessary traffic with multicast and better loop prevention.

What metric does RIPv2 use?

RIPv2 uses hop count as its metric, just like RIPv1. The maximum hop count is 15.

What is the administrative distance of RIPv2?

The administrative distance is 120, same as RIPv1.

Does RIPv2 support VLSM and CIDR?

Yes, RIPv2 supports Variable Length Subnet Masking (VLSM) and Classless Inter-Domain Routing (CIDR), making it more flexible for IP address allocation.

What are the limitations of RIPv2?

  • Still limited to 15 hops.

  • Slow convergence compared to modern protocols like OSPF or EIGRP.

  • Not ideal for large or complex networks.

What is the multicast address used by RIPv2?

RIPv2 uses the multicast address 224.0.0.9 to send routing updates.

  • In this section, you are going to learn

  • Terminology

  • Version Info

Version & RFC Details

RIP Version

RFC Version

Year

Core Idea / Contribution

RIPv2

RFC 2453

1998

Enhanced RIP to support classless routing (CIDR), subnet masks, and VLSM. Introduced multicast updates (224.0.0.9) instead of broadcast, and added support for route authentication. Improved scalability and security over RIPv1.

  • Setup

  • Setup

RIPv2 Request Packet

S.No

Protocol Packets

Description

Size(bytes)

1

Request

24504

Header

Command

Set to 1 for Request

1

Version

Set to 2 for RIPv2

1

Unused

Reserved; must be set to 0

2

Routing Entry

Address Family Identifier

Set to 2 for IP

2

Route Tag

Used to identify external routes

2

IP Address

IP address of the destination being requested

4

Subnet Mask

Subnet mask of the destination (supports VLSM)

4

Next Hop

IP address of the next hop router

4

Metric

Set to 16 to request the route; all fields set to 0 and metric 16 means request for full table

4

RIPv2 Response Packet

S.No

Protocol Packets

Description

Size(bytes)

2

Response

24504

Header

Command

Set to 2 for Response

1

Version

Set to 2 for RIPv2

1

Unused

Reserved; must be set to 0

2

Routing Entry

Address Family Identifier

Set to 2 for IP

2

Route Tag

Used to identify external routes

2

IP Address

Destination IP address of the route

4

Subnet Mask

Subnet mask of the destination (supports VLSM)

4

Next Hop

IP address of the next hop router

4

Metric

Hop count to the destination (115); 16 means unreachable

4

RIPv2 - Use Cases

S.no

Use Case

Description

1

Medium-sized networks

Suitable for networks requiring classless routing and subnetting.

2

Networks using VLSM or CIDR

Supports variable-length subnet masks and efficient IP address allocation.

3

Environments needing authentication

Provides basic security through plain-text or MD5 authentication.

4

Multicast-based routing updates

Reduces unnecessary traffic by using multicast (224.0.0.9) instead of broadcast.

5

Interoperability with legacy systems

Can coexist with RIPv1 in mixed environments.

RIPv2 - Basic Features

S.no

Features

Description

1

Classless Routing

Supports CIDR and VLSM by including subnet mask in updates.

2

Distance Vector Protocol

Uses hop count as the routing metric.

3

Maximum Hop Count

Routes with hop count >15 are considered unreachable.

4

Multicast Updates

Sends updates to 224.0.0.9 instead of broadcast.

5

Periodic Updates

Sends updates every 30 seconds.

6

Authentication Support

Supports plain text and MD5 authentication.

Classless Routing - Testcases

Classless Routing - Test Cases

#

Test Case

Description

Expected Result

1

Send route with /8 mask

10.0.0.0/8

Route accepted with correct mask

2

Send route with /16 mask

172.16.0.0/16

Route accepted with correct mask

3

Send route with /24 mask

192.168.1.0/24

Route accepted with correct mask

4

Send route with /25 mask

192.168.1.128/25

Route accepted

5

Send route with /30 mask

192.168.1.252/30

Route accepted

6

Send route with /32 mask

Host route

Route accepted

7

Send route with /0 mask

Default route

Route accepted

8

Send route with /23 mask

Supernetting

Route accepted

9

Send route with /27 mask

Subnetting

Route accepted

10

Send route with classful mask

192.168.1.0/24

Route accepted

11

Send route with classless mask

192.168.1.0/26

Route accepted

12

Send route with invalid mask

192.168.1.0/33

Route rejected

13

Send route with no mask

Mask omitted

Route rejected

14

Send route with inconsistent mask

Same route, different masks

Most specific mask used

15

Send route with duplicate entries

Same route repeated

Last entry used

16

Send route with valid AFI

AFI = 2

Route accepted

17

Send route with invalid AFI

AFI ? 2

Route rejected

18

Send route with valid metric

Metric = 1

Route accepted

19

Send route with metric = 16

Unreachable

Route accepted as unreachable

20

Send route with metric > 16

Invalid metric

Route rejected

21

Send route with valid subnet mask

255.255.255.0

Route accepted

22

Send route with invalid subnet mask

255.0.255.0

Route rejected

23

Send route with loopback IP

127.0.0.0/8

Route rejected

24

Send route with multicast IP

224.0.0.0/4

Route rejected

25

Send route with broadcast IP

255.255.255.255

Route rejected

26

Send route with private IP

10.0.0.0/8

Route accepted

27

Send route with public IP

8.8.8.0/24

Route accepted

28

Send route with default route

0.0.0.0/0

Route accepted

29

Send route with valid next hop

Next hop in same subnet

Route accepted

30

Send route with invalid next hop

Next hop unreachable

Route rejected

31

Send route with route tag

Tag = 100

Route accepted

32

Send route with invalid IP

IP = 300.0.0.0

Route rejected

33

Send route with valid checksum

Correct packet

Route accepted

34

Send route with invalid checksum

Corrupted packet

Packet discarded

35

Send route with TTL = 255

Valid TTL

Route accepted

36

Send route with TTL = 1

TTL expired

Packet dropped

37

Send route with valid version

Version = 2

Route accepted

38

Send route with version = 1

RIPv1 format

Subnet mask ignored

39

Send route with valid command

Command = 2

Route accepted

40

Send route with invalid command

Command ? 1 or 2

Packet ignored

41

Send route with valid source IP

Known router

Route accepted

42

Send route with spoofed source IP

Fake IP

Route ignored

43

Send route with valid port

UDP port 520

Packet accepted

44

Send route with invalid port

Port ? 520

Packet ignored

45

Send route with authentication

Auth enabled

Route accepted if auth valid

46

Send route without authentication

Auth required

Packet rejected

47

Send route with max entries

25 routes

All processed

48

Send route with no entries

Empty update

Packet processed

49

Send route with periodic update

Every 30 sec

Route accepted

50

Send route with rapid update

Every 5 sec

Route accepted

Distance Vector Protocol - Testcases

Distance Vector Protocol - Test Cases

#

Test Case

Description

Expected Result

1

Basic route advertisement

Router advertises its routing table

Neighbor receives and updates table

2

Periodic update every 30 seconds

Standard RIPv2 behavior

Update sent and processed

3

Hop count = 1

Directly connected network

Route accepted

4

Hop count = 15

Maximum valid hop count

Route accepted

5

Hop count = 16

Unreachable route

Route marked unreachable

6

Hop count > 16

Invalid route

Route discarded

7

Split horizon enabled

Route not advertised back on incoming interface

Loop prevention

8

Split horizon disabled

Route advertised back

May cause loops

9

Route poisoning

Route set to metric 16

Neighbor marks route unreachable

10

Hold-down timer active

Route change ignored temporarily

Prevents flapping

11

Hold-down timer expired

Route change accepted

Routing table updated

12

Invalid metric value

Metric = 255

Route discarded

13

Valid metric value

Metric = 2

Route accepted

14

Multicast update

Sent to 224.0.0.9

RIPv2 routers receive update

15

Unicast update

Sent to specific IP

Route accepted if valid

16

Update with valid version

Version = 2

Packet processed

17

Update with invalid version

Version ? 2

Packet ignored

18

Update with valid command

Command = 2

Response processed

19

Update with invalid command

Command ? 1 or 2

Packet ignored

20

Update with valid AFI

AFI = 2

Route accepted

21

Update with invalid AFI

AFI ? 2

Route ignored

22

Update with valid checksum

Correct packet

Packet accepted

23

Update with invalid checksum

Corrupted packet

Packet discarded

24

Update with TTL = 255

Valid TTL

Packet accepted

25

Update with TTL = 1

TTL expired

Packet dropped

26

Update with valid source IP

Known router

Packet accepted

27

Update with spoofed source IP

Fake IP

Packet ignored

28

Update with valid port

UDP port 520

Packet accepted

29

Update with invalid port

Port ? 520

Packet ignored

30

Update with valid subnet mask

CIDR supported

Route accepted

31

Update with classful mask

Default mask used

Route accepted

32

Update with classless mask

Custom mask used

Route accepted

33

Update with duplicate routes

Same route repeated

Last entry used

34

Update with inconsistent metrics

Same route, different metrics

Lowest metric used

35

Update with valid IP

192.168.1.0

Route accepted

36

Update with invalid IP

300.0.0.0

Route ignored

37

Update with loopback IP

127.0.0.0

Route ignored

38

Update with multicast IP

224.0.0.0

Route ignored

39

Update with broadcast IP

255.255.255.255

Route ignored

40

Update with default route

0.0.0.0

Route accepted

41

Update with private IP

10.0.0.0

Route accepted

42

Update with public IP

8.8.8.0

Route accepted

43

Update with route to self

Own IP

Route ignored

44

Update with authentication

Valid auth

Route accepted

45

Update with invalid authentication

Wrong key

Packet rejected

46

Update with next hop field

Valid next hop

Route accepted

47

Update with invalid next hop

Unreachable next hop

Route ignored

48

Update with route tag

Tag = 100

Route accepted

49

Update with max entries

25 routes

All processed

50

Update with no entries

Empty update

Packet processed

Maximum Hop Count - Testcases

Maximum Hop Count - Test Cases

#

Test Case

Description

Expected Result

1

Route with hop count = 1

Directly connected network

Route accepted

2

Route with hop count = 2

One intermediate router

Route accepted

3

Route with hop count = 15

Maximum valid hop count

Route accepted

4

Route with hop count = 16

Unreachable route

Route marked as unreachable

5

Route with hop count = 17

Exceeds max hop count

Route discarded

6

Route with hop count = 0

Invalid metric

Route discarded

7

Route with hop count = 10

Mid-range hop count

Route accepted

8

Route with hop count = 14

Near max hop count

Route accepted

9

Route with hop count = 255

Invalid metric

Route discarded

10

Route with hop count = 1 and valid IP

Valid route

Route accepted

11

Route with hop count = 15 and valid IP

Valid route

Route accepted

12

Route with hop count = 16 and valid IP

Valid but unreachable

Route marked unreachable

13

Route with hop count = 1 and invalid IP

Invalid IP address

Route discarded

14

Route with hop count = 15 and invalid IP

Invalid IP address

Route discarded

15

Route with hop count = 16 and invalid IP

Invalid IP address

Route discarded

16

Route with hop count = 1 and valid AFI

AFI = 2

Route accepted

17

Route with hop count = 15 and invalid AFI

AFI ? 2

Route discarded

18

Route with hop count = 16 and valid AFI

AFI = 2

Route marked unreachable

19

Route with hop count = 1 and valid checksum

Valid packet

Route accepted

20

Route with hop count = 15 and invalid checksum

Corrupted packet

Route discarded

21

Route with hop count = 16 and valid checksum

Valid packet

Route marked unreachable

22

Route with hop count = 1 and TTL = 255

Valid TTL

Route accepted

23

Route with hop count = 15 and TTL = 1

TTL expired

Packet dropped

24

Route with hop count = 16 and TTL = 255

Valid TTL

Route marked unreachable

25

Route with hop count = 1 and valid source

Known router

Route accepted

26

Route with hop count = 15 and spoofed source

Fake IP

Route discarded

27

Route with hop count = 16 and valid source

Known router

Route marked unreachable

28

Route with hop count = 1 and valid port

UDP port 520

Route accepted

29

Route with hop count = 15 and invalid port

Port ? 520

Packet discarded

30

Route with hop count = 16 and valid port

UDP port 520

Route marked unreachable

31

Route with hop count = 1 and valid command

Command = 2

Route accepted

32

Route with hop count = 15 and invalid command

Command ? 1 or 2

Packet discarded

33

Route with hop count = 16 and valid command

Command = 2

Route marked unreachable

34

Route with hop count = 1 and version = 2

Valid version

Route accepted

35

Route with hop count = 15 and version = 1

RIPv1 format

Route accepted if classful

36

Route with hop count = 16 and version = 2

Valid version

Route marked unreachable

37

Route with hop count = 1 and route to self

Own IP

Route ignored

38

Route with hop count = 15 and route to self

Own IP

Route ignored

39

Route with hop count = 16 and route to self

Own IP

Route ignored

40

Route with hop count = 1 and route to broadcast

255.255.255.255

Route ignored

41

Route with hop count = 15 and route to multicast

224.0.0.0

Route ignored

42

Route with hop count = 16 and route to loopback

127.0.0.0

Route ignored

43

Route with hop count = 1 and private IP

10.0.0.0

Route accepted

44

Route with hop count = 15 and public IP

8.8.8.0

Route accepted

45

Route with hop count = 16 and default route

0.0.0.0

Route marked unreachable

46

Route with hop count = 1 and duplicate entry

Same route repeated

Last entry used

47

Route with hop count = 15 and inconsistent metrics

Same route, different metrics

Lowest metric used

48

Route with hop count = 16 and inconsistent metrics

Same route, different metrics

Route marked unreachable

49

Route with hop count = 1 and valid update interval

Every 30 sec

Route accepted

50

Route with hop count = 15 and rapid updates

Every 1 sec

Route accepted

Multicast Updates - Testcases

Multicast Updates - Test Cases

#

Test Case

Description

Expected Result

1

Multicast to 224.0.0.9

Standard RIPv2 multicast address

Update received by RIPv2 routers

2

Multicast every 30 seconds

Periodic multicast update

Update sent and processed

3

Multicast on all interfaces

Multiple interfaces configured

Update sent on each interface

4

Multicast with valid routing table

Contains valid routes

Neighbors update their tables

5

Multicast with empty routing table

No routes to advertise

Neighbors receive empty update

6

Multicast with invalid checksum

Corrupted packet

Packet discarded

7

Multicast with valid checksum

Correct packet

Packet accepted

8

Multicast with TTL = 1

TTL expired

Packet dropped

9

Multicast with TTL = 255

Valid TTL

Packet accepted

10

Multicast with spoofed source IP

Fake router IP

Packet ignored

11

Multicast with valid source IP

Known router

Packet accepted

12

Multicast with invalid version

Version ? 2

Packet ignored

13

Multicast with version = 2

Valid RIPv2 packet

Packet processed

14

Multicast with command = 2

Response

Packet processed

15

Multicast with command = 1

Request

Response expected

16

Multicast with invalid command

Command ? 1 or 2

Packet ignored

17

Multicast with AFI = 2

IP routing

Route accepted

18

Multicast with AFI ? 2

Non-IP routing

Route ignored

19

Multicast with metric = 1

Valid route

Route accepted

20

Multicast with metric = 16

Unreachable route

Route marked unreachable

21

Multicast with metric > 16

Invalid metric

Route ignored

22

Multicast with duplicate routes

Same route repeated

Last entry used

23

Multicast with inconsistent metrics

Same route, different metrics

Lowest metric used

24

Multicast with valid IP

192.168.1.0

Route accepted

25

Multicast with invalid IP

300.0.0.0

Route ignored

26

Multicast with loopback IP

127.0.0.0

Route ignored

27

Multicast with multicast IP

224.0.0.0

Route ignored

28

Multicast with broadcast IP

255.255.255.255

Route ignored

29

Multicast with default route

0.0.0.0

Route accepted

30

Multicast with private IP

10.0.0.0

Route accepted

31

Multicast with public IP

8.8.8.0

Route accepted

32

Multicast with route to self

Own IP

Route ignored

33

Multicast with valid port

UDP port 520

Packet accepted

34

Multicast with invalid port

Port ? 520

Packet ignored

35

Multicast with valid subnet

Classful subnet

Route accepted

36

Multicast with classless subnet

Subnet mask included

Route accepted

37

Multicast with route poisoning

Metric = 16

Route marked unreachable

38

Multicast with split horizon

Route not advertised back

Loop prevention

39

Multicast with hold-down timer active

Route change ignored

Prevents flapping

40

Multicast with hold-down timer expired

Route change accepted

Table updated

41

Multicast with max entries

25 routes

All processed

42

Multicast with no entries

Empty update

Packet processed

43

Multicast with authentication field

Auth enabled

Packet accepted if valid

44

Multicast with invalid authentication

Wrong key

Packet rejected

45

Multicast with next hop field

Valid next hop

Route accepted

46

Multicast with invalid next hop

Unreachable next hop

Route ignored

47

Multicast with route tag

Tag = 100

Route accepted

48

Multicast with valid interface

Interface up

Update sent

49

Multicast with disabled interface

Interface down

No update sent

50

Multicast in mixed RIPv1/RIPv2 network

RIPv1 router present

RIPv1 ignores multicast

Periodic Updates - Testcases

Periodic Updates - Test Cases

#

Test Case

Description

Expected Result

1

Update interval = 30 seconds

Standard RIPv2 behavior

Update sent every 30 seconds

2

Update interval < 30 seconds

Update every 10 seconds

Update sent more frequently

3

Update interval > 30 seconds

Update every 60 seconds

Update sent less frequently

4

Timer disabled

No periodic updates configured

No updates sent

5

Timer reset on manual update

Manual update resets timer

Next update delayed

6

Timer continues after manual update

Manual update doesnt reset timer

Next update sent as scheduled

7

Timer accuracy test

Measure interval precision

Update sent within 1 sec of expected time

8

Timer drift over time

Long uptime

Update interval remains consistent

9

Multiple interfaces

Updates sent on all interfaces

Each interface sends update

10

Interface down

Interface disabled

No update sent on that interface

11

Interface up

Interface enabled

Update sent

12

Valid routing table

Contains routes

Update includes all routes

13

Empty routing table

No routes

Update sent with no entries

14

Routing table change before update

Route added before timer expires

Change included in next update

15

Routing table unchanged

No changes

Same update sent

16

Update with valid checksum

Correct packet

Packet accepted

17

Update with invalid checksum

Corrupted packet

Packet discarded

18

Update with TTL = 255

Valid TTL

Packet accepted

19

Update with TTL = 1

TTL expired

Packet dropped

20

Update with valid source IP

Known router

Packet accepted

21

Update with spoofed source IP

Fake IP

Packet ignored

22

Update with valid destination

Multicast 224.0.0.9

Packet accepted

23

Update with invalid destination

Unicast or broadcast

Packet ignored

24

Update with valid version

Version = 2

Packet processed

25

Update with invalid version

Version ? 2

Packet ignored

26

Update with valid command

Command = 2

Packet processed

27

Update with invalid command

Command ? 1 or 2

Packet ignored

28

Update with valid AFI

AFI = 2

Route accepted

29

Update with invalid AFI

AFI ? 2

Route ignored

30

Update with metric = 1

Valid route

Route accepted

31

Update with metric = 16

Unreachable route

Route marked unreachable

32

Update with metric > 16

Invalid metric

Route ignored

33

Update with duplicate routes

Same route repeated

Last entry used

34

Update with inconsistent metrics

Same route, different metrics

Lowest metric used

35

Update with valid IP

192.168.1.0

Route accepted

36

Update with invalid IP

300.0.0.0

Route ignored

37

Update with loopback IP

127.0.0.0

Route ignored

38

Update with multicast IP

224.0.0.0

Route ignored

39

Update with broadcast IP

255.255.255.255

Route ignored

40

Update with default route

0.0.0.0

Route accepted

41

Update with private IP

10.0.0.0

Route accepted

42

Update with public IP

8.8.8.0

Route accepted

43

Update with route to self

Own IP

Route ignored

44

Update with valid UDP port

Port = 520

Packet accepted

45

Update with invalid UDP port

Port ? 520

Packet ignored

46

Update with authentication

Valid auth

Packet accepted

47

Update with invalid authentication

Wrong key

Packet rejected

48

Update with next hop field

Valid next hop

Route accepted

49

Update with route tag

Tag = 100

Route accepted

50

Update with max entries

25 routes

All processed

Authentication Support - Testcases

Authentication Support - Test Cases

#

Test Case

Description

Expected Result

1

Plain text authentication enabled

Configure plain text password

Auth field included in updates

2

MD5 authentication enabled

Configure MD5 key

Auth field included and hashed

3

No authentication configured

Default behavior

No auth field in updates

4

Invalid authentication type

Unsupported type

Packet rejected

5

Valid plain text password

Matching password on both routers

Update accepted

6

Mismatched plain text password

Different passwords

Update rejected

7

Valid MD5 key

Matching MD5 key

Update accepted

8

Mismatched MD5 key

Different MD5 keys

Update rejected

9

Auth field with correct length

Properly formatted

Update accepted

10

Auth field with incorrect length

Too short or too long

Update rejected

11

Auth field with valid key ID

Key ID matches

Update accepted

12

Auth field with invalid key ID

Key ID mismatch

Update rejected

13

Auth field with valid sequence number

Sequence number in order

Update accepted

14

Auth field with replayed sequence number

Duplicate or old

Update rejected

15

Auth field with expired key

Key lifetime exceeded

Update rejected

16

Auth field with future key

Key not yet valid

Update rejected

17

Auth field with valid digest

MD5 digest matches

Update accepted

18

Auth field with invalid digest

MD5 digest mismatch

Update rejected

19

Auth field with valid checksum

Packet integrity maintained

Update accepted

20

Auth field with invalid checksum

Corrupted packet

Update rejected

21

Auth field with TTL = 255

Valid TTL

Update accepted

22

Auth field with TTL = 1

TTL expired

Packet dropped

23

Auth field with spoofed source

Fake IP

Update rejected

24

Auth field with valid source

Known router

Update accepted

25

Auth field with valid port

UDP port 520

Update accepted

26

Auth field with invalid port

Port ? 520

Packet ignored

27

Auth field with valid version

Version = 2

Packet processed

28

Auth field with invalid version

Version ? 2

Packet ignored

29

Auth field with valid command

Command = 2

Packet processed

30

Auth field with invalid command

Command ? 1 or 2

Packet ignored

31

Auth field with valid AFI

AFI = 2

Route accepted

32

Auth field with invalid AFI

AFI ? 2

Route ignored

33

Auth field with valid IP

192.168.1.0

Route accepted

34

Auth field with invalid IP

300.0.0.0

Route ignored

35

Auth field with loopback IP

127.0.0.0

Route ignored

36

Auth field with multicast IP

224.0.0.0

Route ignored

37

Auth field with broadcast IP

255.255.255.255

Route ignored

38

Auth field with default route

0.0.0.0

Route accepted

39

Auth field with private IP

10.0.0.0

Route accepted

40

Auth field with public IP

8.8.8.0

Route accepted

41

Auth field with route to self

Own IP

Route ignored

42

Auth field with duplicate routes

Same route repeated

Last entry used

43

Auth field with inconsistent metrics

Same route, different metrics

Lowest metric used

44

Auth field with valid next hop

Next hop reachable

Route accepted

45

Auth field with invalid next hop

Next hop unreachable

Route ignored

46

Auth field with route tag

Tag = 100

Route accepted

47

Auth field with max entries

25 routes

All processed

48

Auth field with no entries

Empty update

Packet processed

49

Auth field with periodic update

Every 30 sec

Auth included

50

Auth field with rapid update

Every 5 sec

Auth included and validated

  • Reference links