HCIP-IERS部署企业级路由交换网络_OSPF协议特性与配置_OSPF的邻接关系和LSA

目录

第一章 OSPF协议特性与配置

实验 1-3 OSPF的邻接关系和LSA

学习目的

拓扑图

场景

学习任务

步骤一.基础配置与IP编址

步骤二.配置多区域OSPF

步骤三.修改路由器OSPF接口优先级,影响DR选举

步骤四.配置将直连路由汇总并引入到OSPF区域

步骤五.查看各种类型的LSA

步骤六.观察LSR、LSU和LSAck

附加实验: 思考并验证

最终设备配置


第一章 OSPF协议特性与配置

实验 1-3 OSPF的邻接关系和LSA

学习目的

·了解四个OSPF邻居路由器在以太网上邻居关系建立的过程

·掌握对OSPF的DR的选举进行干预的方法

·观察5种类型的LSA的内容,以及它们的作用

·了解OSPF的LSR、LSU、LSAck数据包的相互发送情况

拓扑图

图1-3 OSPF的邻接关系和LSA

场景

你是公司的网络管理员。现在公司的网络中有五台AR G3路由器,其中R1、R2、R3和R4在公司总部,通过以太网互联。R5在公司分部,R3通过专线与公司总部的R3相连。由于网络规模较大,为了控制LSA的洪泛,你设计了多区域的OSPF互联方式。

其中R1的Loopback0接口属于区域2。R2、R3、R4的Loopback0接口与10.1.234.0/24网段属于区域0。R3与R5之间互联的网段属于区域1。R5的Loopback0接口属于OSPF外部网络。

同时为了明确设备的Router ID,你配置设备使用固定的地址作为Router ID。

在R1、R2、R3与R4之间互联的网络上,需要干预DR与BDR的选举。实际使用中将R3定义为DR、R2定义为BDR。R4设备定义为DROther。

学习任务

步骤一.基础配置与IP编址

给所有路由器配置IP地址和掩码。配置时注意所有的Loopback接口配置掩码均为24位,模拟成一个单独的网段。

<R1>system-view

Enter system view, return user view with Ctrl+Z.

[R1]interface GigabitEthernet 0/0/0

[R1-GigabitEthernet0/0/0]ip address 10.1.234.1 24

[R1-GigabitEthernet0/0/0]quit

[R1]interface LoopBack 0

[R1-LoopBack0]ip address 10.0.1.1 24

[R1-LoopBack0]quit

<R2>system-view

Enter system view, return user view with Ctrl+Z.

[R2]interface GigabitEthernet 0/0/0

[R2-GigabitEthernet0/0/0]ip address 10.1.234.2 24

[R2-GigabitEthernet0/0/0]quit

[R2]interface LoopBack 0

[R2-LoopBack0]ip address 10.0.2.2 24

[R2-LoopBack0]quit

<R3>system-view

Enter system view, return user view with Ctrl+Z.

[R3]interface GigabitEthernet 0/0/0

[R3-GigabitEthernet0/0/0]ip address 10.1.234.3 24

[R3-GigabitEthernet0/0/0]quit

[R3]interface Serial 3/0/0

[R3-Serial3/0/0]ip address 10.0.35.3 24

[R3-Serial3/0/0]quit

[R3]interface LoopBack 0

[R3-LoopBack0]ip address 10.0.3.3 24

[R3-LoopBack0]quit

<R4>system-view

Enter system view, return user view with Ctrl+Z.

[R4]interface GigabitEthernet 0/0/0

[R4-GigabitEthernet0/0/0]ip address 10.1.234.4 24

[R4-GigabitEthernet0/0/0]quit

[R4]interface LoopBack 0

[R4-LoopBack0]ip address 10.0.4.4 24

[R4-LoopBack0]quit

<R5>system-view

Enter system view, return user view with Ctrl+Z.

[R5]interface Serial 1/0/0

[R5-Serial1/0/0]ip address 10.0.35.5 24

[R5-Serial1/0/0]quit

[R5]interface LoopBack 0

[R5-LoopBack0]ip address 10.0.5.5 24

[R5-LoopBack0]quit

配置完成后,测试直连链路的连通性。

[R1]ping -c 1 10.1.234.2

  PING 10.1.234.2: 56  data bytes, press CTRL_C to break

    Reply from 10.1.234.2: bytes=56 Sequence=1 ttl=255 time=13 ms

  --- 10.1.234.2 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 13/13/13 ms

[R1]ping -c 1 10.1.234.4

  PING 10.1.234.4: 56  data bytes, press CTRL_C to break

    Reply from 10.1.234.4: bytes=56 Sequence=1 ttl=255 time=6 ms

  --- 10.1.234.4 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 6/6/6 ms

[R3]ping -c 1 10.1.234.1

  PING 10.1.234.1: 56  data bytes, press CTRL_C to break

    Reply from 10.1.234.1: bytes=56 Sequence=1 ttl=255 time=13 ms

  --- 10.1.234.1 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 13/13/13 ms

[R3]ping -c 1 10.0.35.5

  PING 10.0.35.5: 56  data bytes, press CTRL_C to break

    Reply from 10.0.35.5: bytes=56 Sequence=1 ttl=255 time=32 ms

  --- 10.0.35.5 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 32/32/32 ms

步骤二.配置多区域OSPF

在R1上配置GigabitEthernet 0/0/0属于区域0,Loopback 0属于区域2。对所有OSPF区域的Loopback接口,修改其OSPF网络类型为Broadcast类型,以便于OSPF发布Loopback口的真实掩码信息。

[R1]ospf 1 router-id 10.0.1.1

[R1-ospf-1]area 0

[R1-ospf-1-area-0.0.0.0]network 10.1.234.1 0.0.0.0

[R1-ospf-1-area-0.0.0.0]quit

[R1-ospf-1]area 2

[R1-ospf-1-area-0.0.0.2]network 10.0.1.1 0.0.0.0

[R1-ospf-1-area-0.0.0.2]quit

[R1-ospf-1]quit

[R1]interface LoopBack 0

[R1-LoopBack0]ospf network-type broadcast

[R1-LoopBack0]quit

R2、R4的所有接口均位于区域0中。

[R2]ospf 1 router-id 10.0.2.2

[R2-ospf-1]area 0

[R2-ospf-1-area-0.0.0.0]network 10.1.234.2 0.0.0.0

[R2-ospf-1-area-0.0.0.0]network 10.0.2.2 0.0.0.0

[R2-ospf-1-area-0.0.0.0]quit

[R2-ospf-1]quit

[R2-]interface LoopBack 0

[R2-LoopBack0]ospf network-type broadcast

[R2-LoopBack0]quit

[R4]ospf 1 router-id 10.0.4.4

[R4-ospf-1]area 0

[R4-ospf-1-area-0.0.0.0]network 10.1.234.4 0.0.0.0

[R4-ospf-1-area-0.0.0.0]network 10.0.4.4 0.0.0.0

[R4-ospf-1-area-0.0.0.0]quit

[R4-ospf-1]quit

[R4-]interface LoopBack 0

[R4-LoopBack0]ospf network-type broadcast

[R4-LoopBack0]quit

在R3上配置Loopback 0和GigabitEthernet 0/0/0属于区域0,Serial 3/0/0属于区域2。

[R3]ospf 1 router-id 10.0.3.3

[R3-ospf-1]area 0

[R3-ospf-1-area-0.0.0.0]network 10.1.234.3 0.0.0.0

[R3-ospf-1-area-0.0.0.0]network 10.0.3.3 0.0.0.0

[R3-ospf-1-area-0.0.0.0]quit

[R3-ospf-1]area 1

[R3-ospf-1-area-0.0.0.1]network 10.0.35.3 0.0.0.0

