Statico e percorso predefinito
Problema: nella rete mostrata nella Figura 4-4, configurare ciascun router utilizzando route statiche e predefinite in modo che vi sia una connettività completa attraverso la rete.
Di seguito viene fornita la configurazione iniziale di ogni router. Nota di laboratorio: il lato DCE del cavo back to back DCE / DTE si collega all’interfaccia con la velocità di clock configurata. Se lo trascuri, il laboratorio non funzionerà poiché l’interfaccia non rimarrà attiva.
RouterA
Router # config terminal
Router (config) #hostname RouterA
RouterA (config) #int fa0 / 0
RouterA (config-if) #ip address 192.168.1.1 255.255.255.0
RouterA (config-if) #no shut
RouterA (config-if) #exit
RouterA (config) #interface Serial0 / 0
RouterA (config-if) #ip address 192.168.3.1 255.255.255.252
RouterA (config-if) #no shut
RouterA (config-if) #exit
RouterA (config) #interface Serial0 / 1
RouterA (config-if) #ip address 192.168.3.5 255.255.255.252
RouterA (config-if) #clock rate 2000000
RouterA (config-if) #no shut
RouterA (config-if) #exitÂ
RouterB
Router#config terminal
Router(config)#hostname RouterB
RouterB(config)#interface FastEthernet0/0
RouterB(config-if)# ip address 192.168.2.1 255.255.255.0
RouterB(config-if)#no shut
RouterB(config-if)#exit
RouterB(config)#interface Serial0/0
RouterB(config-if)# ip address 192.168.3.2 255.255.255.252
RouterB(config-if)#no shut
RouterB(config-if)#exit
RouterB(config)#interface Serial0/1
RouterB(config-if)# ip address 192.168.3.9 255.255.255.252
RouterB(config-if)#clock rate 2000000
RouterB(config-if)#no shut
RouterB(config-if)#exit
RouterC
Router#config t
Router(config)#hostname RouterC
RouterC(config)#interface FastEthernet0/0
RouterC(config-if)#ip address 200.1.20.1 255.255.255.0
RouterC(config-if)#no shut
RouterC(config-if)#exit
RouterC(config)#interface Serial0/0
RouterC(config-if)# ip address 192.168.3.10 255.255.255.252
RouterC(config-if)#no shut
RouterC(config-if)#exit
RouterC(config)#interface Serial0/1
RouterC(config-if)# ip address 192.168.3.6 255.255.255.252
RouterC(config-if)#no shut
RouterC(config-if)#exitÂ
Figura 4-6 Lab 4-1
Soluzione:
Per fornire la piena connettività attraverso la rete, ogni router richiederà route statiche alle diverse reti collegate ai router. Per raggiungere Internet, tutti i router richiederanno un percorso predefinito. La soluzione è mostrata di seguito:
RouterA (config) #ip route 192.168.2.0 255.255.255.0 192.168.3.2
RouterA (config) #ip route 192.168.3.8 255.255.255.252 192.168.3.2
RouterA (config) #ip route 0.0.0.0 0.0.0.0 192.168.3.6
RouterB (config) #ip route 192.168.1.0 255.255.255.0 192.168.3.1
RouterB (config) #ip route 192.168.3.4 255.255.255.252 192.168.3.1
RouterB (config) #ip route 0.0.0.0 0.0.0.0 192.168.3.10
RouterC (config) #ip route 192.168.1.0 255.255.255.0 192.168.3.5
RouterC (config) #ip route 192.168.2.0 255.255.255.0 192.168.3.9
RouterC (config) #ip route 192.168.3.0 255.255.255.252 192.168.3.5
RouterC ( config) #ip route 0.0.0.0 0.0.0.0 200.1.20.2
Verifica:
Per verificare, controlla prima la tabella di instradamento di ciascun router:
RouterA#sh ip route
–output truncated–
Gateway of last resort is 192.168.3.6 to network 0.0.0.0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
S 192.168.2.0/24 [1/0] via 192.168.3.2
192.168.3.0/30 is subnetted, 3 subnets
S 192.168.3.8 [1/0] via 192.168.3.2
C 192.168.3.0 is directly connected, Serial0/0
C 192.168.3.4 is directly connected, Serial0/1
S* 0.0.0.0/0 [1/0] via 192.168.3.6
RouterB#sh ip route
–output truncated–
Gateway of last resort is 192.168.3.10 to network 0.0.0.0
S 192.168.1.0/24 [1/0] via 192.168.3.1
C 192.168.2.0/24 is directly connected, FastEthernet0/0
192.168.3.0/30 is subnetted, 3 subnets
C 192.168.3.8 is directly connected, Serial0/1
C 192.168.3.0 is directly connected, Serial0/0
S 192.168.3.4 [1/0] via 192.168.3.1
S* 0.0.0.0/0 [1/0] via 192.168.3.10
RouterC#sh ip route
–output truncated–
Gateway of last resort is 200.1.20.2 to network 0.0.0.0
CÂ Â Â 200.1.20.0/24 is directly connected, FastEthernet0/0
SÂ Â Â 192.168.1.0/24 [1/0] via 192.168.3.5
SÂ Â Â 192.168.2.0/24 [1/0] via 192.168.3.9
   192.168.3.0/30 is subnetted, 3 subnets
CÂ Â Â Â Â Â 192.168.3.8 is directly connected, Serial0/0
SÂ Â Â Â Â Â 192.168.3.0 [1/0] via 192.168.3.5
CÂ Â Â Â Â Â 192.168.3.4 is directly connected, Serial0/1
S*Â Â 0.0.0.0/0 [1/0] via 200.1.20.2
È inoltre possibile utilizzare il comando ping per verificare la connettività attraverso la rete come mostrato di seguito:
RouterA#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/16 ms
RouterA#ping 200.1.20.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 200.1.20.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
RouterA#ping 192.168.3.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.10, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
RouterB#ping 200.1.20.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 200.1.20.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
RouterB#ping 192.168.3.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
RouterC#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Sommario
Sebbene questo capitolo sia stato una lettura leggera rispetto ai capitoli precedenti, getta le basi per il capitolo successivo in cui imparerai le caratteristiche dei singoli protocolli e come configurarli. È essenziale che tu sia in grado di utilizzare il routing statico e predefinito prima di accedere ai protocolli di routing.
È anche importante comprendere la differenza tra distanza amministrativa e metriche e dove vengono utilizzate.