OSPF Configuration Guide
此内容尚不支持你的语言。
OSPF (Open Shortest Path First) is an Interior Gateway Protocol (IGP) used for making routing decisions within a single Autonomous System (AS). It is an implementation of a link-state routing protocol and operates within the context of an Autonomous System. Currently, OSPF Version 2 (RFC2328) is used for IPv4 protocol, while OSPF Version 3 (RFC2740) is used for IPv6 protocol. In this document, OSPF refers to OSPF Version 2.
Network requirements
There are three devices in the network. Now we need to achieve interoperability between the three devices, and later we can continue to expand the whole network based on DeviceA and DeviceB as the main service devices.

Procedure
1.Configure the VLAN to which each interface belongs
# Device A
sonic(config)# vlan 100sonic(config)# interface ethernet 5sonic(config-if-5)# switchport access vlan 100# Device B
sonic(config)# vlan 100sonic(config)# vlan 200sonic(config)# interface ethernet 5sonic(config-if-5)# switchport access vlan 100sonic(config)# interface ethernet 4sonic(config-if-4)# switchport access vlan 200# Device C
sonic(config)# vlan 200sonic(config)# interface ethernet 4sonic(config-if-4)# switchport access vlan 2002.Configure the IP address of each VLAN interface
# Device A
sonic(config)# interface vlan 100sonic(config-vlanif-100)# ip address 30.0.0.2/30# Device B
sonic(config)# interface vlan 100sonic(config-vlanif-100)# ip address 30.0.0.1/30sonic(config)# interface vlan 200sonic(config-vlanif-200)# ip address 20.0.0.1/30# Device C
sonic(config)# interface vlan 200sonic(config-vlanif-200)# ip address 20.0.0.2/303.Configuring OSPF Basic Features
# Device A
sonic(config)# router ospfsonic(config-router)# network 30.0.0.1/30 area 2Device B:
sonic(config)# router ospfsonic(config-router)# network 20.0.0.2/30 area 2sonic(config-router)# network 30.0.0.2/30 area 1Device C:
sonic(config)# router ospfsonic(config-router)# network 20.0.0.1/30 area 1Verify configuration
Take Device B as an example to check the neighbor table
sonic# show ip ospf neighborNeighbor ID Pri State Dead Time Address Interface RXmtL RqstL DBsmL10.15.96.5 1 Full/Backup 38.317s 20.0.0.2 Ethernet4:30.11.13.22 0 0 010.15.96.5 1 Full/Backup 32.958s 30.0.0.2 Ethernet5:30.11.13.26 0 0 0