[R3-ospf-1-area-0.0.0.1]quit

[R3-ospf-1]quit

[R3]interface LoopBack 0

[R3-LoopBack0]ospf network-type broadcast

[R3-LoopBack0]quit

在R5上配置Serial 1/0/0属于区域1,Loopback 0不属于任何区域。

[R5]osp 1 router-id 10.0.5.5

[R5-ospf-1]area 1

[R5-ospf-1-area-0.0.0.1]network 10.0.35.5 0.0.0.0

[R5-ospf-1-area-0.0.0.1]quit

[R5-ospf-1]quit

配置完成后,在R1查看设备的路由表。

[R1]display ip routing-table

Route Flags: R - relay, D - download to fib

----------------------------------------------------------------------------

Routing Tables: Public

         Destinations : 14       Routes : 14       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       10.0.1.0/24 Direct  0    0 D   10.0.1.1 LoopBack0

       10.0.1.1/32 Direct  0    0 D   127.0.0.1 LoopBack0

     10.0.1.255/32 Direct  0    0 D   127.0.0.1 LoopBack0

       10.0.2.0/24 OSPF  10   1 D   10.1.234.2    GigabitEthernet0/0/0

       10.0.3.0/24 OSPF  10   1 D   10.1.234.3    GigabitEthernet0/0/0

       10.0.4.0/24 OSPF  10   1 D   10.1.234.4    GigabitEthernet0/0/0

      10.0.35.0/24 OSPF  10   1563 D   10.1.234.3    GigabitEthernet0/0/0

     10.1.234.0/24 Direct  0    0 D   10.1.234.1    GigabitEthernet0/0/0

     10.1.234.1/32 Direct  0    0 D   127.0.0.1    GigabitEthernet0/0/0

   10.1.234.255/32 Direct  0    0 D   127.0.0.1    GigabitEthernet0/0/0

      127.0.0.0/8 Direct  0    0 D   127.0.0.1       InLoopBack0

      127.0.0.1/32 Direct  0    0 D   127.0.0.1       InLoopBack0

127.255.255.255/32Direct  0    0 D   127.0.0.1       InLoopBack0

255.255.255.255/32Direct  0    0 D   127.0.0.1       InLoopBack0

除了没有发布进OSPF的网络10.0.5.5/24,在R1上已拥有全网的路由表。

测试网络的连通性。

[R1]ping -c 1 10.0.2.2

  PING 10.0.2.2: 56  data bytes, press CTRL_C to break

    Reply from 10.0.2.2: bytes=56 Sequence=1 ttl=255 time=2 ms

  --- 10.0.2.2 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 2/2/2 ms

[R1]ping -c 1 10.0.4.4

  PING 10.0.4.4: 56  data bytes, press CTRL_C to break

    Reply from 10.0.4.4: bytes=56 Sequence=1 ttl=255 time=3 ms

  --- 10.0.4.4 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

round-trip min/avg/max = 3/3/3 ms

[R3]ping -c 1 10.0.1.1

  PING 10.0.1.1: 56  data bytes, press CTRL_C to break

    Reply from 10.0.1.1: bytes=56 Sequence=1 ttl=255 time=3 ms

  --- 10.0.1.1 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 3/3/3 ms

在R1使用display ospf brief命令查看路由器运行的基本OSPF信息。我们可以看到,由于R1的Loopback 0接口位于区域2中,所以R1成为了一台ABR。R1的GigabitEthernet 0/0/0接口所连接的网络为广播型网络,且R1为这个网段的DR。

[R1]display ospf brief

         OSPF Process 1 with Router ID 10.0.1.1

                 OSPF Protocol Information

 RouterID: 10.0.1.1         Border Router:  AREA 

 Multi-VPN-Instance is not enabled

 Global DS-TE Mode: Non-Standard IETF Mode

 Graceful-restart capability: disabled

 Helper support capability  : not configured

 Applications Supported: MPLS Traffic-Engineering

 Spf-schedule-interval: max 10000ms, start 500ms, hold 1000ms

 Default ASE parameters: Metric: 1 Tag: 1 Type: 2

 Route Preference: 10

 ASE Route Preference: 150

 SPF Computation Count: 22    

 RFC 1583 Compatible

 Retransmission limitation is disabled

 Area Count: 2   Nssa Area Count: 0

 ExChange/Loading Neighbors: 0

 Process total up interface count: 2

 Process valid up interface count: 1

 Area: 0.0.0.0          (MPLS TE not enabled)

 Authtype: None   Area flag: Normal

 SPF scheduled Count: 22    

 ExChange/Loading Neighbors: 0

 Router ID conflict state: Normal

 Area interface up count: 1

 Interface: 10.1.234.1 (GigabitEthernet0/0/0)

 Cost: 1       State: DR        Type: Broadcast    MTU: 1500  

 Priority: 1

 Designated Router: 10.1.234.1

 Backup Designated Router: 10.1.234.2

 Timers: Hello 10 , Dead 40 , Poll  120 , Retransmit 5 , Transmit Delay 1

 Area: 0.0.0.2          (MPLS TE not enabled)

 Authtype: None   Area flag: Normal

 SPF scheduled Count: 20    

 ExChange/Loading Neighbors: 0

 Router ID conflict state: Normal

 Area interface up count: 1

 Interface: 10.0.1.1 (LoopBack0)

 Cost: 0       State: DR        Type: Broadcast    MTU: 1500  

 Priority: 1

 Designated Router: 10.0.1.1

 Backup Designated Router: 0.0.0.0

 Timers: Hello 10 , Dead 40 , Poll  120 , Retransmit 5 , Transmit Delay 1

使用display ospf peer brief命令查看路由器的OSPF邻居关系建立情况。由于R1是DR,所以它与该网段的所有路由器形成邻接关系。在R3上查看邻居就可以发现R3和R4之间仅存在邻居关系,而没有邻接关系。

[R1]display ospf peer brief

         OSPF Process 1 with Router ID 10.0.1.1

                  Peer Statistic Information

 ----------------------------------------------------------------------------

 Area Id          Interface                        Neighbor id      State    

 0.0.0.0          GigabitEthernet0/0/0             10.0.2.2         Full        

 0.0.0.0          GigabitEthernet0/0/0             10.0.3.3         Full        

 0.0.0.0          GigabitEthernet0/0/0             10.0.4.4         Full        

 ----------------------------------------------------------------------------

[R3]display ospf peer brief

         OSPF Process 1 with Router ID 10.0.3.3

                  Peer Statistic Information

 ----------------------------------------------------------------------------

 Area Id          Interface                        Neighbor id      State    

 0.0.0.0          GigabitEthernet0/0/0 10.0.1.1         Full        

 0.0.0.0          GigabitEthernet0/0/0 10.0.2.2         Full        

 0.0.0.0          GigabitEthernet0/0/0 10.0.4.4         2-Way       

 0.0.0.1          Serial3/0/0 10.0.5.5         Full        

 ----------------------------------------------------------------------------

在R5上使用display ospf lsdb命令查看路由器的OSPF数据库信息。

[R5]display ospf lsdb

         OSPF Process 1 with Router ID 10.0.5.5

                 Link State Database

                         Area: 0.0.0.1

 Type      LinkState ID      AdvRouter          Age  Len   Sequence   Metric

 Router    10.0.5.5 10.0.5.5          1182  48    80000002    1562

 Router    10.0.3.3 10.0.3.3          1183  48    80000002    1562

 Sum-Net   10.0.3.0 10.0.3.3          1429  28    80000001       0

 Sum-Net   10.0.2.0 10.0.3.3          1429  28    80000001       1

 Sum-Net   10.0.1.0 10.0.3.3          1429  28    80000001       1

 Sum-Net   10.1.234.0 10.0.3.3          1429  28    80000001       1

 Sum-Net   10.0.4.0 10.0.3.3          1430  28    80000001       1

