其他分享
首页 > 其他分享> > 关于import-route static 和default-route-advertise区别知识总结

关于import-route static 和default-route-advertise区别知识总结

作者:互联网

关于import-route static 和default-route-advertise区别知识总结

一、相关解释     

 import-route static  命令不能引入外部路由的默认路由,OSPF通过路由表更新学习到外部路由的默认路由,

      如果外部路由的默认路由需要在OSPF普通区域中发布,需要执行default-route-advertise 命令。

       在正常情况下,构建OSPF协议运行体系,在外围网络设备中,对外部路由的注入OSPF,有两种独立的方法:

        静态路由的引入用 import-route static,而默认路由用 default-route-advertise 引入,执行的位置都是在OSPF里。

        这里需要注意的是,当外网特别不稳定时,防止OSPF反复计算,可设置 default-route-advertise always,其实就是管您外网状况如何,我当您正常并一直运行。

        ***  别纠结,他这样做应该是研发人员碰到的不得已的问题,只能区别对待这两种情况,相对于对静态路由,为默认路由 0.0.0.0  0.0.0.0单独设计了一条命令,有点奢侈。:)

      在网上收集到网友这样的解释,我认为是说的通的:协议设计上的规定,用来防范意外环路的。防止引入静态路由时注入默认路由,产生环路

二、相关验证

1.ENSP模型

 

 

2.基本配置

   工作站IP地址配置,路由器接口配置,交换机vlan配置,vlan的虚接口IP地址配置

R1配置

#
interface GigabitEthernet0/0/0
ip address 192.168.20.254 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 192.168.19.1 255.255.255.0

R9配置

#
interface GigabitEthernet0/0/0
ip address 192.168.19.9 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.95.9 255.255.255.0

ip route-static 0.0.0.0 0.0.0.0 192.168.19.1  //末端路由器的默认路由配置

交换机配置

vlan batch 10 95

#
interface Vlanif10
ip address 192.168.50.254 255.255.255.0
#
interface Vlanif95
ip address 192.168.95.10 255.255.255.0

 

 

3.OSPF配置

R1配置

#
ospf 1 router-id 20.1.1.0
area 0.0.0.20
network 192.168.12.0 0.0.0.255
network 192.168.13.0 0.0.0.255
network 192.168.19.0 0.0.0.255
network 192.168.20.0 0.0.0.255

R9配置

#
ospf 1 router-id 20.1.9.0
default-route-advertise   //这一条命令就是针对R9的默认路由的,将默认路由注入OSPF,并通过LSA报文传给其他相关方
area 0.0.0.20
network 192.168.19.0 0.0.0.255
network 192.168.95.0 0.0.0.255

交换配置

#
ospf 1 router-id 20.1.10.0
area 0.0.0.20
network 192.168.95.0 0.0.0.255
network 192.168.50.0 0.0.0.255

4.连通测试

[R9]dis ospf lsdb

OSPF Process 1 with Router ID 20.1.9.0
Link State Database

Area: 0.0.0.20
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 20.1.9.0 20.1.9.0 1103 48 8000000D 1
Router 20.1.10.0 20.1.10.0 1060 48 80000005 1
Router 20.1.1.0 20.1.1.0 659 72 8000000E 1
Network 192.168.95.9 20.1.9.0 1103 32 80000002 0
Network 192.168.19.1 20.1.1.0 659 32 80000003 0


AS External Database

Type LinkState ID AdvRouter Age Len Sequence Metric
External 0.0.0.0 20.1.9.0 1438 36 80000001 1
External 192.168.40.0 30.3.70.0 1541 36 80000002 1

 

[SW1]dis ospf lsdb

OSPF Process 1 with Router ID 20.1.10.0
Link State Database

Area: 0.0.0.20
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 20.1.9.0 20.1.9.0 1273 48 8000000D 1
Router 20.1.10.0 20.1.10.0 1227 48 80000005 1
Router 20.1.1.0 20.1.1.0 829 72 8000000E 1
Network 192.168.95.9 20.1.9.0 1273 32 80000002 0
Network 192.168.19.1 20.1.1.0 829 32 80000003 0

AS External Database
Type LinkState ID AdvRouter Age Len Sequence Metric
External 0.0.0.0 20.1.9.0 1607 36 80000001 1
External 192.168.40.0 30.3.70.0 1710 36 80000002 1

PC>ipconfig

Link local IPv6 address...........: fe80::5689:98ff:fefe:445a
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.20.1
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.20.254
Physical address..................: 54-89-98-FE-44-5A
DNS server........................:

PC>ping 192.168.50.1  //连通测试正常

Ping 192.168.50.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.50.1: bytes=32 seq=2 ttl=125 time=63 ms
From 192.168.50.1: bytes=32 seq=3 ttl=125 time=31 ms
From 192.168.50.1: bytes=32 seq=4 ttl=125 time=62 ms
From 192.168.50.1: bytes=32 seq=5 ttl=125 time=47 ms

--- 192.168.50.1 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/50/63 ms

 

 

标签:20.1,default,0.0,route,192.168,static,OSPF,路由
来源: https://www.cnblogs.com/gucun-blog/p/16558105.html