dongling Publish time 2021-7-5 10:43:06

How to configure OSPF?

Overview OSPF (Open Shortest Path First) is an internal gateway routing protocol based on link status developed by the IETF OSPF work group. OSPF, a routing protocol specific for IP, directly runs on the IPlayer. Its protocol number is 89. OSPF packets are exchanged in multicast form using the multicast address 224.0.0.5 (for all OSPF routers) and 224.0.0.6 (for specified routers).Note: we recommend that you can give priority to OSPF to build your network I. RequirementsUse OSFP to build your network and every node in the network can communicate with each other. II. Network Topology                                             https://img.sobot.com/console/eee7ec2e351e4569a4791536fb5f0973/kb/image/5ed6b5e5298c496fb2458930f17b6723.png
III. Configuration Tips1. Assign IP addresss to R1, R2 SW3 and SW42. Initialize OSPF process on all devices and define corresponding interfaces which OSPF runs and define the area ID for those interfaces.3. (Optional) Modify network type on interfaces that have OSPF enabled IV. Configuration Steps1. Assign IP addresss to R1, R2 SW3 and SW4Ruijie(config)#hostname R1R1(config)#interface gigabitEthernet 0/0R1(config-GigabitEthernet 0/0)#ip address 192.168.1.1 255.255.255.0R1(config-GigabitEthernet 0/0)#exitR1(config)#interface gigabitEthernet 0/1R1(config-GigabitEthernet 0/1)#ip address 10.1.1.1 255.255.255.0R1(config-GigabitEthernet 0/1)#exitR1(config)#interface loopback 0                                             ----->configure IP address of Loopback 0 as OSPF Router-idR1(config-if-Loopback 0)#ip address 1.1.1.1 255.255.255.255 R1(config-if-Loopback 0)#exit Ruijie(config)#hostname R2R2(config)#interface fastEthernet 0/0R2(config-if-FastEthernet 0/0)#ip address 192.168.1.2 255.255.255.0R2(config-if-FastEthernet 0/0)#exitR2(config)#interface fastEthernet 0/1R2(config-if-FastEthernet 0/1)#ip address 192.168.2.1 255.255.255.0R2(config-if-FastEthernet 0/1)#exitR2(config)#interface loopback 0R2(config-if-Loopback 0)#ip address 2.2.2.2 255.255.255.255R2(config-if-Loopback 0)#exit Ruijie(config)#hostname SW3SW3(config)#interface GigabitEthernet 0/26SW3(config-if-GigabitEthernet 0/26)#no switchportSW3(config-if-GigabitEthernet 0/26)#ip address 192.168.2.2 255.255.255.0SW3(config-if-GigabitEthernet 0/26)#exitSW3(config)#interface GigabitEthernet 0/25SW3(config-if-GigabitEthernet 0/25)#no switchportSW3(config-if-GigabitEthernet 0/25)#ip address 192.168.3.1 255.255.255.0SW3(config-if-GigabitEthernet 0/25)#exitSW3(config)#interface loopback 0SW3(config-if-Loopback 0)#ip address 3.3.3.3 255.255.255.255SW3(config-if-Loopback 0)#exit Ruijie(config)#hostname SW4SW4(config)#interface gigabitEthernet 0/25SW4(config-if-GigabitEthernet 0/25)#no switchportSW4(config-if-GigabitEthernet 0/25)#ip address 192.168.3.2 255.255.255.0SW4(config-if-GigabitEthernet 0/25)#exitSW4(config)#interface gigabitEthernet 0/1SW4(config-if-GigabitEthernet 0/1)#no switchportSW4(config-if-GigabitEthernet 0/1)#ip address 10.4.1.1 255.255.255.0SW4(config-if-GigabitEthernet 0/1)#exitSW4(config)#interface loopback 0SW4(config-if-Loopback 0)#ip address 4.4.4.4 255.255.255.255SW4(config-if-Loopback 0)#exit 2. Initialize OSPF process on all devices and define corresponding interfaces which OSPF runs and define the area ID for those interfaces.Note:1) OSPF doesn't propagate process ID to neighbor, so process ID can be different in an OSPF area.2) OSPF detects peer neighbor area ID in hello packet while establishing OSPF neighbor.OSPF area ID of OSPF neighbor must match.R1(config)#router ospf 1                                                 ----->enable OSPF globally , and process ID is 1R1(config-router)#network 192.168.1.1 0.0.0.0 area 1   ----->OSPF area 1 runs on interface 192.168.1.1R1(config-router)#network 10.1.1.1 0.0.0.0 area 1R1(config-router)#exit R2(config)#router ospf 1R2(config-router)#network 192.168.1.2 0.0.0.0 area 1R2(config-router)#network 192.168.2.1 0.0.0.0 area 0R2(config-router)#exit SW3(config)#router ospf 1SW3(config-router)#network 192.168.2.2 0.0.0.0 area 0SW3(config-router)#network 192.168.3.1 0.0.0.0 area 2SW3(config-router)#exit SW4(config)#router ospf 1SW4(config-router)#network 192.168.3.2 0.0.0.0 area 2SW4(config-router)#network 10.4.1.1 0.0.0.0 area 2SW4(config-router)#exit 3. (Optional) Modify network type on interfaces that have OSPF enabledNote:By default, OSPF interface network type is broadcast in Ethernet and it costs about 40 seconds to elect DR/BDR. We recommend that you modify network type to point-to-point type in Ethernet to accelerate OSPF neighbor convergence.R2(config)#interface fastEthernet 0/1R2(config-if-FastEthernet 0/1)#ip ospf network point-to-point      ----->modify OSPF interface network type to point-to-point(you must configure both OSPF peers at the same time)R2(config-if-FastEthernet 0/1)#exit SW3(config)#interface fastEthernet 0/1SW3(config-if-FastEthernet 0/1)#ip ospf network point-to-pointSW3(config-if-FastEthernet 0/1)#exit V. Verification1. How to display OSPF neighbor tablehttps://img.sobot.com/console/eee7ec2e351e4569a4791536fb5f0973/kb/image/875a7324831941f99c854b210614bc18.png2. How to display IP route table https://img.sobot.com/console/eee7ec2e351e4569a4791536fb5f0973/kb/image/4640eb7fe92b424b9f6f13b44332ed2e.png

Pages: [1]
View full version: How to configure OSPF?