可以看到由于在区域1中仅存在2台路由器,所以在R5的lsdb中,仅存在2条第一类LSA,剩余的5条第三类LSA是由R3向R5通告的区域间路由。

在R2上使用display ospf lsdb命令查看路由器的OSPF数据库信息。

[R2]display ospf lsdb

         OSPF Process 1 with Router ID 10.0.2.2

                 Link State Database

                         Area: 0.0.0.0

 Type      LinkState ID       AdvRouter          Age  Len   Sequence   Metric

 Router    10.0.3.3 10.0.3.3             4  48    80000009       1

 Router    10.0.4.4 10.0.4.4           150  48    80000009       1

 Router    10.0.2.2 10.0.2.2           149  48    8000000C       1

 Router    10.0.1.1 10.0.1.1           149  36    8000000B       1

 Network   10.1.234.1 10.0.1.1           149  40    80000007       0

 Sum-Net   10.0.35.0 10.0.3.3          1790  28    80000001    1562

 Sum-Net   10.0.1.0 10.0.1.1           817  28    80000002       0

在R2上除了4条第一类LSA以外,还有一条第二类LSA。R2的GigabitEthernet 0/0/0所连接的是一个广播型网络,该网络上的DR会产生一条第二类LSA来描述所有的邻居。在这里可以从AdvRouter字段得知生成这条LSA的路由器是R1,符合R1是该网段DR的结果。

在R1上使用display ospf lsdb命令查看路由器的OSPF数据库信息。

[R1]display ospf lsdb

         OSPF Process 1 with Router ID 10.0.1.1

                 Link State Database

                         Area: 0.0.0.0

 Type      LinkState ID       AdvRouter          Age  Len   Sequence   Metric

 Router    10.0.3.3 10.0.3.3           447  48    80000009       1

 Router    10.0.4.4 10.0.4.4           592  48    80000009       1

 Router    10.0.2.2 10.0.2.2           592  48    8000000C       1

 Router    10.0.1.1 10.0.1.1           591  36    8000000B       1

 Network   10.1.234.1 10.0.1.1           591  40    80000007       0

 Sum-Net   10.0.35.0 10.0.3.3           434  28    80000002    1562

 Sum-Net   10.0.1.0 10.0.1.1          1259  28    80000002       0

                         Area: 0.0.0.2

 Type      LinkState ID      AdvRouter          Age  Len   Sequence   Metric

 Router    10.0.1.1 10.0.1.1          1223  36    80000004       0

 Sum-Net   10.0.35.0 10.0.1.1           433  28    80000002    1563

 Sum-Net   10.0.3.0 10.0.1.1           541  28    80000002       1

 Sum-Net   10.0.2.0 10.0.1.1           909  28    80000002       1

 Sum-Net   10.1.234.0 10.0.1.1          1269  28    80000002       1

 Sum-Net   10.0.4.0 10.0.1.1           711  28    80000002       1

由于R1的Loopback 0接口位于区域2中,所以R1上有2个区域的LSDB,分别是区域0和区域2的。

在R4上使用display ospf lsdb命令查看路由器的OSPF数据库信息。

[R4]display ospf lsdb

         OSPF Process 1 with Router ID 10.0.4.4

                 Link State Database

                         Area: 0.0.0.0

 Type      LinkState ID      AdvRouter          Age  Len   Sequence   Metric

 Router    10.0.3.3 10.0.3.3           745  48    80000009       1

 Router    10.0.4.4 10.0.4.4           888  48    80000009       1

 Router    10.0.2.2 10.0.2.2           889  48    8000000C       1

 Router    10.0.1.1 10.0.1.1           889  36    8000000B       1

 Network   10.1.234.1 10.0.1.1           889  40    80000007       0

 Sum-Net   10.0.35.0 10.0.3.3           732  28    80000002    1562

 Sum-Net   10.0.1.0 10.0.1.1          1556  28    80000002       0

注意由于OSPF路由器的角色差异,OSPF链路状态数据库内容也会有所差异。对比分析R5、R2、R1与R4链路状态数据库的差异。

步骤三.修改路由器OSPF接口优先级,影响DR选举

配置R3的G0/0/0接口优先级为255,确保R3成为10.1.234.0/24网段的DR。修改R2的G0/0/0接口优先级为254,确保R2成为10.1.234.0/24网段的BDR。修改R4的G0/0/0接口优先级为0,确保R4不参加DR/BDR选举,而成为10.1.234.0/24网段的DROther。

[R3]interface GigabitEthernet 0/0/0

[R3-GigabitEthernet0/0/0]ospf dr-priority 255

[R3-GigabitEthernet0/0/0]quit

[R2]interface GigabitEthernet 0/0/0

[R2-GigabitEthernet0/0/0]ospf dr-priority 254

[R2-GigabitEthernet0/0/0]quit

[R4]interface GigabitEthernet 0/0/0

[R4-GigabitEthernet0/0/0]ospf dr-priority 0

[R4-GigabitEthernet0/0/0]quit

配置完成后,由于DR/BDR已经选举,并且DR/BDR角色不能抢占。所以必须关闭R1、R2、R3、R4的G0/0/0接口,并依次打开R3、R2、R1和R4的G0/0/0接口。

[R1]interface GigabitEthernet 0/0/0

[R1-GigabitEthernet0/0/0]shutdown

[R2]interface GigabitEthernet 0/0/0

[R2-GigabitEthernet0/0/0]shutdown

[R3]interface GigabitEthernet 0/0/0

[R3-GigabitEthernet0/0/0]shutdown

[R4]interface GigabitEthernet 0/0/0

[R4-GigabitEthernet0/0/0]shutdown

[R1-GigabitEthernet0/0/0]undo shutdown

[R1-GigabitEthernet0/0/0]quit

[R2-GigabitEthernet0/0/0]undo shutdown

[R2-GigabitEthernet0/0/0]quit

[R3-GigabitEthernet0/0/0]undo shutdown

[R3-GigabitEthernet0/0/0]quit

[R4-GigabitEthernet0/0/0]undo shutdown

[R4-GigabitEthernet0/0/0]quit

查看网段10.1.234.0/24网段的DR/BDR选举情况。

[R3]display ospf peer

         OSPF Process 1 with Router ID 10.0.3.3

                 Neighbors

 Area 0.0.0.0 interface 10.1.234.3(GigabitEthernet0/0/0)'s neighbors

 Router ID: 10.0.1.1         Address: 10.1.234.1      

   State: Full  Mode:Nbr is  Slave  Priority: 1

   DR: 10.1.234.3  BDR: 10.1.234.2  MTU: 0    

   Dead timer due in 29  sec

   Retrans timer interval: 3

   Neighbor is up for 00:02:17     

   Authentication Sequence: [ 0 ]

 Router ID: 10.0.2.2         Address: 10.1.234.2      

   State: Full  Mode:Nbr is  Slave  Priority: 254

   DR: 10.1.234.3  BDR: 10.1.234.2  MTU: 0    

   Dead timer due in 35  sec

   Retrans timer interval: 6

   Neighbor is up for 00:01:14     

   Authentication Sequence: [ 0 ]

 Router ID: 10.0.4.4         Address: 10.1.234.4      

   State: Full  Mode:Nbr is  Master  Priority: 0

   DR: 10.1.234.3  BDR: 10.1.234.2  MTU: 0    

   Dead timer due in 32  sec

   Retrans timer interval: 3

   Neighbor is up for 00:01:26     

   Authentication Sequence: [ 0 ]

                                          

                 Neighbors

 Area 0.0.0.1 interface 10.0.35.3(Serial3/0/0)'s neighbors

 Router ID: 10.0.5.5         Address: 10.0.35.5       

   State: Full  Mode:Nbr is  Master  Priority: 1

   DR: None   BDR: None   MTU: 0    

   Dead timer due in 27  sec

   Retrans timer interval: 4

   Neighbor is up for 00:53:37     

   Authentication Sequence: [ 0 ]

