今天花了一天时间把使用思科路由器来配置OSPF协议的基本命令都总结了,绝对心血啊。 OSPF配置命令 Router(config)#router ospf10 进程号只在本地有效 Show ip ospf database external查看五类LSA 域外 Show ip ospf database nssa-external 查看七类LSA 指定RID、修改路由器优先级、修改hello间隔、dead时间、接口带宽、ospf接口的cost值,修改cost计算公式的分子 Router(config-router)#router-id 1.1.1.1 指定RID Router(config-if)#ip ospf priority 0-255 注意在接口下改 Router(config-router)#clear ip ospfprocess 重新启动OSPF路由选择进程,如果希望本路由器成为DR,则在更改优先级后用这一命令重新启动进程才能成为DR Router(config-if)#ip ospf hello-interval 10 Router(config-if)#ip ospf dead-interval 40默认是hello间隔的四倍 Router(config-if)#bandwidth 5000修改带宽,可通过修改带宽实现修改cost值的目的,这个属性是接口本身的属性。不起OSPF也能进行修改,且对其它路由进程同时产生效果 Router(config-if)#ip ospf cost 30 直接修改本接口在OSPF中的cost值 Router(config-router)#auto-cost reference-bandwidth 1000修改COST计算公式的分子,单位是Mbps,即十的六次方 路由汇总: Router(config-router)#area 0 range 172.16.32.0 255.255.254.0域间汇总,area 0 是被汇总的区域,建议在本区域所有ABR上都做 Router(config-router)#summary-address 10.0.0.0 255.0.0.0域外汇总,在ASBR的进程中做 下发默认路由:有两种方法 Router(config)#ip route 0.0.0.0 0.0.0.0 serial 0 Router(config-router)#default-information originate 如果没有写默认路由,用下面这种: Router(config-router)#default-information originate always[metric-type 1 metric 3]实际上这条命令也只能吸引路由,并不能指向一个网关,所以还是要配一个默认网关 配置stub区域区域内的每台路由器都要打上命令 Router(config-router)#area 2 stub 将area2配置为stub区域 Router(config-router)#area 2 default-cost 5将自动下发的默认路由的cost值改为5,默认情况下是1 配置totally stub区域 Router(config-router)#area 2 stub no-summary 只需在ABR上配 配置NSSA区域 Router(config-router)#area 2 nssa R2(config-router)#area 2 nssa default-information-originate在ABR上做,会向nssa区域下发一条LSA7的默认路由 R2(config-router)#area 2 default-cost 6 (在ABR上做,改Seed Cost=6) R2(config-router)#area 2 nssa default-information-originate metric6 metric-type 1 Metric-type 1的作用是将N2类型的路由改为N1类型的路由 R2(config-router)#area 2 nssa no-redistribution在ABR上做,阻止ABR上所直连的其它外部区域的路由进入nssa区域 R2(config-router)#area 2 nssa no-summary把三类的LSA也干掉,同时也下发一条LSA3默认路由,并且会取代default-information-originate所 下发的N2的默认路由 <OSPF区域问题> 1)在ABR上起不同OSPF进程,进行OSPF之间的重分布。 例如:R3的s1口在area1中,进程号是10,s0口在area 3中,进程号是20 Router ospf10 router ospf20 Redistribute ospf 20subnets redistribute ospf 10 subnets 2)tunnel Int tunnel 1 int tunnel3 Tunnel sources1 tunnelsource s1 Tunnel destination13.1.1.3 tunnel destination 13.1.1.1 Ip add 111.1.1.1255.255.255.0 Ip add 111.1.1.3255.255.255.0 Router ospf10 router ospf10 Net 111.1.1.0 0.0.0.255 area0 net 111.1.1.0 0.0.0.255 area0 3)虚链路: 最简单的方法,只需在区域的两台边界路由器上配就可以了 R3(config-router)#area 2 virtual-link 2.2.2.2 (中转区域) (对方Router-ID) ·远离Area0 / 分隔的Area 0 R2#show ip ospf virtual-links OSPF的认证 Link:同一链路上的路由器之间,在接口下做 R1(config-router)#int s1 R1(config-if)#ip ospf authentication-key wolf (配明文密码) R1(config-if)#ip ospf authentication (启动明文认证) R1(config-if)#ip ospf message-digest-key 1 md5 wolf (配密文密码) R1(config-if)#ip ospf authenticationmessage-digest-key(启动密文认证) Area:接口下配密码,进程下调用 R1(config-router)#int s0 R2(config-if)#ip ospf message-digest-key 1 md5wolf (配密文密码) R2(config-router)#area 0 authentication Message-digest (启动密文认证) 区域内的所有路由器都要认证。 Virtual-Link: R2(config-router)#area 2 virtual-link 2.2.2.2 message-digest-key 1md5 wolf (配密文密码) R2(config-router)#area 2 virtual-link 2.2.2.2 authenticationmessage-digest (启动密文认证) 如果Area0启动认证,在Virtual-Link上也要启动相应的认证。 OSPF链路类型 ·NON_BROADCAST ·3层是NBMA,2层是否让通过广播都无所谓。(FR map后加不加Broadcast皆可) 在HUB端(R1)单播 R1(config)#router os 110 R1(config-router)#neighbor 145.1.1.4 R1(config-router)#neighbor 145.1.1.5 确保HUB成为DR,和Spoke交互路由信息。 R1(config)#int s0 R1(config-if)#ip ospf priority 2 R4/R5(config-if)#ip ospf priority 0 R4: O 5.5.5.0 [110/65] via145.1.1.5, 00:00:07, Serial 手工MAP(Spoke 端的互访) R4(config-if)#frame-relay map ip 145.1.1.5 401 R5(config-if)#frame-relay map ip 145.1.1.4 501 ·BROADCAST ·3层是BMA,2层也一定要让广播通过。(FR map后一定要加Broadcsat) R1(config-if)#fram ma ip 145.1.1.4 104 broadcast R1(config-if)#fram ma ip 145.1.1.5 105 broadcast 确保HUB成为DR,和Spoke交互路由信息。 R1(config)#int s0 R1(config-if)#ip ospf priority 2 R4/R5(config-if)#ip ospf priority 0 R4: O 5.5.5.0 [110/65] via145.1.1.5, 00:00:07, Serial 手工MAP R4(config-if)#frame-relay map ip 145.1.1.5 401 broadcast R5(config-if)#frame-relay map ip 145.1.1.4 501 broadcast ·POINT_TO_MULTIPOINT NON_BROADCAST cisco专有的 ·R1#show ip os neighbor detail ·POINT_TO_POINT(做不同网段) |
不良信息举报Q:2000617|Archiver|ROS软路由论坛 ROSABC.com 网络方案网络工程交流
GMT+8, 2024-6-8 18:20 , Processed in 0.246813 second(s), 15 queries .
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.