Default route i OSPF | OSPF multiarea
I denna laboration undersöker vi hur en default route fungerar tillsammans med OSPFv2 och hur den kan distribueras inom ett OSPF-nätverk. OSPF är ett link-state routingprotokoll som vanligtvis används för att hantera interna rutter, men för att inkludera en default route krävs en särskild konfiguration.
Topologi
I vår topologi är router R2 ansluten till Internet via ett datamoln som innehåller en ISP-router och ett LAN där en webbserver är placerad. Det innebär att R2 kan agera gateway för resten av nätverket genom att konfigurera en statisk default route och sedan distribuera den till övriga OSPF-routrar. Eftersom R2 är ansluten till ett externt nätverk utanför OSPF-domänen, fungerar den som en Autonomous System Boundary Router (ASBR). Det är denna typ av router som ansvarar för att injicera externa rutter – såsom en default route – i OSPF-processen.
Eftersom nätverket i denna laboration är uppbyggt med en enda OSPF-area (Area 0), kommer default-routen att injiceras som en extern LSA (Type 5) och utan hinder spridas till samtliga routrar i nätverket. På så vis lär sig till exempel R1 och R3 att skicka trafik mot okända destinationer via R2.
Konfigurationer
Router ISP konfigurationer
- ISP(config)#no ip domain-lookup
- ISP(config)#interface G0/0
- ISP(config-if)#description Connected to External LAN
- ISP(config-if)#ip address 64.100.1.1 255.255.255.0
- ISP(config-if)#no shutdown
- ISP(config-if)#exit
- ISP(config)#!
- ISP(config)#interface S0/1/0
- ISP(config-if)#description DCE Connected to R2
- ISP(config-if)#clock rate 2000000
- ISP(config-if)#ip address 209.165.200.226 255.255.255.224
- ISP(config-if)#no shutdown
- ISP(config-if)#exit
- ISP(config)#interface Serial0/1/1
- ISP(config-if)# no ip address
- ISP(config-if)# clock rate 2000000
- ISP(config-if)# shutdown
- ISP(config-if)# exit
- ISP(config)#interface GigabitEthernet0/1
- ISP(config-if)# no ip address
- ISP(config-if)# duplex auto
- ISP(config-if)# speed auto
- ISP(config-if)# shutdown
- ISP(config-if)# exit
- ISP(config)#interface GigabitEthernet0/2
- ISP(config-if)# no ip address
- ISP(config-if)# duplex auto
- ISP(config-if)# speed auto
- ISP(config-if)# shutdown
- ISP(config-if)# exit
- ISP(config)#!
- ISP(config)#ip route 0.0.0.0 0.0.0.0 s0/1/0
- ISP(config)#end
- ISP#
Router R2 konfigurationer
- R2(config)#no ip domain-lookup
- R2(config)#interface GigabitEthernet0/0
- R2(config-if)#description Connected to LAN 2
- R2(config-if)# ip address 172.16.2.1 255.255.255.0
- R2(config-if)# duplex auto
- R2(config-if)# speed auto
- R2(config-if)# no shutdown
- R2(config-if)# exit
- R2(config)#interface GigabitEthernet0/1
- R2(config-if)# no ip address
- R2(config-if)# duplex auto
- R2(config-if)# speed auto
- R2(config-if)# shutdown
- R2(config-if)# exit
- R2(config)#interface GigabitEthernet0/2
- R2(config-if)# no ip address
- R2(config-if)# duplex auto
- R2(config-if)# speed auto
- R2(config-if)# shutdown
- R2(config-if)# exit
- R2(config)#interface Serial0/0/0
- R2(config-if)# description DCE Connected to R1
- R2(config-if)# ip address 172.16.3.2 255.255.255.252
- R2(config-if)# clock rate 2000000
- R2(config-if)# no shutdown
- R2(config-if)# exit
- R2(config)#interface Serial0/0/1
- R2(config-if)#description DCE Connected to R3
- R2(config-if)# ip address 192.168.10.9 255.255.255.252
- R2(config-if)# clock rate 2000000
- R2(config-if)# no shutdown
- R2(config-if)# exit
- R2(config)#interface Serial0/1/0
- R2(config-if)#description Connected to ISP
- R2(config-if)# ip address 209.165.200.225 255.255.255.224
- R2(config-if)# no shutdown
- R2(config-if)# exit
- R2(config)#interface Serial0/1/1
- R2(config-if)# no ip address
- R2(config-if)# clock rate 2000000
- R2(config-if)# shutdown
- R2(config-if)# exit
- R2(config)#interface Vlan1
- R2(config-if)# no ip address
- R2(config-if)# shutdown
- R2(config-if)# exit
- R2(config)#ip route 0.0.0.0 0.0.0.0 s0/1/0
- R2(config)#router ospf 1
- R2(config-router)# log-adjacency-changes
- R2(config-router)# passive-interface GigabitEthernet0/0
- R2(config-router)# passive-interface Serial0/1/0
- R2(config-router)# network 172.16.2.0 0.0.0.255 area 0
- R2(config-router)# network 172.16.3.0 0.0.0.3 area 0
- R2(config-router)# network 192.168.10.8 0.0.0.3 area 0
- R2(config-router)# network 209.165.200.224 0.0.0.31 area 0
- R2(config-router)# default-information originate
- R2(config-router)#end
- R2#
Router R1 konfigurationer
- R1(config)#no ip domain-lookup
- R1(config)#interface GigabitEthernet0/0
- R1(config-if)#description Connected to LAN 1
- R1(config-if)# ip address 172.16.1.1 255.255.255.0
- R1(config-if)# duplex auto
- R1(config-if)# speed auto
- R1(config-if)# no shutdown
- R1(config-if)# exit
- R1(config)#interface GigabitEthernet0/1
- R1(config-if)# no ip address
- R1(config-if)# duplex auto
- R1(config-if)# speed auto
- R1(config-if)# shutdown
- R1(config-if)# exit
- R1(config)#interface GigabitEthernet0/2
- R1(config-if)# no ip address
- R1(config-if)# duplex auto
- R1(config-if)# speed auto
- R1(config-if)# shutdown
- R1(config-if)# exit
- R1(config)#interface Serial0/0/0
- R1(config-if)#description Connected to R2
- R1(config-if)# ip address 172.16.3.1 255.255.255.252
- R1(config-if)# no shutdown
- R1(config-if)# exit
- R1(config)#interface Serial0/0/1
- R1(config-if)#description DCE Connected to R3
- R1(config-if)# ip address 192.168.10.5 255.255.255.252
- R1(config-if)# clock rate 2000000
- R1(config-if)# no shutdown
- R1(config-if)# exit
- R1(config)#interface Serial0/1/0
- R1(config-if)# no ip address
- R1(config-if)# clock rate 2000000
- R1(config-if)# shutdown
- R1(config-if)# exit
- R1(config)#interface Serial0/1/1
- R1(config-if)# no ip address
- R1(config-if)# clock rate 2000000
- R1(config-if)# shutdown
- R1(config-if)# exit
- R1(config)#interface Vlan1
- R1(config-if)# no ip address
- R1(config-if)# shutdown
- R1(config-if)# exit
- R1(config)#router ospf 1
- R1(config-router)# log-adjacency-changes
- R1(config-router)# passive-interface GigabitEthernet0/0
- R1(config-router)# network 172.16.1.0 0.0.0.255 area 0
- R1(config-router)# network 172.16.3.0 0.0.0.3 area 0
- R1(config-router)# network 192.168.10.4 0.0.0.3 area 0
- R1(config-router)#end
- R1#
Router R3 konfigurationer
- R3(config)#no ip domain-lookup
- R3(config)#!
- R3(config)#interface GigabitEthernet0/0
- R3(config-if)#description Connected to LAN 3
- R3(config-if)# ip address 192.168.1.1 255.255.255.0
- R3(config-if)# duplex auto
- R3(config-if)# speed auto
- R3(config-if)# no shutdown
- R3(config-if)# exit
- R3(config)#interface GigabitEthernet0/1
- R3(config-if)# no ip address
- R3(config-if)# duplex auto
- R3(config-if)# speed auto
- R3(config-if)# shutdown
- R3(config-if)#interface GigabitEthernet0/2
- R3(config-if)# no ip address
- R3(config-if)# duplex auto
- R3(config-if)# speed auto
- R3(config-if)# shutdown
- R3(config-if)# exit
- R3(config)#interface Serial0/0/0
- R3(config-if)#description Connected to R1
- R3(config-if)# ip address 192.168.10.6 255.255.255.252
- R3(config-if)# no shutdown
- R3(config-if)# exit
- R3(config)#interface Serial0/0/1
- R3(config-if)#description Connected to R2
- R3(config-if)# ip address 192.168.10.10 255.255.255.252
- R3(config-if)# no shutdown
- R3(config-if)# exit
- R3(config)#!
- R3(config)#interface Serial0/1/0
- R3(config-if)# no ip address
- R3(config-if)# clock rate 2000000
- R3(config-if)# shutdown
- R3(config-if)#interface Serial0/1/1
- R3(config-if)# no ip address
- R3(config-if)# clock rate 2000000
- R3(config-if)# shutdown
- R3(config-if)#interface Vlan1
- R3(config-if)# no ip address
- R3(config-if)# shutdown
- R3(config-if)# exit
- R3(config)#router ospf 1
- R3(config-router)# log-adjacency-changes
- R3(config-router)# passive-interface GigabitEthernet0/0
- R3(config-router)# network 192.168.1.0 0.0.0.255 area 0
- R3(config-router)# network 192.168.10.4 0.0.0.3 area 0
- R3(config-router)# network 192.168.10.8 0.0.0.3 area 0
- R3(config-router)# default-information originate
- R3(config-router)#end
- R3#