在重启接口后R3成为了该网段的DR,R2成为了BDR。

查看R4与R1的邻居关系。

[R4]display ospf peer 10.0.1.1  

         OSPF Process 1 with Router ID 10.0.4.4

                 Neighbors

 Area 0.0.0.0 interface 10.1.234.4(GigabitEthernet0/0/0)'s neighbors

 Router ID: 10.0.1.1         Address: 10.1.234.1      

   State: 2-Way  Mode:Nbr is  Slave  Priority: 1

   DR: 10.1.234.3  BDR: 10.1.234.2  MTU: 0    

   Dead timer due in 30  sec

   Retrans timer interval: 0

   Neighbor is up for 00:00:00     

   Authentication Sequence: [ 0 ]

当邻居关系稳定以后,由于R1和R4均为DROther路由器,所以他们之间仅形成邻居关系,保持在2-way状态。

步骤四.配置将直连路由汇总并引入到OSPF区域

R5的Loopback0接口不属于OSPF区域。将这条直连路由引入到OSPF区域。

[R5]ospf 1

[R5-ospf-1]import-route direct

[R5-ospf-1]quit

在R1和R3上查看引入的外部路由。

[R1]display ip routing-table protocol ospf

Route Flags: R - relay, D - download to fib

----------------------------------------------------------------------------

Public routing table : OSPF

         Destinations : 6        Routes : 6        

OSPF routing table status : <Active>

         Destinations : 6        Routes : 6

Destination/Mask   Proto   Pre  Cost    Flags NextHop         Interface

       10.0.2.0/24  OSPF    10   1 D   10.1.234.2    GigabitEthernet0/0/0

       10.0.3.0/24  OSPF    10   1 D   10.1.234.3    GigabitEthernet0/0/0

       10.0.4.0/24  OSPF    10   1 D   10.1.234.4    GigabitEthernet0/0/0

       10.0.5.0/24  O_ASE   150  1 D   10.1.234.3    GigabitEthernet0/0/0

      10.0.35.0/24  OSPF    10   1563 D   10.1.234.3    GigabitEthernet0/0/0

      10.0.35.3/32  O_ASE   150  1 D   10.1.234.3    GigabitEthernet0/0/0

OSPF routing table status : <Inactive>

         Destinations : 0        Routes : 0

[R3]display ip routing-table protocol ospf

Route Flags: R - relay, D - download to fib

----------------------------------------------------------------------------

Public routing table : OSPF

         Destinations : 5        Routes : 5        

OSPF routing table status : <Active>

         Destinations : 4        Routes : 4

Destination/Mask   Proto   Pre  Cost    Flags NextHop         Interface

       10.0.1.0/24  OSPF    10   1 D   10.1.234.1    GigabitEthernet0/0/0

       10.0.2.0/24  OSPF    10   1 D   10.1.234.2    GigabitEthernet0/0/0

       10.0.4.0/24  OSPF    10   1 D   10.1.234.4    GigabitEthernet0/0/0

       10.0.5.0/24  O_ASE   150  1 D   10.0.35.5       Serial3/0/0

OSPF routing table status : <Inactive>

         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      10.0.35.3/32  O_ASE   150  1             10.0.35.5       Serial3/0/0

在R1和R3上均看到2条外部路由,分别是10.0.5.0/24和10.0.35.3/32。10.0.5.0/24为R5的Loopback接口,但为什么还有一条10.0.35.3/32呢?

查看R5的路由表,由于R3和R5之间是以PPP的形式封装的,R3的Serial 3/0/0的接口地址会以直连路由的形式出现在R5的路由表里,所以在R5上运行import-route direct以后该路由条目也被发布出去了(下面的输出略去了其他路由条目)。

[R5]display  ip routing-table

Route Flags: R - relay, D - download to fib

----------------------------------------------------------------------------

Routing Tables: Public

         Destinations : 16       Routes : 16       

Destination/Mask     Proto   Pre  Cost     Flags NextHop         Interface

      10.0.35.0/24 Direct  0    0           D   10.0.35.5       Serial1/0/0

      10.0.35.3/32 Direct  0    0           D   10.0.35.3       Serial1/0/0

      10.0.35.5/32 Direct  0    0           D   127.0.0.1       InLoopBack0

    10.0.35.255/32 Direct  0    0           D   127.0.0.1       InLoopBack0

最后测试网络连通性。

[R1]ping -c 1 10.0.5.5

  PING 10.0.5.5: 56  data bytes, press CTRL_C to break

    Reply from 10.0.5.5: bytes=56 Sequence=1 ttl=254 time=41 ms

  --- 10.0.5.5 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 41/41/41 ms

在R1上查看OSPF外部路由在链路状态数据库中的情况。我们可以看到,R1的LSDB中一共有3条外部路由:10.0.5.0/24、10.0.35.0/24、10.0.35.3/32。

在R1的路由表中看见的外部路由只有2条,另一条不见了。

 [R1]display ospf lsdb ase

         OSPF Process 1 with Router ID 10.0.1.1

                 Link State Database

  Type      : External

  Ls id     : 10.0.5.0

  Adv rtr   : 10.0.5.5  

  Ls age    : 834

  Len       : 36

  Options   :  E  

  seq#      : 80000001

  chksum    : 0xa904

  Net mask  : 255.255.255.0

  TOS 0  Metric: 1

  E type    : 2

  Forwarding Address : 0.0.0.0

  Tag       : 1

  Priority  : Low

  Type      : External

  Ls id     : 10.0.35.0

  Adv rtr   : 10.0.5.5  

  Ls age    : 1342

  Len       : 36

  Options   :  E  

  seq#      : 80000001

  chksum    : 0x5e31                      

  Net mask  : 255.255.255.0

  TOS 0  Metric: 1

  E type    : 2

  Forwarding Address : 0.0.0.0

  Tag       : 1

  Priority  : Low

  Type      : External

  Ls id     : 10.0.35.3

  Adv rtr   : 10.0.5.5  

  Ls age    : 1344

  Len       : 36

  Options   :  E  

  seq#      : 80000001

  chksum    : 0x404c

  Net mask  : 255.255.255.255

  TOS 0  Metric: 1

  E type    : 2

  Forwarding Address : 0.0.0.0

  Tag       : 1

  Priority  : Medium

经过比较后,可以发现10.0.35.0/24这条路由是以内部路由的形式出现在路由表中的。

检查R1的LSDB中得第三类LSA就可以看到这个条目:10.0.35.0/24。

[R1]display ospf lsdb summary 10.0.35.0

         OSPF Process 1 with Router ID 10.0.1.1

                         Area: 0.0.0.0

                 Link State Database

  Type      : Sum-Net

  Ls id     : 10.0.35.0

  Adv rtr   : 10.0.3.3  

  Ls age    : 236

  Len       : 28

  Options   :  E  

  seq#      : 80000007

  chksum    : 0x14e5

  Net mask  : 255.255.255.0

  Tos 0  metric: 1562

  Priority  : Low

                         Area: 0.0.0.2

                 Link State Database

  Type      : Sum-Net

  Ls id     : 10.0.35.0

  Adv rtr   : 10.0.1.1  

  Ls age    : 1637

  Len       : 28

  Options   :  E  

  seq#      : 80000002

  chksum    : 0x42bf

  Net mask  : 255.255.255.0

  Tos 0  metric: 1563

  Priority  : Low

