Command Line Reference
IP Unicast Routing
OSPFv2 Configuration
45 min
show ip ospf show ip ospf \[command] show ip ospf \[ vrf name |all] \[json] \[purpose] display ospf details \[view] system view \[use cases] sonic# show ip ospf vrf all json { "ospfinstance" 2, "1" { "vrfname" "1", "vrfid" 138, "routerid" "2 2 2 1", "tosroutesonly"\ true, "rfc2328conform"\ true, "spfscheduledelaymsecs" 0, "holdtimeminmsecs" 50, "holdtimemaxmsecs" 5000, "holdtimemultplier" 1, "spflastexecutedmsecs" 167987, "spflastdurationmsecs" 0, "lsaminintervalmsecs" 5000, "lsaminarrivalmsecs" 1000, "writemultiplier" 20, "refreshtimermsecs" 10000, "lsaexternalcounter" 0, "lsaexternalchecksum" 0, "lsaasopaquecounter" 0, "lsaasopaquechecksum" 0, "attachedareacounter" 1, "areas" { "3 1 1 1" { "shortcuttingmode" "default", "areaiftotalcounter" 1, "areaifactivecounter" 1, "nbrfulladjacentcounter" 1, "authentication" "authenticationnone", "virtualadjacenciespassingcounter" 0, "spfexecutedcounter" 8, "lsanumber" 3, "lsarouternumber" 2, "lsarouterchecksum" 74376, "lsanetworknumber" 1, "lsanetworkchecksum" 45432, "lsasummarynumber" 0, "lsasummarychecksum" 0, "lsaasbrnumber" 0, "lsaasbrchecksum" 0, "lsanssanumber" 0, "lsanssachecksum" 0, "lsaopaquelinknumber" 0, "lsaopaquelinkchecksum" 0, "lsaopaqueareanumber" 0, "lsaopaqueareachecksum" 0 } } } } show ip ospf interface show ip ospf interface \[command] show ip ospf \[ vrf name | all ] interface \[ ethernet interface name |vlan vlan id |link aggregation lag id ] \[purpose] show state and configuration of ospf the specified interface, or all interfaces if no interface is given \[parameter] parameter description interface name ethernet interface name (0 54) vlan id vlan id (1 4094) lag id link aggregation interface number \[view] system view \[use cases] sonic# show ip ospf vrf 1 interface vlan 20 ospf instance 2 vrf name 1 vlan20 is up ifindex 113, mtu 9216 bytes, bw 10 mbit \<up,broadcast,running,allmulti,multicast> internet address 20 1 1 1/24, broadcast 20 1 1 255, area 3 1 1 1 mtu mismatch detection enabled router id 2 2 2 1, network type broadcast, cost 10000 transmit delay is 1 sec, state backup, priority 1 designated router (id) 2 2 2 2 interface address 20 1 1 2/24 backup designated router (id) 2 2 2 1, interface address 20 1 1 1 multicast group memberships ospfallrouters ospfdesignatedrouters timer intervals configured, hello 10s, dead 40s, wait 40s, retransmit 5 hello due in 3 869s neighbor count is 1, adjacent neighbor count is 1 show ip ospf neighbor show ip ospf neighbor \[command] show ip ospf \[ vrf name | all ] neighbor \[ ethernet interface name |vlan vlan id |link aggregation lag id | a b c d ]\[detail]\[all]\[json] \[purpose] display lsa information of lsdb json o/p of this command covers base route information i e all lsas except opaque lsa info \[parameter] parameter description interface name ethernet interface name (0 54) vlan id vlan id (1 4094) lag id link aggregation interface number a b c d ip address \[view] system view \[use cases] sonic# show ip ospf vrf all neighbor ospf instance 2 vrf name 1 neighbor id pri state up time dead time address interface rxmtl rqstl dbsml 2 2 2 2 1 full/dr 14m07s 32 466s 20 1 1 2 vlan20 20 1 1 1 0 0 0 show ip ospf database {max age|self originate} show ip ospf database {max age|self originate} \[command] show ip ospf \[ vrf { name |all| instance }] database max age {max age|self originate} \[purpose] show the ospf database summary \[parameter] parameter description name vrf name instance instance id (1 65535) \[view] system view \[use cases] sonic# show ip ospf vrf all database max age show ip ospf database {opaque link|opaque area|opaque external} show ip ospf database {opaque link|opaque area|opaque external} \[command] show ip ospf \[ vrf { name |all| instance }] database { opaque link|opaque area|opaque external } \[ a b c d ]\[ adv router a b c d ]\[self originate] \[purpose] show opaque lsa from the database \[parameter] parameter description name vrf name instance instance id (1 65535) a b c d ip address \[view] system view \[use cases] sonic# show ip ospf database opaque link show ip ospf route show ip ospf route \[command] show ip ospf \[ vrf name |all] route \[json] \[purpose] show the ospf routing table, as determined by the most recent spf calculation \[view] system view \[use cases] sonic# show ip ospf vrf all route ospf instance 2 vrf name 1 \============ ospf network routing table ============ n 20 1 1 0/24 \[10000] area 3 1 1 1 directly attached to vlan20 \============ ospf router routing table ============= \============ ospf external routing table =========== show ip ospf router info show ip ospf router info \[command] show ip ospf router info \[pce] \[purpose] show router capabilities flag \[view] system view \[use cases] sonic# show ip ospf router info pce router ospf router ospf \[command] router ospf \[ instance id ] \[ vrf name ] no router ospf \[ instance id ] \[purpose] enable or disable the ospf process \[parameter] parameter description name vrf name instance id ospf instance id, the range of value 1 65535 \[usage scenario] ospf supports multiple instances, allowing a single router to run several independent ospf instances that do not interfere with one another these instances operate independently, and route exchanges between different ospf instances are analogous to route exchanges between different routing protocols each router interface can belong to only one ospf process \[notes] ospf supports up to 10 instances on a single router \[view] system configuration view \[use cases] sonic# configure terminal sonic(config)# router ospf sonic(config router)# ospf router id ospf router id \[command] ospf router id a b c d no ospf router id a b c d \[purpose] this sets the router id of the ospf process \[parameter] parameter description a b c d ospf router id in ip address format \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf sonic(config router)# ospf router id 1 1 1 1 ospf rfc1583 compatibility ospf rfc1583 compatibility \[command] ospf rfc1583compatibility no ospf rfc1583compatibility \[purpose] rfc 2328, the successor to rfc 1583, suggests according to section g 2 (changes) in section 16 4 a change to the path preference algorithm that prevents possible routing loops that were possible in the old version of ospfv2 more specifically it demands that inter area paths and intra area backbone path are now of equal preference but still both preferred to external paths \[view] ospf view \[notes] this command disables opsf rfc1583compatibility \[use cases] sonic# configure terminal sonic(config)# router ospf sonic(config router)# ospf rfc1583compatibility network area network area \[command] network a b c d/m area { a b c d | area id } no network a b c d/m area { a b c d | area id } \[purpose] this command specifies the ospf enabled interface(s) \[parameter] parameter description a b c d/m network address a b c d ospf router id area id area id \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf sonic(config router)# network 1 1 1 1/24 area 11 area range area range a b c d/m \[command] area { a b c d | area id } range a b c d/m \[ advertise \[ cost metric ]] no area { a b c d | area id } range a b c d/m \[ advertise \[ cost metric ]] \[purpose] summarize intra area paths from specified area into one type 3 summary lsa announced to other areas \[parameter] parameter description a b c d/m network address a b c d ospf router id area id area id metric advertised metric for this range (0 16777215) \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf sonic(config router)# area 1 1 1 1 range 1 1 1 1/32 advertise cost 100 area range area range \[command] area { a b c d | area id } range a b c d/m {substitute a b c d/m |cost metric } no area { a b c d | area id } range a b c d/m {substitute a b c d/m |cost metric } \[purpose] substitute summarized prefix with another prefix \[parameter] parameter description a b c d/m network address area id area id metric advertised metric for this range (0 16777215) \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf sonic(config router)# area 1 1 1 1 range 1 1 1 1/32 advertise cost 100 area area \[command] area { a b c d | area id } {stub|nssa} \[no summary] no area { a b c d | area id } {stub|nssa} \[no summary] \[purpose] prevents an ospf abr from injecting inter area summaries into the specified stub area \[parameter] parameter description a b c d ospf router id area id area id \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf sonic(config router)# area 1 1 1 1 stub no summary ip ospf area ip ospf area \[command] ip ospf area \[ instance id ] { a b c d | area id } \[ a b c d ] no ip ospf area \[ instance id ] { a b c d | area id } \[ a b c d ] \[purpose] enable ospf on the interface, optionally restricted to just the ip address given by addr, putting it in the area area \[parameter] parameter description a b c d ospf router id area id area id a b c d address of interface instance id ospf instance id \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 49 sonic(config if 49)# ip ospf area 1 1 1 1 2 2 2 2 ip ospf authentication key ip ospf authentication key \[command] ip ospf authentication key key \[ a b c d ] no ip ospf authentication key key \[ a b c d ] \[purpose] set ospf authentication key to a simple password after setting auth key, all ospf packets are authenticated auth key has length up to 8 chars \[parameter] parameter description key the ospf password (key) a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 49 sonic(config if 49)# ip ospf authentication key test123 1 1 1 1 ip ospf authentication ip ospf authentication \[command] ip ospf authentication \[ message digest ] \[ a b c d ] no ip ospf authentication \[ message digest ] \[ a b c d ] \[purpose] specify that md5 hmac authentication must be used on this interface \[parameter] parameter description a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 49 sonic(config if 49)# ip ospf authentication message digest 1 1 1 1 ip ospf message digest key ip ospf message digest key \[command] ip ospf message digest key key id md5 md5 \[ a b c d ] no ip ospf message digest key key id md5 md5 \[ a b c d ] \[purpose] set ospf authentication key to a cryptographic password the cryptographic algorithm is md5 \[parameter] parameter description key id key id (1 255) md5 use md5 algorithm a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 49 sonic(config if 49)# ip ospf message digest key 2 md5 s 1 1 1 1 ip ospf cost ip ospf cost \[command] ip ospf cost cost \[ a b c d ] no ip ospf cost cost \[ a b c d ] \[purpose] set link cost for the specified interface \[parameter] parameter description cost cost (1 65535) a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 49 sonic(config if 49)# ip ospf cost 12 ip ospf dead interval ip ospf dead interval \[command] ip ospf dead interval { interval |minimal hello multiplier number } \[ a b c d ] no ip ospf dead interval { interval |minimal hello multiplier number } \[ a b c d ] \[purpose] set interface’s router dead interval default value is 40 \[parameter] parameter description interval seconds (1 65535) number number of hellos to send each second (1 10) a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 49 sonic(config if 49)# ip ospf dead interval 2 1 1 1 1 ip ospf hello interval ip ospf hello interval \[command] ip ospf hello interval interval \[ a b c d ] no ip ospf hello interval interval \[ a b c d ] \[purpose] set interface’s hello interval default 10 \[parameter] parameter description interval seconds (1 65535) a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 49 sonic(config if 49)# ip ospf hello interval 2 1 1 1 1 ip ospf network ip ospf network \[command] ip ospf network {broadcast|non broadcast|point to multipoint|point to point} no ip ospf network {broadcast|non broadcast|point to multipoint|point to point} \[purpose] set explicitly network type for specified interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 49 sonic(config if 49)# ip ospf network broadcast ip ospf priority ip ospf priority \[command] ip ospf priority priority \[ a b c d ] no ip ospf priority priority \[ a b c d ] \[purpose] set router priority integer value \[parameter] parameter description priority priority (0 255) a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 49 sonic(config if 49)# ip ospf priority 12 ip ospf retransmit interval ip ospf retransmit interval \[command] ip ospf retransmit interval interval \[ a b c d ] no ip ospf retransmit interval interval \[ a b c d ] \[purpose] set number of seconds for rxmtinterval timer value \[parameter] parameter description interval seconds (1 65535) a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 49 sonic(config if 49)# ip ospf retransmit interval 2 ip ospf transmit delay ip ospf transmit delay \[command] ip ospf transmit delay interval \[ a b c d ] no ip ospf transmit delay interval \[ a b c d ] \[purpose] set number of seconds for inftransdelay value \[parameter] parameter description interval seconds (1 65535) a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 49 sonic(config if 49)# ip ospf retransmit interval 2 ip ospf mtu ignore ip ospf mtu ignore \[command] ip ospf mtu ignore no ip ospf mtu ignore \[purpose] ignore mtu when establish ospf \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 49 sonic(config if 49)# ip ospf mtu ignore redistribute redistribute \[command] redistribute { babel|bgp|connected|eigrp|isis|kernel|openfabric|ospf|rip|sharp|static|table } \[ metric type metric type ] \[ metric metric ] \[ route map route map ] no redistribute { babel|bgp|connected|eigrp|isis|kernel|openfabric|ospf|rip|sharp|static|table } \[ metric type metric type ] \[ metric metric ] \[ route map route map ] \[purpose] redistribute routes of the specified protocol or kind into ospf, with the metric type and metric set if specified, filtering the routes using the given route map if specified \[parameter] parameter description metric type set ospf external type 1/2 metrics (1 2) metric ospf default metric (0 16777214) route map pointer to route map entries \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf sonic(config router)# redistribute static metric type 1 metric 2 route map test default information originate default information originate \[command] default information originate \[ always ] \[ metric type metric type ]\[ metric metric ] \[ route map route map ] no default information originate \[ always ] \[ metric type metric type ]\[ metric metric ] \[ route map route map ] \[purpose] originate an as external (type 5) lsa describing a default route into all external routing capable areas, of the specified metric and metric type if the ‘always’ keyword is given then the default is always advertised, even when there is no default present in the routing table \[parameter] parameter description metric type set ospf external type 1/2 metrics (1 2) metric ospf default metric (0 16777214) route map pointer to route map entries \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf sonic(config router)# default information originate always distribute list distribute list \[command] distribute list string out {babel|bgp|connected|eigrp|isis|kernel|openfabric|ospf|rip|sharp|static|table} no distribute list string out{ babel|bgp|connected|eigrp|isis|kernel|openfabric|ospf|rip|sharp|static|table} \[purpose] apply the access list filter, name, to redistributed routes of the given type before allowing the routes to be redistributed into ospf \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf sonic(config router)# distribute list test out static default metric default metric \[command] default metric metric no default metric metric \[purpose] set default metric \[parameter] parameter description metric ospf default metric (0 16777214) \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf sonic(config router)# default metric 2 distance distance \[command] distance \[ospf {intra area|inter area|external}] distance no distance \[ospf {intra area|inter area|external}] distance \[purpose] set ospf distance \[parameter] parameter description distance distance for external routes (1 255) \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf sonic(config router)# distance ospf external 2
