注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 [业内传闻]今天,7月25日..
 帮助

OSPF中 LSA 2的真正用法


2007-07-12 12:33:50
 标签:OSPF LSA2   [推送到技术圈]

版权声明:原创作品,谢绝转载!否则将追究法律责任。
OSPFLsa 2的用法
 
概述:
----------------------------------------------------------------------------------------
此文档在于描述OSPFDR始发的LSA2SPF算法中的作用.
----------------------------------------------------------------------------------------
拓扑:
配置:
--------------------------------------------------------------------------------------------
R1的配置
 
R1#show run
Building configuration...
!
hostname R1
!
interface Serial2/0
 ip address 13.1.1.1 255.255.255.0
 serial restart-delay 0
!
router ospf 10
 router-id  1.1.1.1
 log-adjacency-changes
 network 13.1.1.1 0.0.0.0 area 0
!
end
--------------------------------------------------------
R2的配置
 
R2#show run
Building configuration...
!
hostname R2
!        
interface Ethernet0/0
 ip address 10.1.1.2 255.255.255.0
!
router ospf 10
 router-id 2.2.2.2
 log-adjacency-changes
 network 10.1.1.2 0.0.0.0 area 0
!
end
---------------------------------------------------------
R3的配置
 
R3#show run
Building configuration...
!
hostname R3
!
interface Ethernet0/0
 ip address 10.1.1.3 255.255.255.0
!
interface Serial1/0
 ip address 13.1.1.3 255.255.255.0
 serial restart-delay 0
!
router ospf 10
 router-id 3.3.3.3
 log-adjacency-changes
 network 10.1.1.3 0.0.0.0 area 0
 network 13.1.1.3 0.0.0.0 area 0
!
end
---------------------------------------------------------
R4的配置
 
R4#show run
Building configuration...
!
hostname R4   
!
interface Ethernet0/0
 ip address 10.1.1.4 255.255.255.0
!
router ospf 10
 router-id 4.4.4.4
 log-adjacency-changes
 network 10.1.1.4 0.0.0.0 area 0
!
end
---------------------------------------------------------
R5的配置
 
R5#show run
Building configuration...

hostname R5
!
interface Ethernet0/0
 ip address 10.1.1.5 255.255.255.0
!
router ospf 10
 router-id 5.5.5.5
 log-adjacency-changes
 network 10.1.1.5 0.0.0.0 area 0
!
end
-----------------------------------------------------------
现象:
 
R3被选举为DR,先看看作为DRR3通告给R1LSA1LSA2
-----------------------------------------------------
R1#show ip ospf data router adv 3.3.3.3
            OSPF Router with ID (1.1.1.1) (Process ID 10)
                Router Link States (Area 0)
  LS age: 791
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 3.3.3.3
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000015
  Checksum: 0x5BC0
  Length: 60
  Number of Links: 3
    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 1.1.1.1
     (Link Data) Router Interface address: 13.1.1.3
      Number of TOS metrics: 0
       TOS 0 Metrics: 64
    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 13.1.1.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 64
    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.1.1.3
     (Link Data) Router Interface address: 10.1.1.3
      Number of TOS metrics: 0
       TOS 0 Metrics: 10
 
R3通告给R1LSA1,里面表现了R3所连接了一个LAN,LAN中的DR接口个地址
 
R1#show ip ospf data net adv 3.3.3.3 
            OSPF Router with ID (1.1.1.1) (Process ID 10)
                Net Link States (Area 0)
  Routing Bit Set on this LSA
  LS age: 972
  Options: (No TOS-capability, DC)
  LS Type: Network Links
  Link State ID: 10.1.1.3 (address of Designated Router)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000006
  Checksum: 0x3D6
  Length: 40
 
Network Mask: /24
        Attached Router: 3.3.3.3
        Attached Router: 2.2.2.2
        Attached Router: 4.4.4.4
        Attached Router: 5.5.5.5
 
LSA2里明确的交代了LAN中的网络掩码.
---------------------------------------------------------
接下来看一看R1上面计算到达这个LANSPF输出信息
 
R1#debug ip ospf spf
 
