How to Configure the OSPF Network Type on Cisco IOS XR
This is the command for changing the OSPF network type on Cisco IOS XR. You specify it in the interface submode under router ospf. For how the types differ in behaviour, see OSPF Network Types.
router ospf [PROCESS_NAME]
area [AREA_ID]
interface [INTERFACE_NAME]
network [TYPE]
!
!
!| Field | Value |
|---|---|
| [TYPE] | One of broadcast, point-to-point, non-broadcast, point-to-multipoint |
Ethernet interfaces default to broadcast. When left at the default, no network line appears in show running-config.
| Type | Hello / Dead | DR/BDR | Neighbor discovery |
|---|---|---|---|
broadcast | 10 / 40 s | Elected | Automatic (224.0.0.5) |
point-to-point | 10 / 40 s | Not elected | Automatic (224.0.0.5) |
non-broadcast | 30 / 120 s | Elected | Manual (neighbor required) |
point-to-multipoint | 30 / 120 s | Not elected | Automatic (224.0.0.5) |
The Hello and Dead intervals have to match at both ends of a link. Changing the type also changes those defaults, so changing only one end prevents the adjacency from coming up. Configure both ends the same way.
Non-Broadcast Requires Neighbors to Be Specified Manually
non-broadcast cannot discover neighbors by multicast, so you name the remote address with the neighbor command.
router ospf [PROCESS_NAME]
area [AREA_ID]
interface [INTERFACE_NAME]
network non-broadcast
neighbor [NEIGHBOR_IP_ADDRESS]
!
!
!Setting the Hello and Dead Intervals Explicitly
You can also set them explicitly instead of relying on the default for the type.
router ospf [PROCESS_NAME]
area [AREA_ID]
interface [INTERFACE_NAME]
hello-interval [SECONDS]
dead-interval [SECONDS]
!
!
!ip ospf network <type> under interface. The type names are the same, but IOS XR differs in that the setting lives in the hierarchy under router ospf.Cisco IOS XR Network Type Verification Commands
| Command | What it shows |
|---|---|
show ospf interface [INTERFACE_NAME] | The Network Type, the Hello / Dead intervals, and whether there is a DR/BDR |
show ospf interface brief | The state of each interface. Types that do not elect a DR/BDR appear as P2P |
show ospf neighbor | The neighbor state. Point-to-point carries no DR/BDR role |
show ospf database | Whether a Network-LSA (Type 2) exists. Types that do not elect a DR/BDR do not create one |
show ospf database router | The link type in the Router-LSA (Transit or point-to-point) |
show running-config router ospf | The configured network type |
Verification on Real Devices
We connected three routers, XR1 to XR3, in a line and changed the network type on the XR1-XR2 link. The XR2-XR3 link was left at the default of broadcast so that both types can be compared on the same device.
| Link | Network type |
|---|---|
| XR1-XR2 (10.1.2.0/24) | point-to-point (configured at both ends) |
| XR2-XR3 (10.2.3.0/24) | The default, broadcast |
Configuring the Network Type
router ospf 1
router-id 1.1.1.1
area 0
interface Loopback0
passive enable
!
interface GigabitEthernet0/0/0/0
network point-to-point
!
!
!router ospf 1
router-id 2.2.2.2
area 0
interface Loopback0
passive enable
!
interface GigabitEthernet0/0/0/0
network point-to-point
!
interface GigabitEthernet0/0/0/1
!
!
!router ospf 1
router-id 3.3.3.3
area 0
interface Loopback0
passive enable
!
interface GigabitEthernet0/0/0/0
!
!
!network point-to-point is applied only to GigabitEthernet0/0/0/0 on XR1 and XR2, which is the XR1-XR2 link. GigabitEthernet0/0/0/1 on XR2, facing XR3, stays at the default of broadcast.
Here is the configuration being entered on XR1.
RP/0/RP0/CPU0:XR1#configure
Thu Sep 10 07:51:14.373 UTC
RP/0/RP0/CPU0:XR1(config)#router ospf 1
RP/0/RP0/CPU0:XR1(config-ospf)#router-id 1.1.1.1
RP/0/RP0/CPU0:XR1(config-ospf)#area 0
RP/0/RP0/CPU0:XR1(config-ospf-ar)#interface Loopback0
RP/0/RP0/CPU0:XR1(config-ospf-ar-if)#passive enable
RP/0/RP0/CPU0:XR1(config-ospf-ar-if)#exit
RP/0/RP0/CPU0:XR1(config-ospf-ar)#interface GigabitEthernet0/0/0/0
RP/0/RP0/CPU0:XR1(config-ospf-ar-if)#network point-to-point
RP/0/RP0/CPU0:XR1(config-ospf-ar-if)#exit
RP/0/RP0/CPU0:XR1(config-ospf-ar)#commit
Thu Sep 10 07:51:15.532 UTC
RP/0/RP0/CPU0:XR1(config-ospf-ar)#end
RP/0/RP0/CPU0:XR1#show running-config router ospf
Thu Sep 10 07:51:17.979 UTC
router ospf 1
router-id 1.1.1.1
area 0
interface Loopback0
passive enable
!
interface GigabitEthernet0/0/0/0
network point-to-point
!
!
!Verifying the Configuration
Running show ospf interface brief on XR2 in the middle puts both types on one screen. Gi0/0/0/0, set to point-to-point, shows P2P in the State column and carries no DR/BDR role. Gi0/0/0/1, left at broadcast, shows BDR.
RP/0/RP0/CPU0:XR2#show ospf interface brief
Thu Sep 10 07:53:04.287 UTC
* Indicates MADJ interface, (P) Indicates fast detect hold down state
Interfaces for OSPF 1
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Lo0 1 0 2.2.2.2/32 1 LOOP 0/0
Gi0/0/0/0 1 0 10.1.2.2/24 1 P2P 1/1
Gi0/0/0/1 1 0 10.2.3.2/24 1 BDR 1/1show ospf interface shows the details of the point-to-point side. It reports Network Type POINT_TO_POINT, and the lines that would name the DR and BDR are absent entirely. The Hello and Dead intervals are 10 and 40 seconds, the same defaults as broadcast.
RP/0/RP0/CPU0:XR1#show ospf interface GigabitEthernet0/0/0/0
Thu Sep 10 07:53:45.375 UTC
GigabitEthernet0/0/0/0 is up, line protocol is up
Internet Address 10.1.2.1/24, Area 0, SID 0, Strict-SPF SID 0
Label stack Primary label 0 Backup label 0 SRTE label 0
Process ID 1, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 1
Transmit Delay is 1 sec, State POINT_TO_POINT, MTU 1500, MaxPktSz 1500
Forward reference No, Unnumbered no, Bandwidth 1000000
RIB LC sync Yes
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:03:298
Index 2/2, flood queue length 0
Next 0(0)/0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
LS Ack List: current length 0, high water mark 3
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 2.2.2.2
Suppress hello for 0 neighbor(s)
Multi-area interface Count is 0
Segment Routing Forwarding MPLS enabled: Yes
Adjacency hold timer expired last : Never
Exchange timer expired last : NeverThe State column of show ospf neighbor differs too. The point-to-point side shows FULL/ - with an empty role, while the broadcast side shows FULL/DR.
RP/0/RP0/CPU0:XR2#show ospf neighbor
Thu Sep 10 07:53:04.833 UTC
* Indicates MADJ interface
# Indicates Neighbor awaiting BFD session up
Neighbors for OSPF 1
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/ - 00:00:35 10.1.2.1 GigabitEthernet0/0/0/0
Neighbor is up for 00:01:28
3.3.3.3 1 FULL/DR 00:00:35 10.2.3.3 GigabitEthernet0/0/0/1
Neighbor is up for 00:01:10
Total neighbor count: 2It also shows up in the LSDB. There is only one Network-LSA (Net Link States), on the broadcast side; none is created for the point-to-point link. On types that do not elect a DR/BDR, the link is advertised inside the Router-LSA as another Router (point-to-point) instead.
RP/0/RP0/CPU0:XR2#show ospf database
Thu Sep 10 07:53:06.024 UTC
OSPF Router with ID (2.2.2.2) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 90 0x80000002 0x006d74 3
2.2.2.2 2.2.2.2 40 0x80000003 0x000e96 4
3.3.3.3 3.3.3.3 41 0x80000002 0x0006d2 2
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
10.2.3.3 3.3.3.3 41 0x80000001 0x0046c1Test Configuration and show Output
The following three kinds of output were collected from all three routers, split per router. The test configuration is these ..._run.txt files.
| File | Contents |
|---|---|
..._show.txt | show version / show interface description / show route / show route ospf / show ospf / show ospf interface / show ospf interface brief / show ospf neighbor / show ospf neighbor detail / show ospf database / show ospf database router / show ospf database network / show ospf statistics interface / show ospf routes / show router-id / show ospf trace events |
..._log.txt | show logging, taken by inserting a marker with logmsg just before configuring OSPF and passing its timestamp to show logging start |
..._run.txt | show running-config (that is, the test configuration) |
| Router | show output | syslog | running-config |
|---|---|---|---|
| XR1 | show | log | run |
| XR2 | show | log | run |
| XR3 | show | log | run |
The Router-LSA link types can be checked in show ospf database router inside ..._show.txt. The point-to-point link is advertised as another Router (point-to-point).
Related Articles
For how the network types differ, see OSPF Network Types; for DR/BDR election, see OSPF DR and BDR; for basic OSPF configuration, see IOS XR OSPF Basic Configuration.
- IOS XR Hostname Configuration (hostname)
- IOS XR Interface Configuration (shutdown/no shutdown) and Verification
- Configuring an IPv4 Address on a Cisco IOS XR Interface
- Configuring an IPv4 Static Route on Cisco IOS XR
- IOS XR OSPF Basic Configuration
- IOS XR OSPF DR/BDR Priority Configuration
- IOS XR OSPF Network Type Configuration