Ruijie Community

Title: How to configure OSPF? [Print this page]

Author: dongling    Time: 2021-7-5 10:43
Title: 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. Requirements
Use OSFP to build your network and every node in the network can communicate with each other.
II. Network Topology
                                               

III. Configuration Tips
1. Assign IP addresss to R1, R2 SW3 and SW4
2. 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 Steps
1. Assign IP addresss to R1, R2 SW3 and SW4
Ruijie(config)#hostname R1
R1(config)#interface gigabitEthernet 0/0
R1(config-GigabitEthernet 0/0)#ip address 192.168.1.1 255.255.255.0
R1(config-GigabitEthernet 0/0)#exit
R1(config)#interface gigabitEthernet 0/1
R1(config-GigabitEthernet 0/1)#ip address 10.1.1.1 255.255.255.0
R1(config-GigabitEthernet 0/1)#exit
R1(config)#interface loopback 0                                             ----->configure IP address of Loopback 0 as OSPF Router-id
R1(config-if-Loopback 0)#ip address 1.1.1.1 255.255.255.255
R1(config-if-Loopback 0)#exit
Ruijie(config)#hostname R2
R2(config)#interface fastEthernet 0/0
R2(config-if-FastEthernet 0/0)#ip address 192.168.1.2 255.255.255.0
R2(config-if-FastEthernet 0/0)#exit
R2(config)#interface fastEthernet 0/1
R2(config-if-FastEthernet 0/1)#ip address 192.168.2.1 255.255.255.0
R2(config-if-FastEthernet 0/1)#exit
R2(config)#interface loopback 0
R2(config-if-Loopback 0)#ip address 2.2.2.2 255.255.255.255
R2(config-if-Loopback 0)#exit
Ruijie(config)#hostname SW3
SW3(config)#interface GigabitEthernet 0/26
SW3(config-if-GigabitEthernet 0/26)#no switchport
SW3(config-if-GigabitEthernet 0/26)#ip address 192.168.2.2 255.255.255.0
SW3(config-if-GigabitEthernet 0/26)#exit
SW3(config)#interface GigabitEthernet 0/25
SW3(config-if-GigabitEthernet 0/25)#no switchport
SW3(config-if-GigabitEthernet 0/25)#ip address 192.168.3.1 255.255.255.0
SW3(config-if-GigabitEthernet 0/25)#exit
SW3(config)#interface loopback 0
SW3(config-if-Loopback 0)#ip address 3.3.3.3 255.255.255.255
SW3(config-if-Loopback 0)#exit
Ruijie(config)#hostname SW4
SW4(config)#interface gigabitEthernet 0/25
SW4(config-if-GigabitEthernet 0/25)#no switchport
SW4(config-if-GigabitEthernet 0/25)#ip address 192.168.3.2 255.255.255.0
SW4(config-if-GigabitEthernet 0/25)#exit
SW4(config)#interface gigabitEthernet 0/1
SW4(config-if-GigabitEthernet 0/1)#no switchport
SW4(config-if-GigabitEthernet 0/1)#ip address 10.4.1.1 255.255.255.0
SW4(config-if-GigabitEthernet 0/1)#exit
SW4(config)#interface loopback 0
SW4(config-if-Loopback 0)#ip address 4.4.4.4 255.255.255.255
SW4(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 1
R1(config-router)#network 192.168.1.1 0.0.0.0 area 1     ----->OSPF area 1 runs on interface 192.168.1.1
R1(config-router)#network 10.1.1.1 0.0.0.0 area 1
R1(config-router)#exit
R2(config)#router ospf 1
R2(config-router)#network 192.168.1.2 0.0.0.0 area 1
R2(config-router)#network 192.168.2.1 0.0.0.0 area 0
R2(config-router)#exit
SW3(config)#router ospf 1
SW3(config-router)#network 192.168.2.2 0.0.0.0 area 0
SW3(config-router)#network 192.168.3.1 0.0.0.0 area 2
SW3(config-router)#exit
SW4(config)#router ospf 1
SW4(config-router)#network 192.168.3.2 0.0.0.0 area 2
SW4(config-router)#network 10.4.1.1 0.0.0.0 area 2
SW4(config-router)#exit
3. (Optional) Modify network type on interfaces that have OSPF enabled
Note: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/1
R2(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/1
SW3(config-if-FastEthernet 0/1)#ip ospf network point-to-point
SW3(config-if-FastEthernet 0/1)#exit
V. Verification
1. How to display OSPF neighbor table
2. How to display IP route table







Welcome to Ruijie Community (https://community.ruijienetworks.com/) Powered by Discuz! X3.2