可以看出,当第三类和第五类LSA通告路由的网络位和掩码相同的情况下,OSPF优选第三类LSA通告的路由加到路由表里。

步骤五.查看各种类型的LSA

在R1上查看一类LSA 10.0.1.0在Area0和Area2的详细内容。

[R1]display ospf lsdb router 10.0.1.1

         OSPF Process 1 with Router ID 10.0.1.1

                         Area: 0.0.0.0

                 Link State Database

  Type : Router

  Ls id : 10.0.1.1

  Adv rtr : 10.0.1.1  

  Ls age : 591

  Len : 36

  Options :  ABR  E  

  seq# : 8000001e

  chksum : 0xbc70

  Link count: 1

   * Link ID: 10.1.234.3   

     Data : 10.1.234.1   

     Link Type: TransNet     

     Metric : 1

                         Area: 0.0.0.2

                 Link State Database

  Type : Router

  Ls id : 10.0.1.1

  Adv rtr : 10.0.1.1  

  Ls age : 627

  Len : 36

  Options :  ABR  E  

  seq# : 80000008

  chksum : 0x1018

  Link count: 1                           

   * Link ID: 10.0.1.0     

     Date : 255.255.255.0 

     Link Type: StubNet      

     Metric : 0

     Priority: Low

对于一类LSA来说,Ls id字段表示生成这条LSA的路由器的Router ID。

R1共生成了两条第一类LSA,一条在区域0中泛洪。R1在区域0中与一个Transit网段相连,所以Link Type字段为TransNet。对于TransNet,Link ID字段为该网段上DR的接口IP地址,Data字段为本地接口的IP地址。

第二条一类LSA是R1向区域2中泛洪的,R1与区域2通过Loopback接口相连。对于Loopback接口,Link Type为StubNet,此时Link ID表示该Stub网段的IP网络地址,Data表示该Stub网段的网络掩码。

在R2、R3和R4上分别查看二类LSA 10.1.234.0在Area0的详细内容。

[R2]display ospf lsdb network 10.1.234.3

         OSPF Process 1 with Router ID 10.0.2.2

                         Area: 0.0.0.0

                 Link State Database

  Type      : Network

  Ls id     : 10.1.234.3

  Adv rtr   : 10.0.3.3  

  Ls age    : 115

  Len       : 40

  Options   :  E  

  seq#      : 8000000f

  chksum    : 0x807e

  Net mask  : 255.255.255.0

  Priority  : Low

     Attached Router    10.0.3.3

     Attached Router    10.0.1.1

     Attached Router    10.0.2.2

     Attached Router    10.0.4.4

发现在R2、R3和R4上看到的这条LSA是一样的。

同样,可以通过Adv rtr字段得知这条LSA是由R3生成的。第二类LSA 的Ls id描述的是该网段上DR的接口IP地址,Attached Router为该网段上所有路由器的Router ID。

在R1和R3上查看三类LSA 10.0.35.0/24在Area0的详细内容。

[R3]display ospf lsdb summary 10.0.35.0

         OSPF Process 1 with Router ID 10.0.3.3

                         Area: 0.0.0.0

                 Link State Database

  Type      : Sum-Net

  Ls id     : 10.0.35.0

  Adv rtr   : 10.0.3.3 

  Ls age    : 591

  Len       : 28

  Options   :  E  

  seq#      : 8000000a

  chksum    : 0xee8

  Net mask  : 255.255.255.0

  Tos 0  metric: 1562

  Priority  : Low

从输出中可以看到该路由是由R3向区域0中通告的。Ls id就是通告的目的网段的网络地址,Net mask描述了目的网段的掩码信息。

[R1]display ospf lsdb summary 10.0.35.0

         OSPF Process 1 with Router ID 10.0.1.1

                         Area: 0.0.0.0

                 Link State Database

  Type      : Sum-Net

  Ls id     : 10.0.35.0

  Adv rtr   : 10.0.3.3

  Ls age    : 136

  Len       : 28

  Options   :  E  

  seq#      : 80000004

  chksum    : 0x1ae2

  Net mask  : 255.255.255.0

  Tos 0  metric: 1562

  Priority  : Low

                         Area: 0.0.0.2

                 Link State Database

  Type      : Sum-Net

  Ls id     : 10.0.35.0

  Adv rtr   : 10.0.1.1

  Ls age    : 382

  Len       : 28

  Options   :  E  

  seq#      : 80000002

  chksum    : 0x42bf

  Net mask  : 255.255.255.0

  Tos 0  metric: 1563

  Priority  : Low  

在R1上共有2条描述10.0.35.0/24的第三类LSA。其中,从Adv rtr字段我们可以得知区域0中这条LSA是R3产生的。由于R1本身也是一台ABR,所以R1收到这条LSA以后又产生了一条LSA,向区域2中通告。

在R1上查看四类LSA 10.0.5.0在Area2的详细内容。第四类LSA用于描述如何到达ASBR。

[R1]display ospf lsdb asbr 10.0.5.5

         OSPF Process 1 with Router ID 10.0.1.1

                         Area: 0.0.0.0

                 Link State Database

  Type      : Sum-Asbr

  Ls id     : 10.0.5.5

  Adv rtr   : 10.0.3.3  

  Ls age    : 1119

  Len       : 28

  Options   :  E  

  seq#      : 80000008

  chksum    : 0x1df3

  Tos 0  metric: 1562

                         Area: 0.0.0.2

                 Link State Database

  Type      : Sum-Asbr

  Ls id     : 10.0.5.5

  Adv rtr   : 10.0.1.1  

  Ls age    : 1118

  Len       : 28

  Options   :  E  

  seq#      : 80000008

  chksum    : 0x41d2

  Tos 0  metric: 1563

从输出中可以看到,R1从R3收到了一条第四类LSA。Ls id用于描述ASBR的Router ID。由于这类LSA不能跨区域泛洪,所以R1又生成了一条第四类LSA向区域2中泛洪。

在R2、R4以及R3的区域0的LSDB中均存在这条LSA,因为这些路由器和ASBR(R5)不在同一个区域,他们需要通过第四类LSA来得知ASBR的位置。

[R2]display ospf lsdb asbr

         OSPF Process 1 with Router ID 10.0.2.2

                         Area: 0.0.0.0

                 Link State Database

  Type      : Sum-Asbr

  Ls id     : 10.0.5.5

  Adv rtr   : 10.0.3.3  

  Ls age    : 1676

  Len       : 28

  Options   :  E  

  seq#      : 80000008

  chksum    : 0x1df3

  Tos 0  metric: 1562

在区域1中就没有这条第四类LSA,同一个区域的路由器,不需要依赖这条LSA来得知ASBR的位置。

步骤六.观察LSR、LSU和LSAck

我们首先观察OSPF的Update数据包及ACK数据包发送的过程。在R1上打开debugging ospf packet updatedebugging ospf packet ack

<R1>terminal monitor

Info: Current terminal monitor is on

<R1>terminal debugging

Info: Current terminal debugging is on

<R1>debugging ospf packet update

<R1>debugging ospf packet ack

默认情况下,网络稳定运行,OSPF路由器每30分钟更新一次。为触发查询和更新信息,我们将R3的Loopback 0接口删除。

[R3]undo interface LoopBack 0

Info: This operation may take a few seconds. Please wait for a moment...succeeded.

[R3]

Oct 25 2016 15:32:27+00:00 R3 %%01IFNET/4/LINK_STATE(l)[58]:The line protocol IP on the interface LoopBack0 has entered the DOWN state

