Command Line Reference
IP Unicast Routing
OSPF Configuration
60 min
ospfv2 configuration 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 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] 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 \[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] 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} \[command] show ip ospf \[vrf { name |all}] database max age {max age|self originate} \[purpose] show the ospf database summary \[parameter] name vrf name \[view] system view \[use cases] sonic# show ip ospf vrf all database max age show ip ospf database {opaque link|opaque area} \[command] show ip ospf \[vrf { name |all}] database {opaque link|opaque area|} \[ a b c d ]\[adv router a b c d ]\[self originate] \[purpose] show opaque lsa from the database \[parameter] name vrf name a b c d ip address \[view] system view \[use cases] sonic# show ip ospf database opaque link show ip ospf route \[json] \[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 \[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 \[ vrf name ] \[command] router ospf \[vrf name ] no router ospf \[purpose] enable or disable the ospf process \[parameter] name vrf name \[view] system configuration view \[use cases] sonic# configure terminal sonic(config)# router ospf sonic(config router)# ospf router id a b c d \[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] 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 \[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 a b c d/m area { a b c d|area id } \[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] 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 {a b c d|area id} 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] 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 {a b c d|area id} range a b c d/m {substitute a b c d/m| cost metric } \[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] 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 substitute 1 1 1 1/32 cost 100 area {a b c d|area id} {stub|nssa} \[no summary] \[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] 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 { a b c d|area id } \[command] ip ospf area { a b c d | area id } \[ a b c d ] no ip ospf area { 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] a b c d ospf router id area id area id a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ip ospf area 1 1 1 1 2 2 2 2 ip ospf authentication key 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] key the ospf password (key) a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ip ospf authentication key test123 1 1 1 1 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] a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ip ospf authentication message digest 1 1 1 1 ip ospf message digest key key id md5 md5 \[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] 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 1 sonic(config if 1)# ip ospf message digest key 2 md5 s 1 1 1 1 ip ospf cost cost \[ a b c d ] \[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] cost cost (1 65535) a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ip ospf cost 12 ip ospf dead interval {interval|minimal hello multiplier number } \[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] 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 1 sonic(config if 1)# ip ospf dead interval 2 1 1 1 1 ip ospf hello interval 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] interval seconds (1 65535) a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ip ospf hello interval 2 1 1 1 1 ip ospf network {broadcast|non broadcast|point to multipoint|point to point} \[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 1 sonic(config if 1)# ip ospf network broadcast ip ospf priority 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] priority priority (0 255) a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ip ospf priority 12 ip ospf retransmit interval 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] interval seconds (1 65535) a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ip ospf retransmit interval 2 ip ospf transmit delay interval \[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] interval seconds (1 65535) a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ip ospf retransmit interval 2 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 1 sonic(config if 1)# ip ospf mtu ignore ip ospf passive \[command] ip ospf passive no ip ospf passive \[purpose] configuring ospf passive interfaces \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ip ospf passive redistribute {babel|bgp|connected|eigrp|isis|kernel|openfabric|ospf|rip|sharp|static|table} \[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] 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 \[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] 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 route map string in \[command] distribute list route map string in \[purpose] apply the route map filter to filter the routes that need to be learned \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf sonic(config router)# distribute list route map test in default metric metric \[command] default metric metric no default metric metric \[purpose] set default metric \[parameter] 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 \[ospf {intra area|inter area|external}] distance \[command] distance \[ospf {intra area|inter area|external}] distance no distance \[ospf {intra area|inter area|external}] distance \[purpose] set ospf distance \[parameter] 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 ospfv3 configuration show ipv6 ospf6 \[command] show ipv6 ospf6 \[purpose] display ospfv3 details \[view] system view \[use cases] sonic# show ipv6 ospf6 show ipv6 ospf6 database \[command] show ipv6 ospf6 database \[detail|dump|internal] show ipv6 ospf6 database \[router|network|inter prefix|inter router|as external|group membership|type 7|link|intra prefix]\[detail|dump|internal] \[purpose] this command shows lsas present in the lsdb \[view] system view \[use cases] sonic# show ipv6 ospf6 database detail show ipv6 ospf6 database adv router a b c d linkstate id a b c d \[command] show ipv6 ospf6 database adv router a b c d linkstate id a b c d \[purpose] the lsas additinally can also be filtered with the linkstate id and advertising router fields \[parameter] a b c d ip address \[view] system view \[use cases] sonic# show ipv6 ospf6 database network adv router 1 1 1 1 linkstate id 1 1 1 1 show ipv6 ospf6 database self originated \[command] show ipv6 ospf6 database self originated \[purpose] this command is used to filter the lsas which are originated by the present router \[view] system view \[use cases] sonic# show ipv6 ospf6 database self originated show ipv6 ospf6 interface \[ethernet interface name|vlan vlan id|link aggregation lag id ] \[command] show ipv6 ospf6 interface \[ethernet interface name |vlan vlan id |link aggregation lag id ] \[purpose] to see ospf interface configuration like costs \[parameter] 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 ipv6 ospf6 interface ethernet 1 show ipv6 ospf6 neighbor \[command] show ipv6 ospf6 neighbor \[purpose] show state and chosen (backup) dr of neighbor \[view] system view \[use cases] sonic# show ipv6 ospf6 neighbor show ipv6 ospf6 interface traffic \[command] show ipv6 ospf6 interface traffic \[purpose] show counts of different packets that have been received and transmitted by the interfaces \[view] system view \[use cases] sonic# show ipv6 ospf6 interface traffic show ipv6 route ospf6 \[command] show ipv6 route ospf6 \[purpose] this command shows internal routing table \[view] system view \[use cases] sonic# show ipv6 route ospf6 show ipv6 ospf6 redistribute \[command] show ipv6 ospf6 redistribute \[purpose] show the routes which are redistributed by the router \[view] system view \[use cases] sonic# show ipv6 ospf6 redistribute show ipv6 ospf6 route x\ x x\ x/m match \[detail] \[command] show ipv6 ospf6 route x\ x x \ x /m match \[detail] \[purpose] the additional match option will match the given address to the destination of the routes, and return the result accordingly \[view] system view \[use cases] sonic# show ipv6 ospf6 route 1 1/64 match detail show ipv6 ospf6 interface \[ethernet interface name|vlan vlan id|link aggregation lag id] prefix \[detail|x\ x x\ x|x\ x x\ x/m \[match|detail]] \[command] show ipv6 ospf6 interface \[ethernet interface name |vlan vlan id |link aggregation lag id ] prefix \[detail| x\ x x \ x |x\ x x \ x /m \[match|detail]] \[purpose] this command shows the prefixes present in the interface routing table interface name can also be given \[parameter] 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 ipv6 ospf6 interface ethernet 1 prefix 1 1/64 match ospf6 router id a b c d \[command] ospf6 router id a b c d \[purpose] this sets the router id of the ospf6 process \[parameter] a b c d ospf6 router id in ip address format \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf6 sonic(config router)# ospf6 router id 1 1 1 1 timers throttle spf delay time init hold time max hold time \[command] timers throttle spf delay time init hold time max hold time no timers throttle spf delay time init hold time max hold time \[purpose] this command sets the initial delay, the initial holdtime and the maximum holdtime \[parameter] delay time time (msec) (0 600000) init hold time inital time (msec) (0 600000) max hold time maxtime (msec) (0 600000) \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf6 sonic(config router)# timers throttle spf 1 2 3 auto cost reference bandwidth bandwidth \[command] auto cost reference bandwidth bandwidth no auto cost reference bandwidth bandwidth \[purpose] this command configures the auto cost reference broadband for ospfv3 \[parameter] bandwidth the reference bandwidth in terms of mbits per second (1 4294967) \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf6 sonic(config router)# auto cost reference bandwidth 2 area {a b c d|area id} range x\ x x \ x /m \[command] area { a b c d | area id } range x\ x x \ x /m \[advertise|not advertise |cost metric ] no area { a b c d | area id } range x\ x x \ x /m \[advertise|not advertise |cost metric ] \[purpose] summarize a group of internal subnets into a single inter area prefix lsa this command can only be used at the area boundary (abr router) \[parameter] x\ x x \ x /m ipv6 prefix a b c d ospf router id metric advertised metric for this range (0 16777215) \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf6 sonic(config router)# area 1 1 1 1 range 1 1/64 advertise ipv6 ospf6 cost cost \[command] ipv6 ospf6 cost cost no ipv6 ospf6 cost cost \[purpose] set link cost for the specified interface \[parameter] cost cost (1 65535) \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ipv6 ospf6 cost 12 ipv6 ospf6 hello interval interval \[command] ipv6 ospf6 hello interval interval no ipv6 ospf6 hello interval interval \[purpose] sets interface’s hello interval default value is 10 \[parameter] interval seconds (1 65535) a b c d address of interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ip ospf hello interval 2 1 1 1 1 ipv6 ospf6 dead interval interval \[command] ipv6 ospf6 dead interval interval no ipv6 ospf6 dead interval interval \[purpose] set interface’s router dead interval default value is 40 \[parameter] interval seconds (1 65535) \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ipv6 ospf6 dead interval 2 ipv6 ospf6 transmit delay interval \[command] ipv6 ospf6 transmit delay interval no ipv6 ospf6 transmit delay interval \[purpose] set number of seconds for inftransdelay value \[parameter] interval seconds (1 65535) \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ipv6 ospf6 retransmit interval 2 ipv6 ospf6 priority priority \[command] ipv6 ospf6 priority priority no ipv6 ospf6 priority priority \[purpose] set router priority integer value \[parameter] priority priority (0 255) \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ipv6 ospf6 priority 12 ipv6 ospf6 retransmit interval interval \[command] ipv6 ospf6 retransmit interval interval no ipv6 ospf6 retransmit interval interval \[purpose] set number of seconds for rxmtinterval timer value \[parameter] interval seconds (1 65535) \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ipv6 ospf6 retransmit interval 2 ipv6 ospf6 network {broadcast|point to point} \[command] ipv6 ospf6 network {broadcast|point to point} no ipv6 ospf6 network {broadcast|point to point} \[purpose] set explicitly network type for specified interface \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ipv6 ospf6 network broadcast ipv6 ospf6 mtu ignore \[command] ipv6 ospf6 mtu ignore no ipv6 ospf6 mtu ignore \[purpose] ignore mtu when establish ospfv3 \[view] interface view \[use cases] sonic# configure terminal sonic(config)# interface ethernet 1 sonic(config if 1)# ipv6 ospf6 mtu ignore redistribute {babel|bgp|connected|eigrp|isis|kernel|openfabric|ospf|rip|sharp|static|table} \[command] redistribute {babel|bgp|connected|eigrp|isis|kernel|openfabric|ospf|rip|sharp|static|table} \[route map route map ] no redistribute {babel|bgp|connected|eigrp|isis|kernel|openfabric|ospf|rip|sharp|static|table} \[route map route map ] \[purpose] redistribute routes of the specified protocol or kind into ospfv3, with the metric type and metric set if specified, filtering the routes using the given route map if specified \[parameter] route map pointer to route map entries \[view] ospf view \[use cases] sonic# configure terminal sonic(config)# router ospf6 sonic(config router)# redistribute static route map test
