注:所有以下分类操作都需要在对端ospf路由器上使用clear ip ospf process命令刷新LSDB。
1>ip ospf demand-circuit
抑制周期性refresh(使用DoNotAge位flood LSAs),无Hello更新。
+++++++++++++++++++++++++++++++++++++++++++++++++
注:抑制除邻居Router LSA之外的所有LSAs,因为还需要邻居Router LSA维护Adjacency。
+++++++++++++++++++++++++++++++++++++++++++++++++
2>dababase-filter all out
抑制LSA向指定邻居、接口扩散,有Hello更新。
+++++++++++++++++++++++++++++++++++++++++++++++++
注:抑制除邻居Router LSA之外的所有LSAs,因为还需要邻居Router LSA维护Adjacency。
+++++++++++++++++++++++++++++++++++++++++++++++++
R1(config-router)#neighbor ip-address database-filter all out
只能用于NBMA和P2M网络。
R1(config-if)#ip ospf database-filter all out
可以应用于所有接口。
3>ip ospf flood-reductoin
抑制周期性refresh(使用DoNotAge位flood LSAs),有Hello更新。
+++++++++++++++++++++++++++++++++++++++++++++++++
注:抑制除邻居Router LSA之外的所有LSAs,因为还需要邻居Router LSA维护Adjacency。
+++++++++++++++++++++++++++++++++++++++++++++++++
4>area area-id filter-list prefix prefix-name in/out
过滤area之间的type-3 LSA。
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
area-id想要过滤LSA的立足area。
如有两个area:area1,area2。如果想要过滤从area1->area2的1.1.1.0/24条目,则可以写为:
area 1 filter-list prefix deny_1.1.1.0 out
也可以写为:
area 0 filter-list prefix deny_1.1.1.0 in
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Section I. ip ospf demand-circuit配置实例
r2#sh run
interface FastEthernet0/0
description conn_to_r3_f0/0_192.168.1.6
ip address 192.168.1.5 255.255.255.252
duplex auto
speed auto
!
interface Serial1/0
description conn_to_r1_s1/0_192.168.1.2
ip address 192.168.1.1 255.255.255.252
ip ospf demand-circuit
serial restart-delay 0
!
router ospf 100
router-id 10.0.0.1
log-adjacency-changes
network 192.168.1.0 0.0.0.3 area 0
network 192.168.1.4 0.0.0.3 area 0
----------------------------------------------
r1#sh run
interface FastEthernet0/0
description conn_to_r3_f0/0_192.168.1.10
ip address 192.168.1.9 255.255.255.252
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
interface Serial1/0
description conn_to_r2_s1/0_192.168.1.1
ip address 192.168.1.2 255.255.255.252
serial restart-delay 0
!
router ospf 100
router-id 10.0.0.2
log-adjacency-changes
network 192.168.1.0 0.0.0.3 area 0
network 192.168.1.8 0.0.0.3 area 0
-------------------------------------------------
R4#sh run
interface Loopback0
ip address 4.4.0.1 255.255.255.0
ip ospf network point-to-point
!
interface Loopback1
ip address 4.4.1.1 255.255.255.0
!
interface FastEthernet0/0
description conn_to_r2_f0/0_192.168.1.5
ip address 192.168.1.6 255.255.255.252
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
router ospf 100
router-id 10.0.0.4
log-adjacency-changes
network 4.4.0.0 0.0.0.255 area 0
network 4.4.1.0 0.0.0.255 area 0
network 192.168.1.4 0.0.0.3 area 0
----------------------------------------------------
r1#clea ip ospf p
Reset ALL OSPF processes? [no]: y
r1#
r1#sh ip ospf da
OSPF Router with ID (10.0.0.2) (Process ID 100)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
10.0.0.1 10.0.0.1 5
(DNA) 0x80000024 0x00BFDD 3
10.0.0.2 10.0.0.2 233 0x80000002 0x00F239 3
10.0.0.4 10.0.0.4 452
(DNA) 0x80000007 0x00CC27 3
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.1.5 10.0.0.1 249
(DNA) 0x80000002 0x003375
+++++++++++++++++++++++++++++++++++++++++++++++++
注:抑制除邻居Router LSA之外的所有LSAs,因为还需要邻居Router LSA维护Adjacency。
+++++++++++++++++++++++++++++++++++++++++++++++++
r1#sh ip ospf int s1/0
Serial1/0 is up, line protocol is up
Internet Address 192.168.1.2/30, Area 0
Process ID 100, Router ID 10.0.0.2, Network Type POINT_TO_POINT, Cost: 64
Run as demand circuit.
DoNotAge LSA allowed.
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:06
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 10.0.0.1 (Hello suppressed)
Suppress hello for 1 neighbor(s)
----------------------------------------------------------------------------
Section II. database-filter all out命令配置实例:
r2#sh run
interface FastEthernet0/0
description conn_to_r3_f0/0_192.168.1.6
ip address 192.168.1.5 255.255.255.252
duplex auto
speed auto
!
interface Serial1/0
description conn_to_r1_s1/0_192.168.1.2
ip address 192.168.1.1 255.255.255.252
ip ospf database-filter all out
serial restart-delay 0
!
router ospf 100
router-id 10.0.0.1
log-adjacency-changes
network 192.168.1.0 0.0.0.3 area 0
network 192.168.1.4 0.0.0.3 area 0
----------------------------------------------
r1#sh run
interface FastEthernet0/0
description conn_to_r3_f0/0_192.168.1.10
ip address 192.168.1.9 255.255.255.252
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
interface Serial1/0
description conn_to_r2_s1/0_192.168.1.1
ip address 192.168.1.2 255.255.255.252
serial restart-delay 0
!
router ospf 100
router-id 10.0.0.2
log-adjacency-changes
network 192.168.1.0 0.0.0.3 area 0
network 192.168.1.8 0.0.0.3 area 0
-------------------------------------------------
R4#sh run
interface Loopback0
ip address 4.4.0.1 255.255.255.0
ip ospf network point-to-point
!
interface Loopback1
ip address 4.4.1.1 255.255.255.0
!
interface FastEthernet0/0
description conn_to_r2_f0/0_192.168.1.5
ip address 192.168.1.6 255.255.255.252
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
router ospf 100
router-id 10.0.0.4
log-adjacency-changes
network 4.4.0.0 0.0.0.255 area 0
network 4.4.1.0 0.0.0.255 area 0
network 192.168.1.4 0.0.0.3 area 0
----------------------------------------------------
r2#sh ip ospf int s1/0
Serial1/0 is up, line protocol is up
Internet Address 192.168.1.1/30, Area 0
Process ID 100, Router ID 10.0.0.1, Network Type POINT_TO_POINT, Cost: 64
Transmit Delay is 1 sec, State POINT_TO_POINT,
Database-filter all out
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:08
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 4 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 10.0.0.2
Suppress hello for 0 neighbor(s)
-----------------------------------------------------
r1#clea ip ospf p
Reset ALL OSPF processes? [no]: y
r1#sh ip ospf database
OSPF Router with ID (10.0.0.2) (Process ID 100)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
10.0.0.2 10.0.0.2 11 0x80000002 0x00F239 3
+++++++++++++++++++++++++++++++++++++++++++++++++
注:抑制除邻居Router LSA之外的所有LSAs,因为还需要邻居Router LSA维护Adjacency。
+++++++++++++++++++++++++++++++++++++++++++++++++
Section III. ip ospf flood-reduction配置实例
r2(config)#int s1/0
r2(config-if)#no ip ospf database-filter all out
r2(config-if)#
r2(config-if)#
*Mar 1 01:06:54.199: %OSPF-5-ADJCHG: Process 100, Nbr 10.0.0.2 on Serial1/0 from FULL to
DOWN, Neighbor Down: Interface down or deta
r2(config-if)#
r2(config-if)#
r2(config-if)#
*Mar 1 01:06:56.775: %OSPF-5-ADJCHG: Process 100, Nbr 10.0.0.2 on Serial1/0 from LOADING
to FULL, Loading Doneip ospf
r2(config-if)#
r2(config-if)#
r2(config-if)#
r2(config-if)#
ip ospf flood-reduction
-----------------------------------------------------------------------------
r1#sh ip ospf database
OSPF Router with ID (10.0.0.2) (Process ID 100)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
10.0.0.1 10.0.0.1 1
(DNA) 0x8000001F 0x00C9D8 3
10.0.0.2 10.0.0.2 86 0x80000002 0x00F239 3
10.0.0.4 10.0.0.4 206
(DNA) 0x80000007 0x00CC27 3
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.1.5 10.0.0.1 2
(DNA) 0x80000002 0x003375
-------------------------------------------------------------------------------
Section IV. area area-id filter-list prefix prefix-name in/out配置实例
r2#sh run
interface FastEthernet0/0
description conn_to_r3_f0/0_192.168.1.6
ip address 192.168.1.5 255.255.255.252
duplex auto
speed auto
!
interface Serial1/0
description conn_to_r2_s1/0_192.168.1.2
ip address 192.168.1.1 255.255.255.252
serial restart-delay 0
!
router ospf 100
router-id 10.0.0.1
log-adjacency-changes
network 192.168.1.0 0.0.0.3 area 0
network 192.168.1.4 0.0.0.3 area 1
----------------------------------------------------
r1#sh run
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface Serial1/0
description conn_to_r2_s1/0_192.168.1.1
ip address 192.168.1.2 255.255.255.252
serial restart-delay 0
!
router ospf 100
router-id 10.0.0.2
log-adjacency-changes
network 192.168.1.0 0.0.0.3 area 0
network 192.168.1.8 0.0.0.3 area 0
----------------------------------------------------
r4#sh run
interface Loopback0
ip address 4.4.0.1 255.255.255.0
ip ospf network point-to-point
!
interface Loopback1
ip address 4.4.1.1 255.255.255.0
!
interface FastEthernet0/0
description conn_to_r2_f0/0_192.168.1.5
ip address 192.168.1.6 255.255.255.252
duplex auto
speed auto
!
router ospf 100
router-id 10.0.0.4
log-adjacency-changes
network 4.4.0.0 0.0.0.255 area 1
network 4.4.1.0 0.0.0.255 area 1
network 192.168.1.4 0.0.0.3 area 1
----------------------------------------------------
r2#clear ip ospf p
r2#clear ip ospf process
Reset ALL OSPF processes? [no]: y
r2#
r2#
r2#
*Mar 1 01:31:57.139: %OSPF-5-ADJCHG: Process 100, Nbr 10.0.0.2 on Serial1/0 from FULL to
DOWN, Neighbor Down: Interface down or detached
*Mar 1 01:31:57.183: %OSPF-5-ADJCHG: Process 100, Nbr 10.0.0.4 on FastEthernet0/0 from
FULL to DOWN, Neighbor Down: Interface down or detached
-----------------------------------------------------
r2#sh ip ospf database
OSPF Router with ID (10.0.0.1) (Process ID 100)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
10.0.0.1 10.0.0.1 11 0x80000003 0x00406C 2
10.0.0.2 10.0.0.2 18 0x80000004 0x002F7B 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
4.4.0.0 10.0.0.1 8 0x80000001 0x00D84F
4.4.1.1 10.0.0.1 8 0x80000001 0x00C362
192.168.1.4 10.0.0.1 12 0x80000004 0x00368C
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
10.0.0.1 10.0.0.1 11 0x80000004 0x004FE9 1
10.0.0.4 10.0.0.4 18 0x80000008 0x00D120 3
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.1.6 10.0.0.4 18 0x80000005 0x00059C
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.1.0 10.0.0.1 13 0x80000003 0x00D8AF
----------------------------------------------------------
r1#sh ip ospf database
OSPF Router with ID (10.0.0.2) (Process ID 100)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
10.0.0.1 10.0.0.1 52 0x80000005 0x003C6E 2
10.0.0.2 10.0.0.2 46 0x80000005 0x002D7C 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
4.4.0.0 10.0.0.1 268 0x80000001 0x00D84F
4.4.1.1 10.0.0.1 268 0x80000001 0x00C362
192.168.1.4 10.0.0.1 272 0x80000004 0x00368C
----------------------------------------------------------
r2(config)#
ip prefix-list deny_4.4.0.0 seq 10 deny 4.4.0.0/24
r2(config)#
ip prefix-list deny_4.4.0.0 seq 20 permit 0.0.0.0/0 le 32
r2(config)#router ospf 100
r2(config-router)#
area 0 filter-list prefix deny_4.4.0.0 in
----------------------------------------------------------
r2#sh ip ospf da
OSPF Router with ID (10.0.0.1) (Process ID 100)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
10.0.0.1 10.0.0.1 658 0x80000009 0x003472 2
10.0.0.2 10.0.0.2 653 0x80000007 0x00297E 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
4.4.1.1 10.0.0.1 1194 0x80000001 0x00C362
192.168.1.4 10.0.0.1 1198 0x80000004 0x00368C
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
10.0.0.1 10.0.0.1 1197 0x80000004 0x004FE9 1
10.0.0.4 10.0.0.4 1204 0x80000008 0x00D120 3
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.1.6 10.0.0.4 1204 0x80000005 0x00059C
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.1.0 10.0.0.1 1199 0x80000003 0x00D8AF
--------------------------------------------------------
r1#sh ip ospf da
OSPF Router with ID (10.0.0.2) (Process ID 100)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
10.0.0.1 10.0.0.1 673 0x80000009 0x003472 2
10.0.0.2 10.0.0.2 668 0x80000007 0x00297E 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
4.4.1.1 10.0.0.1 1209 0x80000001 0x00C362
192.168.1.4 10.0.0.1 1213 0x80000004 0x00368C
---------------------------------------------------------
r2(config)#router ospf 100
r2(config-router)#
area 1 filter-list prefix deny_4.4.0.0 out
---------------------------------------------------------
r2#sh ip ospf database
OSPF Router with ID (10.0.0.1) (Process ID 100)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
10.0.0.1 10.0.0.1 8 0x8000000A 0x003273 2
10.0.0.2 10.0.0.2 15 0x80000009 0x002580 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
4.4.1.1 10.0.0.1 5 0x80000001 0x00C362
192.168.1.4 10.0.0.1 9 0x80000005 0x00348D
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
10.0.0.1 10.0.0.1 8 0x80000005 0x004DEA 1
10.0.0.4 10.0.0.4 15 0x8000000A 0x00CD22 3
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.1.6 10.0.0.4 15 0x80000007 0x00019E
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.1.0 10.0.0.1 10 0x80000004 0x00D6B0
---------------------------------------------------------------
r1#sh ip ospf database
OSPF Router with ID (10.0.0.2) (Process ID 100)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
10.0.0.1 10.0.0.1 72 0x8000000A 0x003273 2
10.0.0.2 10.0.0.2 77 0x80000009 0x002580 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
4.4.1.1 10.0.0.1 69 0x80000001 0x00C362
192.168.1.4 10.0.0.1 73 0x80000005 0x00348D