Några exempel där OSPF nätverk konfigureras för att illustrera konceptet och konkretisera begreppen.
Exempel 1: Multiarea
Konfigurationer
- Router> enable
- Router# configure terminal
- Router(config)# hostname R1
- R1(config)# interface g0/1
- R1(config-if)# ip address 192.168.1.1 255.255.255.0
- R1(config-if)# no shut
- R1(config-if)# interface s0/0/0
- R1(config-if)# ip address 10.10.10.1 255.255.255.252
- R1(config-if)# clock rate 64000
- R1(config-if)# bandwidth 1024
- R1(config-if)# no shut
- R1(config-if)# interface s0/1/0
- R1(config-if)# ip address 10.10.10.5 255.255.255.252
- R1(config-if)# clock rate 64000
- R1(config-if)# bandwidth 1024
- R1(config-if)# no shut
- R1(config-if)# interface s0/0/1
- R1(config-if)# ip address 10.10.10.9 255.255.255.252
- R1(config-if)# clock rate 64000
- R1(config-if)# bandwidth 128
- R1(config-if)# no shut
- R1(config-if)# end
- R1#
- Router> enable
- Router# configure terminal
- Router(config)# hostname R2
- R2(config)# interface s0/0/0
- R2(config-if)# ip address 10.10.10.2 255.255.255.252
- R2(config-if)# clock rate 64000
- R2(config-if)# bandwidth 1024
- R2(config-if)# no shut
- R2(config-if)# interface s0/0/1
- R2(config-if)# ip address 10.10.10.13 255.255.255.252
- R2(config-if)# clock rate 64000
- R2(config-if)# bandwidth 512
- R2(config-if)# no shut
- R2(config-if)# end
- R2#
- Router> enable
- Router# configure terminal
- Router(config)# hostname R3
- R3(config-if)# interface G0/1
- R3(config-if)# ip address 192.168.2.1 255.255.255.0
- R3(config-if)# no shut
- R3(config-if)# interface s0/0/1
- R3(config-if)# ip address 10.10.10.14 255.255.255.252
- R3(config-if)# bandwidth 512
- R3(config-if)# no shut
- R3(config-if)# interface s0/1/0
- R3(config-if)# ip address 10.10.10.18 255.255.255.252
- R3(config-if)# bandwidth 1024
- R3(config-if)# no shut
- R3(config-if)# interface s0/0/0
- R3(config-if)# ip address 10.10.10.22 255.255.255.252
- R3(config-if)# bandwidth 768
- R3(config-if)# no shut
- R3(config-if)# end
- Router> enable
- Router# configure terminal
- Router(config)# hostname R4
- R4(config)# interface s0/0/0
- R4(config-if)# ip address 10.10.10.21 255.255.255.252
- R4(config-if)# clock rate 64000
- R4(config-if)# bandwidth 768
- R4(config-if)# no shut
- R4(config-if)# interface s0/0/1
- R4(config-if)# ip address 10.10.10.10 255.255.255.252
- R4(config-if)# bandwidth 128
- R4(config-if)# no shut
- R4(config-if)# end
- Router> enable
- Router# configure terminal
- Router(config)# hostname R5
- R5(config)#interface s0/0/0
- R5(config-if)# ip address 10.10.10.6 255.255.255.252
- R5(config-if)# bandwidth 1024
- R5(config-if)# no shut
- R5(config-if)# interface s0/0/1
- R5(config-if)# ip address 10.10.10.17 255.255.255.252
- R5(config-if)# clock rate 64000
- R5(config-if)# bandwidth 1024
- R5(config-if)# no shut
- R5(config-if)# end
- R5#
- OSPF R1
- R1# configure terminal
- R1(config)# router ospf 1
- R1(config-router)# network 192.168.1.0 0.0.0.255 area 0
- R1(config-router)# network 10.10.10.0 0.0.0.3 area 0
- R1(config-router)# network 10.10.10.4 0.0.0.3 area 0
- R1(config-router)# network 10.10.10.8 0.0.0.3 area 0
- R1(config-router)# router-id 1.1.1.1
- R1(config-router)# end
- OSPF R2
- R2# configure terminal
- R2(config)# router ospf 1
- R2(config-router)# network 10.10.10.0 0.0.0.3 area 0
- R2(config-router)# network 10.10.10.12 0.0.0.3 area 1
- R2(config-router)# router-id 2.2.2.2
- R2(config-router)# end
- OSPF R5
- R5# configure terminal
- R5(config)# router ospf 1
- R5(config-router)# network 10.10.10.4 0.0.0.3 area 0
- R5(config-router)# network 10.10.10.16 0.0.0.3 area 1
- R5(config-router)# router-id 5.5.5.5
- R5(config-router)# end
- OSPF R4
- R4# configure terminal
- R4(config)# router ospf 1
- R4(config-router)# network 10.10.10.8 0.0.0.3 area 0
- R4(config-router)# network 10.10.10.20 0.0.0.3 area 1
- R4(config-router)# router-id 4.4.4.4
- R4(config-router)# end
- OSPF R3
- R3# configure terminal
- R3(config)# router ospf 1
- R3(config-router)# network 192.168.2.0 0.0.0.255 area 1
- R3(config-router)# network 10.10.10.12 0.0.0.3 area 1
- R3(config-router)# network 10.10.10.16 0.0.0.3 area 1
- R3(config-router)# network 10.10.10.20 0.0.0.3 area 1
- R3(config-router)# router-id 3.3.3.3
- R3(config-router)# end
Kommando | Illustration |
R1# show ip ospf
|
![]() |
R1# show ip ospf neighbor
|
![]() |
Kommando | Illustration |
R1# show ip ospf border-routers
|
![]() |
R1# show ip route ospf R1# show ip ospf route
|
![]() |