OSPF: Add Network Route to 10.1.1.0 Mask /24. Metric: 74, Next Hop: 13.1.1.3
*Jul  9 18:38:39.255: OSPF: insert route list LS ID 10.1.1.3, type 2, adv rtr 3.3.3.3
*Jul  9 18:38:39.255:  It is a network LSA 10.1.1.3. Router Count 4
*Jul  9 18:38:39.255:   Processing router id 3.3.3.3
*Jul  9 18:38:39.255:   New newdist 74 olddist 64
*Jul  9 18:38:39.255:   Processing router id 2.2.2.2
*Jul  9 18:38:39.255:    Add better path to LSA ID 2.2.2.2, gateway 10.1.1.2, dist 74
*Jul  9 18:38:39.255:    Add path: next-hop 13.1.1.3, interface Serial2/0
*Jul  9 18:38:39.255:   Processing router id 4.4.4.4
*Jul  9 18:38:39.255:    Add better path to LSA ID 4.4.4.4, gateway 10.1.1.4, dist 74
*Jul  9 18:38:39.255:    Add path: next-hop 13.1.1.3, interface Serial2/0
*Jul  9 18:38:39.255:   Processing router id 5.5.5.5
*Jul  9 18:38:39.255:    Add better path to LSA ID 5.5.5.5, gateway 10.1.1.5, dist 74
*Jul  9 18:38:39.255:    Add path: next-hop 13.1.1.3, interface Serial2/0
*Jul  9 18:38:39.255:  It is a router LSA 5.5.5.5. Link Count 1
*Jul  9 18:38:39.255:   Processing link 0, id 10.1.1.3, link data 10.1.1.5, type 2
*Jul  9 18:38:39.255:   Ignore newdist 84 olddist 74
*Jul  9 18:38:39.255:  It is a router LSA 4.4.4.4. Link Count 1
*Jul  9 18:38:39.255:   Processing link 0, id 10.1.1.3, link data 10.1.1.4, type 2
*Jul  9 18:38:39.255:   Ignore newdist 84 olddist 74
*Jul  9 18:38:39.255:  It is a router LSA 2.2.2.2. Link Count 1
*Jul  9 18:38:39.255:   Processing link 0, id 10.1.1.3, link data 10.1.1.2, type 2
*Jul  9 18:38:39.255:   Ignore newdist 84 olddist 74
 
注意红色部分的link data 10.1.12,type 2 部分...这里我们可以联想一下LSA 1的输出信息.
 
R1#show ip ospf data router adv 3.3.3.3
            OSPF Router with ID (1.1.1.1) (Process ID 10)
                Router Link States (Area 0)
  LS age: 791
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 3.3.3.3
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000015
  Checksum: 0x5BC0
  Length: 60
  Number of Links: 3
    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 1.1.1.1
     (Link Data) Router Interface address: 13.1.1.3
      Number of TOS metrics: 0
       TOS 0 Metrics: 64
    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 13.1.1.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 64
    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.1.1.3
     (Link Data) Router Interface address: 10.1.1.3
      Number of TOS metrics: 0
       TOS 0 Metrics: 10
前面输出的type 2在ospfv2中定义的是transit network. 而link Data在LSA1中的表示的是通告此LSA的ADV在LAN中的接口地址.也就是说在R1在SPF计算到达LAN的每一个接口时使用了LSA是类型1的.那么类型2的又有什么用呢?
大家是否发现LSA1包含的信息中并没有包含这个LAN的掩码.而LSA2却带上了掩码
 
R1#show ip ospf data net adv 3.3.3.3 
            OSPF Router with ID (1.1.1.1) (Process ID 10)
                Net Link States (Area 0)
  Routing Bit Set on this LSA
  LS age: 972
  Options: (No TOS-capability, DC)
  LS Type: Network Links
  Link State ID: 10.1.1.3 (address of Designated Router)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000006
  Checksum: 0x3D6
  Length: 40
 
Network Mask: /24
        Attached Router: 3.3.3.3
        Attached Router: 2.2.2.2
        Attached Router: 4.4.4.4
        Attached Router: 5.5.5.5
 
 
结论
 
路由器在SPF运算时,使用LSA1确定如何到达此MAN..再使用LSA2确定到此MAN的掩码.这就是为什么LSA2要求被泛洪到整个区域的原因.也是LSA2最大的一个作用.
 
更多精华贴 请详见:http://www.one-tom.com/bbs

本文出自 “IT傻博士 [技术成就梦想]” 博客,谢绝转载!





    文章评论
 
2007-07-12 21:49:08
R3被选举为DR,先看看作为DR的R3通告给R1的LSA1和LSA2

有机会还得再学学这个

 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: