菱形组网之OSPF篇_第1张图片

基本OSPF

Area 0举例

首先配置PE3PE4端口IPv6地址,然后配置OSPFv3进程,把进程和端口关联,并指定域即可,router-id仍然采用loopback IPv4地址。

[PE3]dis ospfv3 peer                                                           

OSPFv3 Process (1)                                                             

OSPFv3 Area (0.0.0.0)                                                          

Neighbor ID     Pri  State            Dead Time Interface            Instance ID

4.4.4.4           1  Full/DR          00:00:36  GE0/2/0                   0

[PE3]display ospfv3 routing                                                    

Codes : E2 - Type 2 External, E1 - Type 1 External, IA - Inter-Area,           

        N - NSSA, U - Uninstalled, D - Denied by Import Policy                 

OSPFv3 Process (1)                                                             

     Destination                                               Metric          

       Next-hop                                                                

  IA 2001:DB8:24::/64                                              2           

       via FE80::AE4E:91FF:FE48:6D1, GigabitEthernet0/2/0  

(通过下一跳的本地IPv6地址获得,获得的是Area1的路由,所以是IA,域间的)                  

     2001:DB8:34::/64                                              1           

       directly connected, GigabitEthernet0/2/0 

 

虚连接

PE1不能获得Area0Area1的路由,因为OSPF规定,每个域必须和骨干区域Area0相连,该例子中,PE1无法连到Area0,于是虚拟连接(V-link)就发明了。PE2PE4搭鹊桥,让area0area2相会。

 

PE2配置如下

ospfv3 1                                                                       

 router-id 2.2.2.2                                                             

 area 0.0.0.1                                                                   

  vlink-peer 4.4.4.4

配置前PE1路由,只有直连路由

[PE1]dis ospfv3 routing                                                        

Codes : E2 - Type 2 External, E1 - Type 1 External, IA - Inter-Area,           

        N - NSSA, U - Uninstalled, D - Denied by Import Policy                 

OSPFv3 Process (1)                                                             

     Destination                                               Metric          

       Next-hop                                                                 

     2001:DB8:12::/64                                              1           

       directly connected, GigabitEthernet0/2/5

配置虚连接后,

[PE1]dis ospfv3 routing                                                        

Codes : E2 - Type 2 External, E1 - Type 1 External, IA - Inter-Area,           

        N - NSSA, U - Uninstalled, D - Denied by Import Policy                 

OSPFv3 Process (1)                                                              

     Destination                                               Metric          

       Next-hop                                                                

     2001:DB8:12::/64                                              1           

       directly connected, GigabitEthernet0/2/5                                

  IA 2001:DB8:24::/64                                               2           

       via FE80::AAEC:B8FF:FE4F:6903, GigabitEthernet0/2/5                     

  IA 2001:DB8:24::1/128                                            1           

       via FE80::AAEC:B8FF:FE4F:6903, GigabitEthernet0/2/5                     

  IA 2001:DB8:24::2/128                                            2           

       via FE80::AAEC:B8FF:FE4F:6903, GigabitEthernet0/2/5                     

  IA 2001:DB8:34::/64                                              3           

       via FE80::AAEC:B8FF:FE4F:6903, GigabitEthernet0/2/5 

 

Stub

如果PE1体弱多病,这么多路由承受不起,所以可以考虑到把PE1放在Stub域保护起来。

PE配置如下:

ospfv3 1                                                                       

 router-id 1.1.1.1                                                             

 area 0.0.0.2                                                                   

  stub 

可以配置default-cost 10啥的

配置了stub区域后,就不会接收AS外的路由,如果想去AS外怎办?就生成一条默认路由

[PE1]dis ospfv3 routing                                                        

Codes : E2 - Type 2 External, E1 - Type 1 External, IA - Inter-Area,           

        N - NSSA, U - Uninstalled, D - Denied by Import Policy                 

OSPFv3 Process (1)                                                             

     Destination                                               Metric          

       Next-hop                                                                

  IA ::/0                                                          2           

       via FE80::AAEC:B8FF:FE4F:6903, GigabitEthernet0/2/5                     

     2001:DB8:12::/64                                              1           

       directly connected, GigabitEthernet0/2/5                                

  IA 2001:DB8:24::/64                                              2           

       via FE80::AAEC:B8FF:FE4F:6903, GigabitEthernet0/2/5                     

  IA 2001:DB8:24::1/128                                            1           

       via FE80::AAEC:B8FF:FE4F:6903, GigabitEthernet0/2/5                      

  IA 2001:DB8:24::2/128                                            2           

       via FE80::AAEC:B8FF:FE4F:6903, GigabitEthernet0/2/5                     

  IA 2001:DB8:34::/64                                              3            

       via FE80::AAEC:B8FF:FE4F:6903, GigabitEthernet0/2/5

如果连域间路由都不想收的话,继续在PE2上配置

area 0.0.0.2                                                                  

  stub no-summary 

PE1上看到只有默认路由和直连路由,域间路由消失。

[PE1]dis ospfv3 routing                                                         

 

Codes : E2 - Type 2 External, E1 - Type 1 External, IA - Inter-Area,           

        N - NSSA, U - Uninstalled, D - Denied by Import Policy                 

OSPFv3 Process (1)                                                              

     Destination                                               Metric          

       Next-hop                                                                

  IA ::/0                                                          2           

       via FE80::AAEC:B8FF:FE4F:6903, GigabitEthernet0/2/5                     

     2001:DB8:12::/64                                              1           

       directly connected, GigabitEthernet0/2/5

 

DR选举

可以看到PE2DR,为啥?PE2 Router-id大,注意下面DRPE2的状态

[PE1]display ospfv3 peer                                                       

OSPFv3 Process (1)                                                             

OSPFv3 Area (0.0.0.2)                                                           

Neighbor ID     Pri  State            Dead Time Interface            Instance ID

2.2.2.2           1  Full/DR          00:00:31  GE0/2/5                        0

PE上配置DR优先级,让PE1成为DR,数值越低优先级越高。

interface GigabitEthernet0/2/5                                                  

ospfv3 dr-priority 100

重启进程reset ospfv3 1

dis ospfv3 peer                                                           

OSPFv3 Process (1)                                                             

OSPFv3 Area (0.0.0.2)                                                          

Neighbor ID     Pri  State            Dead Time Interface            Instance ID

2.2.2.2         150  Full/Backup      00:00:38  GE0/2/5                        0

 

GR

上面提到重启OSPFv3进程,这样会影响到转发,现网是有很大损失,于是发明了GR来做到重启OSPFv3进程,并不影响转发。

做个试验,现在PE4ping PE1PE1 reset OSPFv3进程,PE4上丢了6个包,说明重启进程改变了路由表,从而影响了转发。

  --- 2001:db8:12::1 ping statistics ---                                       

    114 packet(s) transmitted                                                  

    108 packet(s) received                                                     

    5.26% packet loss                                                          

    round-trip min/avg/max = 8/14/44 ms

配置PE1GR功能,然后PE2配合helper-role

reset ospfv3 1 graceful-restart

可以看到转发表依旧存在,不会因为路由表消失而消失。

display ipv6 fib                                                          

 IPv6 FIB Table:                                                                

 Total number of Routes : 5                                                    

                                                                 

Destination:  ::                                      PrefixLength : 0          

Nexthop    :  FE80::AAEC:B8FF:FE4F:6903               Flag         : DGU       

Interface  :  GigabitEthernet0/2/5                    Tunnel ID    : 0x0       

TimeStamp  :  2015-12-08 10:58

PE4上无丢包

  --- 2001:db8:12::1 ping statistics ---                                        

    677 packet(s) transmitted                                                  

    677 packet(s) received                                                     

    0.00% packet loss                                                           

    round-trip min/avg/max = 7/14/73 ms