我们可以观察到首先在R1上接收到10.1.234.3发来的Update消息,消息的目的地址为224.0.0.5(即所有OSPF路由器),描述了一个网段(# Links: 1),后面有该网段的LinkID和LinkData。

<R1>

Oct 25 2016 15:24:57.790.1+00:00 R1 RM/6/RMDEBUG:

 FileID: 0xd0178024 Line: 2271 Level: 0x20

 OSPF 1: RECV Packet. Interface: GigabitEthernet0/0/0

<R1>

Oct 25 2016 15:24:57.790.2+00:00 R1 RM/6/RMDEBUG:  Source Address: 10.1.234.3

Oct 25 2016 15:24:57.790.3+00:00 R1 RM/6/RMDEBUG:  Destination Address: 224.0.0.5

Oct 25 2016 15:24:57.790.4+00:00 R1 RM/6/RMDEBUG:  Ver# 2, Type: 4 (Link-State Update)

Oct 25 2016 15:24:57.790.5+00:00 R1 RM/6/RMDEBUG:  Length: 64, Router: 10.0.3.3

Oct 25 2016 15:24:57.790.6+00:00 R1 RM/6/RMDEBUG:  Area: 0.0.0.0, Chksum: d8ce

Oct 25 2016 15:24:57.790.7+00:00 R1 RM/6/RMDEBUG:  AuType: 00

Oct 25 2016 15:24:57.790.8+00:00 R1 RM/6/RMDEBUG:  Key(ascii): * * * * * * * *

Oct 25 2016 15:24:57.790.9+00:00 R1 RM/6/RMDEBUG:  # LSAS: 1

Oct 25 2016 15:24:57.790.10+00:00 R1 RM/6/RMDEBUG:  LSA Type 1

Oct 25 2016 15:24:57.790.11+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.3.3

Oct 25 2016 15:24:57.790.12+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.3.3

Oct 25 2016 15:24:57.790.13+00:00 R1 RM/6/RMDEBUG:    LSA Age: 1

Oct 25 2016 15:24:57.790.14+00:00 R1 RM/6/RMDEBUG:    Options: ExRouting:ON

Oct 25 2016 15:24:57.790.15+00:00 R1 RM/6/RMDEBUG:    Length: 36, Seq# 80000020

Oct 25 2016 15:24:57.790.16+00:00 R1 RM/6/RMDEBUG:    CheckSum: 9090

Oct 25 2016 15:24:57.790.17+00:00 R1 RM/6/RMDEBUG:    NtBit: 0  VBit: 0 EBit: 0 BBit: 1

Oct 25 2016 15:24:57.790.18+00:00 R1 RM/6/RMDEBUG:    # Links: 1

Oct 25 2016 15:24:57.790.19+00:00 R1 RM/6/RMDEBUG:    LinkID: 10.1.234.3

Oct 25 2016 15:24:57.790.20+00:00 R1 RM/6/RMDEBUG:      LinkData: 10.1.234.3

Oct 25 2016 15:24:57.790.21+00:00 R1 RM/6/RMDEBUG:      LinkType: 2

Oct 25 2016 15:24:57.790.22+00:00 R1 RM/6/RMDEBUG:      TOS# 0 Metric 1

最后是R1自己发送的ACK报文。报文源地址为R1 GigabitEthernet 0/0/0的接口地址,目的地址为224.0.0.6。该报文是发送给DR和BDR的。该报文的序列号也是80000020。

<R1>

Oct 25 2016 15:24:58.200.1+00:00 R1 RM/6/RMDEBUG:

 FileID: 0xd0178025 Line: 4708 Level: 0x20

 OSPF 1: SEND Packet. Interface: GigabitEthernet0/0/0

<R1>

Oct 25 2016 15:24:58.200.2+00:00 R1 RM/6/RMDEBUG:  Source Address: 10.1.234.1

Oct 25 2016 15:24:58.200.3+00:00 R1 RM/6/RMDEBUG:  Destination Address: 224.0.0.6

Oct 25 2016 15:24:58.200.4+00:00 R1 RM/6/RMDEBUG:  Ver# 2, Type: 5 (Link-State Ack)

Oct 25 2016 15:24:58.200.5+00:00 R1 RM/6/RMDEBUG:  Length: 44, Router: 10.0.1.1

Oct 25 2016 15:24:58.200.6+00:00 R1 RM/6/RMDEBUG:  Area: 0.0.0.0, Chksum: c5ef

Oct 25 2016 15:24:58.200.7+00:00 R1 RM/6/RMDEBUG:  AuType: 00

Oct 25 2016 15:24:58.200.8+00:00 R1 RM/6/RMDEBUG:  Key(ascii): * * * * * * * *

Oct 25 2016 15:24:58.200.9+00:00 R1 RM/6/RMDEBUG:  # LSA Headers: 1

Oct 25 2016 15:24:58.200.10+00:00 R1 RM/6/RMDEBUG:  LSA Type 1

Oct 25 2016 15:24:58.200.11+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.3.3

Oct 25 2016 15:24:58.200.12+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.3.3

Oct 25 2016 15:24:58.200.13+00:00 R1 RM/6/RMDEBUG:    LSA Age: 2

Oct 25 2016 15:24:58.200.14+00:00 R1 RM/6/RMDEBUG:    Options: ExRouting:ON

Oct 25 2016 15:24:58.200.15+00:00 R1 RM/6/RMDEBUG:    Length: 36, Seq# 80000020

Oct 25 2016 15:24:58.200.16+00:00 R1 RM/6/RMDEBUG:    CheckSum: 9090

接下来恢复R3上删除的Loopback0接口。

[R3]interface loopback 0

[R3-LoopBack0]ip address 10.0.3.3 24

[R3-LoopBack0]quit

和刚才一样,R1首先收到来自R3的Update报文,但这次在报文中通告了一个新的网段,所以# Links这里值为2,后面有新通告的网段的网络号和掩码。

<R1>

Oct 25 2016 15:51:26.250.1+00:00 R1 RM/6/RMDEBUG:

 FileID: 0xd0178024 Line: 2271 Level: 0x20

 OSPF 1: RECV Packet. Interface: GigabitEthernet0/0/0

<R1>

Oct 25 2016 15:51:26.250.2+00:00 R1 RM/6/RMDEBUG:  Source Address: 10.1.234.3

Oct 25 2016 15:51:26.250.3+00:00 R1 RM/6/RMDEBUG:  Destination Address: 224.0.0.5

Oct 25 2016 15:51:26.250.4+00:00 R1 RM/6/RMDEBUG:  Ver# 2, Type: 4 (Link-State Update)

Oct 25 2016 15:51:26.250.5+00:00 R1 RM/6/RMDEBUG:  Length: 76, Router: 10.0.3.3

Oct 25 2016 15:51:26.250.6+00:00 R1 RM/6/RMDEBUG:  Area: 0.0.0.0, Chksum: 2c6f

Oct 25 2016 15:51:26.250.7+00:00 R1 RM/6/RMDEBUG:  AuType: 00

Oct 25 2016 15:51:26.250.8+00:00 R1 RM/6/RMDEBUG:  Key(ascii): * * * * * * * *

Oct 25 2016 15:51:26.250.9+00:00 R1 RM/6/RMDEBUG:  # LSAS: 1

Oct 25 2016 15:51:26.250.10+00:00 R1 RM/6/RMDEBUG:  LSA Type 1

Oct 25 2016 15:51:26.250.11+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.3.3

Oct 25 2016 15:51:26.250.12+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.3.3

Oct 25 2016 15:51:26.250.13+00:00 R1 RM/6/RMDEBUG:    LSA Age: 1

Oct 25 2016 15:51:26.250.14+00:00 R1 RM/6/RMDEBUG:    Options: ExRouting:ON

Oct 25 2016 15:51:26.250.15+00:00 R1 RM/6/RMDEBUG:    Length: 48, Seq# 8000002a

Oct 25 2016 15:51:26.250.16+00:00 R1 RM/6/RMDEBUG:    CheckSum: 2cca

Oct 25 2016 15:51:26.250.17+00:00 R1 RM/6/RMDEBUG:    NtBit: 0  VBit: 0 EBit: 0 BBit: 1

Oct 25 2016 15:51:26.250.18+00:00 R1 RM/6/RMDEBUG:    # Links: 2

Oct 25 2016 15:51:26.250.19+00:00 R1 RM/6/RMDEBUG:    LinkID: 10.1.234.3

Oct 25 2016 15:51:26.250.20+00:00 R1 RM/6/RMDEBUG:      LinkData: 10.1.234.3

Oct 25 2016 15:51:26.250.21+00:00 R1 RM/6/RMDEBUG:      LinkType: 2

Oct 25 2016 15:51:26.250.22+00:00 R1 RM/6/RMDEBUG:      TOS# 0 Metric 1

Oct 25 2016 15:51:26.250.23+00:00 R1 RM/6/RMDEBUG:    LinkID: 10.0.3.3

Oct 25 2016 15:51:26.250.24+00:00 R1 RM/6/RMDEBUG:      LinkData: 255.255.255.255

Oct 25 2016 15:51:26.250.25+00:00 R1 RM/6/RMDEBUG:      LinkType: 3

Oct 25 2016 15:51:26.250.26+00:00 R1 RM/6/RMDEBUG:      TOS# 0 Metric 0

R1首先收到BDR的ACK报文。

 <R1>

Oct 25 2016 15:51:27.90.1+00:00 R1 RM/6/RMDEBUG:

 FileID: 0xd0178024 Line: 2271 Level: 0x20

 OSPF 1: RECV Packet. Interface: GigabitEthernet0/0/0

<R1>

Oct 25 2016 15:51:27.90.2+00:00 R1 RM/6/RMDEBUG:  Source Address: 10.1.234.2

Oct 25 2016 15:51:27.90.3+00:00 R1 RM/6/RMDEBUG:  Destination Address: 224.0.0.5

Oct 25 2016 15:51:27.90.4+00:00 R1 RM/6/RMDEBUG:  Ver# 2, Type: 5 (Link-State Ack)

Oct 25 2016 15:51:27.90.5+00:00 R1 RM/6/RMDEBUG:  Length: 44, Router: 10.0.2.2

Oct 25 2016 15:51:27.90.6+00:00 R1 RM/6/RMDEBUG:  Area: 0.0.0.0, Chksum: 289f

Oct 25 2016 15:51:27.90.7+00:00 R1 RM/6/RMDEBUG:  AuType: 00

Oct 25 2016 15:51:27.90.8+00:00 R1 RM/6/RMDEBUG:  Key(ascii): * * * * * * * *

Oct 25 2016 15:51:27.90.9+00:00 R1 RM/6/RMDEBUG:  # LSA Headers: 1

Oct 25 2016 15:51:27.90.10+00:00 R1 RM/6/RMDEBUG:  LSA Type 1

Oct 25 2016 15:51:27.90.11+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.3.3

Oct 25 2016 15:51:27.90.12+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.3.3

Oct 25 2016 15:51:27.90.13+00:00 R1 RM/6/RMDEBUG:    LSA Age: 2

Oct 25 2016 15:51:27.90.14+00:00 R1 RM/6/RMDEBUG:    Options: ExRouting:ON

Oct 25 2016 15:51:27.90.15+00:00 R1 RM/6/RMDEBUG:    Length: 48, Seq# 8000002a

Oct 25 2016 15:51:27.90.16+00:00 R1 RM/6/RMDEBUG:    CheckSum: 2cca

最后是R1自己发送的ACK报文。

<R1>

Oct 25 2016 15:51:26.430.1+00:00 R1 RM/6/RMDEBUG:

 FileID: 0xd0178025 Line: 4708 Level: 0x20

 OSPF 1: SEND Packet. Interface: GigabitEthernet0/0/0

<R1>

Oct 25 2016 15:51:26.430.2+00:00 R1 RM/6RMDEBUG:  Source Address: 10.1.234.1

Oct 25 2016 15:51:26.430.3+00:00 R1 RM/6/RMDEBUG:  Destination Address: 224.0.0.6

Oct 25 2016 15:51:26.430.4+00:00 R1 RM/6/RMDEBUG:  Ver# 2, Type: 5 (Link-State Ack)

Oct 25 2016 15:51:26.430.5+00:00 R1 RM/6/RMDEBUG:  Length: 44, Router: 10.0.1.1

Oct 25 2016 15:51:26.430.6+00:00 R1 RM/6/RMDEBUG:  Area: 0.0.0.0, Chksum: 29a1

Oct 25 2016 15:51:26.430.7+00:00 R1 RM/6/RMDEBUG:  AuType: 00

Oct 25 2016 15:51:26.430.8+00:00 R1 RM/6/RMDEBUG:  Key(ascii): * * * * * * * *

Oct 25 2016 15:51:26.430.9+00:00 R1 RM/6/RMDEBUG:  # LSA Headers: 1

Oct 25 2016 15:51:26.430.10+00:00 R1 RM/6/RMDEBUG:  LSA Type 1

Oct 25 2016 15:51:26.430.11+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.3.3

Oct 25 2016 15:51:26.430.12+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.3.3

Oct 25 2016 15:51:26.430.13+00:00 R1 RM/6/RMDEBUG:    LSA Age: 1

Oct 25 2016 15:51:26.430.14+00:00 R1 RM/6/RMDEBUG:    Options: ExRouting:ON

Oct 25 2016 15:51:26.430.15+00:00 R1 RM/6/RMDEBUG:    Length: 48, Seq# 8000002a

Oct 25 2016 15:51:26.430.16+00:00 R1 RM/6/RMDEBUG:    CheckSum: 2cca

在下面一个步骤中我们看Request报文。正常情况下,路由器不会主动发送该报文,为观察该报文的发送,我们将R1的OSPF进程重启。在路由器上观察到的是R1向R2发起了LS Request。

<R1>terminal monitor

Info: Current terminal monitor is on

<R1>terminal debugging

Info: Current terminal debugging is on

<R1>debugging ospf packet update

<R1>debugging ospf packet ack

<R1>debugging ospf packet request

<R1>reset ospf process

Warning: The OSPF process will be reset. Continue? [Y/N]:y

<R1>

Oct 25 2016 16:17:59.750.1+00:00 R1 RM/6/RMDEBUG:

 FileID: 0xd0178025 Line: 2993 Level: 0x20

 OSPF 1: SEND Packet. Interface: GigabitEthernet0/0/0

<R1>

Oct 25 2016 16:17:59.750.2+00:00 R1 RM/6/RMDEBUG:  Source Address: 10.1.234.1

Oct 25 2016 16:17:59.750.3+00:00 R1 RM/6/RMDEBUG:  Destination Address: 10.1.234.2

Oct 25 2016 16:17:59.750.4+00:00 R1 RM/6/RMDEBUG:  Ver# 2, Type: 3 (Link-State Req)

Oct 25 2016 16:17:59.750.5+00:00 R1 RM/6/RMDEBUG:  Length: 156, Router: 10.0.1.1

Oct 25 2016 16:17:59.750.6+00:00 R1 RM/6/RMDEBUG:  Area: 0.0.0.0, Chksum: 8b05

Oct 25 2016 16:17:59.750.7+00:00 R1 RM/6/RMDEBUG:  AuType: 00

Oct 25 2016 16:17:59.750.8+00:00 R1 RM/6/RMDEBUG:  Key(ascii): * * * * * * * *

Oct 25 2016 16:17:59.750.9+00:00 R1 RM/6/RMDEBUG:  # Requesting LSAs: 11

Oct 25 2016 16:17:59.750.10+00:00 R1 RM/6/RMDEBUG:  LSA Type 1

Oct 25 2016 16:17:59.750.11+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.2.2

Oct 25 2016 16:17:59.750.12+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.2.2

Oct 25 2016 16:17:59.750.13+00:00 R1 RM/6/RMDEBUG:  LSA Type 1

Oct 25 2016 16:17:59.750.14+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.1.1

Oct 25 2016 16:17:59.750.15+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.1.1

Oct 25 2016 16:17:59.750.16+00:00 R1 RM/6/RMDEBUG:  LSA Type 1

Oct 25 2016 16:17:59.750.17+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.4.4

Oct 25 2016 16:17:59.750.18+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.4.4

Oct 25 2016 16:17:59.750.19+00:00 R1 RM/6/RMDEBUG:  LSA Type 1

Oct 25 2016 16:17:59.750.20+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.3.3

Oct 25 2016 16:17:59.750.21+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.3.3

Oct 25 2016 16:17:59.750.22+00:00 R1 RM/6/RMDEBUG:  LSA Type 2

Oct 25 2016 16:17:59.750.23+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.1.234.3

Oct 25 2016 16:17:59.750.24+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.3.3

Oct 25 2016 16:17:59.750.25+00:00 R1 RM/6/RMDEBUG:  LSA Type 3

Oct 25 2016 16:17:59.750.26+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.1.0

Oct 25 2016 16:17:59.750.27+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.1.1

Oct 25 2016 16:17:59.750.28+00:00 R1 RM/6/RMDEBUG:  LSA Type 3

Oct 25 2016 16:17:59.750.29+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.35.0

Oct 25 2016 16:17:59.750.30+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.3.3

Oct 25 2016 16:17:59.750.31+00:00 R1 RM/6/RMDEBUG:  LSA Type 4

Oct 25 2016 16:17:59.750.32+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.5.5

Oct 25 2016 16:17:59.750.33+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.3.3

Oct 25 2016 16:17:59.750.34+00:00 R1 RM/6/RMDEBUG:  LSA Type 5

Oct 25 2016 16:17:59.750.35+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.5.0

Oct 25 2016 16:17:59.750.36+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.5.5

Oct 25 2016 16:17:59.750.37+00:00 R1 RM/6/RMDEBUG:  LSA Type 5

Oct 25 2016 16:17:59.750.38+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.35.0

Oct 25 2016 16:17:59.750.39+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.5.5

Oct 25 2016 16:17:59.750.40+00:00 R1 RM/6/RMDEBUG:  LSA Type 5

Oct 25 2016 16:17:59.750.41+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.35.3

Oct 25 2016 16:17:59.750.42+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.5.5

随后R1收到了来自R3的LS Request。

<R1>

Oct 25 2016 16:30:10.80.1+00:00 R1 RM/6/RMDEBUG:

 FileID: 0xd0178024 Line: 2271 Level: 0x20

 OSPF 1: RECV Packet. Interface: GigabitEthernet0/0/0

<R1>

Oct 25 2016 16:30:10.80.2+00:00 R1 RM/6/RMDEBUG:  Source Address: 10.1.234.3

Oct 25 2016 16:30:10.80.3+00:00 R1 RM/6/RMDEBUG:  Destination Address: 10.1.234.1

Oct 25 2016 16:30:10.80.4+00:00 R1 RM/6/RMDEBUG:  Ver# 2, Type: 3 (Link-State Req)

Oct 25 2016 16:30:10.80.5+00:00 R1 RM/6/RMDEBUG:  Length: 48, Router: 10.0.3.3

Oct 25 2016 16:30:10.80.6+00:00 R1 RM/6/RMDEBUG:  Area: 0.0.0.0, Chksum: c4c2

Oct 25 2016 16:30:10.80.7+00:00 R1 RM/6/RMDEBUG:  AuType: 00

Oct 25 2016 16:30:10.80.8+00:00 R1 RM/6/RMDEBUG:  Key(ascii): * * * * * * * *

Oct 25 2016 16:30:10.80.9+00:00 R1 RM/6/RMDEBUG:  # Requesting LSAs: 2

Oct 25 2016 16:30:10.80.10+00:00 R1 RM/6/RMDEBUG:  LSA Type 1

Oct 25 2016 16:30:10.80.11+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.1.1

Oct 25 2016 16:30:10.80.12+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.1.1

Oct 25 2016 16:30:10.80.13+00:00 R1 RM/6/RMDEBUG:  LSA Type 3

Oct 25 2016 16:30:10.80.14+00:00 R1 RM/6/RMDEBUG:    LS ID: 10.0.1.0

Oct 25 2016 16:30:10.80.15+00:00 R1 RM/6/RMDEBUG:    Adv Rtr: 10.0.1.1

附加实验: 思考并验证

假设区域2存在一台路由器R6。它计算到达10.0.5.0/24网段的路由信息与R2、R3计算该信息的步骤有什么差异?

类型4的LSA什么时候会出现?

实验中如果将R1和R4都配置成DROther,会有什么隐患?

最终设备配置

<R1>display current-configuration

[V200R007C00SPC600]

#

 sysname R1

#

interface GigabitEthernet0/0/0

 ip address 10.1.234.1 255.255.255.0

#

interface LoopBack0

 ip address 10.0.1.1 255.255.255.0

 ospf network-type broadcast

#

ospf 1 router-id 10.0.1.1

 area 0.0.0.0

  network 10.1.234.1 0.0.0.0

 area 0.0.0.2

  network 10.0.1.1 0.0.0.0

#

return

<R2>display current-configuration

[V200R007C00SPC600]

#

 sysname R2

#

interface GigabitEthernet0/0/0

 ip address 10.1.234.2 255.255.255.0

 ospf dr-priority 254

#

interface LoopBack0

 ip address 10.0.2.2 255.255.255.0

 ospf network-type broadcast

#

ospf 1 router-id 10.0.2.2

 area 0.0.0.0

  network 10.1.234.2 0.0.0.0

  network 10.0.2.2 0.0.0.0

#

return

<R3>display current-configuration

[V200R007C00SPC600]

#

 sysname R3

#

interface Serial3/0/0

 link-protocol ppp

 ip address 10.0.35.3 255.255.255.0

#

interface GigabitEthernet0/0/0

 ip address 10.1.234.3 255.255.255.0

 ospf dr-priority 255

#

interface LoopBack0

 ip address 10.0.3.3 255.255.255.0

 ospf network-type broadcast

#

ospf 1 router-id 10.0.3.3

 area 0.0.0.0

  network 10.1.234.3 0.0.0.0

  network 10.0.3.3 0.0.0.0

 area 0.0.0.1

  network 10.0.35.3 0.0.0.0

#

return

<R4>display current-configuration

[V200R007C00SPC600]

#

 sysname R4

#

interface GigabitEthernet0/0/0

 ip address 10.1.234.4 255.255.255.0

 ospf dr-priority 0

#

interface LoopBack0

 ip address 10.0.4.4 255.255.255.0

 ospf network-type broadcast

#

ospf 1 router-id 10.0.4.4

 area 0.0.0.0

  network 10.1.234.4 0.0.0.0

  network 10.0.4.4 0.0.0.0

#

return

<R5>display current-configuration

[V200R007C00SPC600]

#

 sysname R5

#

interface Serial1/0/0

 link-protocol ppp

 ip address 10.0.35.5 255.255.255.0

#

interface LoopBack0

 ip address 10.0.5.5 255.255.255.0

#

ospf 1 router-id 10.0.5.5

 import-route direct

 area 0.0.0.1

  network 10.0.35.5 0.0.0.0

#

return

猜你喜欢

转载自blog.csdn.net/weixin_57099902/article/details/131835168
今日推荐