RIP & default route

Routing Information Protocol (RIP) är ett distansvektor routing-protokoll som inte används i moderna nätverk, men utmärk protokoll för studera hur dynamiska routing-protokoll fungerar. Med några kommando växlar routrar routing-information med varandra.

Studera topologin nedan:

Bild 1: Dynamiskt routing-protokoll RIP

Routrar R1, R2 och R3 har egna direkt anslutna nätverk. Till en början fylls routing-tabellen endast med direkt anslutna nätverk därmed routrarnas routing-tabell innehåller följande:

  • R1 ser endast två nätverk: 192.168.1.0 och 192.168.2.0
  • R2 ser endast tre nätverk: 192.168.2.0, 192.168.3.0 och 192.168.4.0
  • R3 ser endast två nätverk: 192.168.4.0 och 192.168.5.0

För att routrarna ska växla information med varandra aktiveras RIP på varje router med kommandot router rip i den globala konfigurationsläget. Därefter anges de direkt anslutna nätverk med kommando network.

Propagera en default route

Dynamiska routing-protokoll gör att routrar delar med varandra routing-information helt automatiskt. Men vad händer när det finns behov av statiska route i ett nätverk? Hanteringen av statiska route och dynamiska routing-protokoll demonstreras med topologin som visas nedan (samma som ovan men en router till):

Bild 2: Propagera en default statisk route

Konfigurationer

  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname ISP
  • ISP(config)# enable secret enpass
  • ISP(config)# no ip lookup-domain
  • ISP(config)# line console 0
  • ISP(config-line)# password conpass
  • ISP(config-line)# login
  • ISP(config-line)# logging synchronous
  • ISP(config-line)# exit
  • ISP(config)# line vty 0 4
  • ISP(config-line)# password vtypass
  • ISP(config-line)# login
  • ISP(config-line)# logging synchronous
  • ISP(config-line)# exit
  • ISP(config)# int s0/0/0
  • ISP(config-if)# ip address 209.165.200.225  255.255.255.252
  • ISP(config-if)# clock rate 250000
  • ISP(config-if)# no shut
  • ISP(config-if)# exit
  • ISP(config)# router rip
  • ISP(config-router)# network 209.165.200.224
  • ISP(config-router)# end
  • ISP# show run
  • ISP# show ip int br
  • ISP# show ip route
  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname R1
  • R1(config)# enable secret enpass
  • R1(config)# no ip lookup-domain
  • R1(config)# line console 0
  • R1(config-line)# password conpass
  • R1(config-line)# login
  • R1(config-line)# logging synchronous
  • R1(config-line)# exit
  • R1(config)# line vty 0 4
  • R1(config-line)# password vtypass
  • R1(config-line)# login
  • R1(config-line)# logging synchronous
  • R1(config-line)# exit
  • R1(config)# int g0/0
  • R1(config-if)# ip address 192.168.1.1 255.255.255.0
  • R1(config-if)# no shut
  • R1(config-if)# end
  • R1(config)# int s0/0/0
  • R1(config-if)# ip address 192.168.2.1 255.255.255.0
  • R1(config-if)# clock rate 250000
  • R1(config-if)# no shut
  • R1(config-if)# exit
  • R1(config)# router rip
  • R1(config-router)# network 192.168.1.0
  • R1(config-router)# network 192.168.2.0
  • R1(config-router)# end
  • R1# show run
  • R1# show ip int br
  • R1# show ip route
  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname R2
  • R2(config)# enable secret enpass
  • R2(config)# no ip lookup-domain
  • R2(config)# line console 0
  • R2(config-line)# password conpass
  • R2(config-line)# login
  • R2(config-line)# logging synchronous
  • R2(config-line)# exit
  • R2(config)# line vty 0 4
  • R2(config-line)# password vtypass
  • R2(config-line)# login
  • R2(config-line)# logging synchronous
  • R2(config-line)# exit
  • R2(config)# int g0/0
  • R2(config-if)# ip address 192.168.3.1 255.255.255.0
  • R2(config-if)# no shut
  • R2(config-if)# exit
  • R2(config)# int s0/0/0
  • R2(config-if)# ip address 192.168.2.2 255.255.255.0
  • R2(config-if)# no shut
  • R2(config-if)# exit
  • R2(config)# int s0/0/1
  • R2(config-if)# ip address 192.168.4.2 255.255.255.0
  • R2(config-if)# clock rate 250000
  • R2(config-if)# no shut
  • R2(config-if)# exit
  • R2(config)# router rip
  • R2(config-router)# network 192.168.2.0
  • R2(config-router)# network 192.168.3.0
  • R2(config-router)# network 192.168.4.0
  • R2(config-router)# end
  • R2# show run
  • R2# show ip int br
  • R2# show ip route
  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname R3
  • R3(config)# enable secret enpass
  • R3(config)# no ip lookup-domain
  • R3(config)# line console 0
  • R3(config-line)# password conpass
  • R3(config-line)# login
  • R3(config-line)# logging synchronous
  • R3(config-line)# exit
  • R3(config)# line vty 0 4
  • R3(config-line)# password vtypass
  • R3(config-line)# login
  • R3(config-line)# logging synchronous
  • R3(config-line)# exit
  • R3(config)# int g0/0
  • R3(config-if)# ip address 192.168.5.1 255.255.255.0
  • R3(config-if)# no shut
  • R3(config-if)# exit
  • R3(config)# int s0/0/1
  • R3(config-if)# ip address 192.168.4.1 255.255.255.0
  • R3(config-if)# no shut
  • R3(config-if)# exit
  • R3(config)# router rip
  • R3(config-router)# network 192.168.4.0
  • R3(config-router)# network 192.168.5.0
  • R3(config-router)# end
  • R3# show run
  • R3# show ip int br
  • R3# show ip route
  • R1(config)# interface s0/0/1
  • R1(config-if)# ip address 209.165.200.226 255.255.255.252
  • R1(config-if)# no shut
  • R1(config-if)# exit
  • R1(config)# ip route 0.0.0.0  0.0.0.0  s0/0/1  209.165.200.225
  • R1(config)# router rip
  • R1(config-router)# default-information originate
  • R1(config-router)# end
  • R1# show ip route rip

Ifall RIPv2 har aktiverats och om man vill tillbaka till RIPv1 kan det följande exekveras. Observera att RIPv2 ska aktiveras av och samtidigt version 1 aktiveras.

  • R2(config)# router rip
  • R2(config-router)# no version
  • R2(config-router)# end
  • R2# show ip route rip

I flera routing-protokoll kan du använda kommandot default-information originate för att statiska default route propageras till alla närliggande routrar. I RIP kan också användas kommandot redistribute static metric xx där xx är flera k-värde.