OSPF配置案例演示

    Read
OSPF配置演示

OSPF配置演示

R1:

Router>enable
Router#configure terminal
Router(config)#hostname R1
R1(config)#interface fastethernet 0/0SourceByrd's Weblog-https://note.t4x.org/route/ospf-configuration-demo/

R1(config-if)#ip address 192.168.1.254 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#interface fastethernet 0/1
R1 (config-if)#ip address 172.13.1.1 255.255.0.0
R1(config-if)#no shutdown
R1(config-if)#interface fastethernet 1/0
R1(config-if)#ip address 14.14.14.1 255.0.0.0
R1(config-if)#no shutdownSourceByrd's Weblog-https://note.t4x.org/route/ospf-configuration-demo/

R2:SourceByrd's Weblog-https://note.t4x.org/route/ospf-configuration-demo/

Router>ENable
Router#configure terminal
Router(config)#hostname R2
R2(config)#interface f0/0
R2(config-if)#ip add 172.28.12.254 255.255.0.0
R2(config-if)#no sh
R2(config-if)#interface fastethernet 0/1
R2(config-if)#ip add 192.24.2.2 255.255.255.128
R2(config-if)#no sh
R2(config-if)#interface f1/1
R2(config-if)#ip add 23.23.23.2 255.240.0.0
R2(config-if)#no shSourceByrd's Weblog-https://note.t4x.org/route/ospf-configuration-demo/

R3:SourceByrd's Weblog-https://note.t4x.org/route/ospf-configuration-demo/

Router>enable
Router#conf terminal
Router(config)#hostname R3
R3(config-if)#interface f0/0
R3(config-if)#ip address 10.10.10.254 255.0.0.0
R3(config-if)#no sh
R3(config-if)#interface f1/1
R3(config-if)#ip address 172.13.1.3 255.255.0.0
R3(config-if)#no sh
R3(config-if)#interface f0/1
R3(config-if)#ip add 23.23.23.3 255.240.0.0
R3(config-if)#no shutdownSourceByrd's Weblog-https://note.t4x.org/route/ospf-configuration-demo/

R4:SourceByrd's Weblog-https://note.t4x.org/route/ospf-configuration-demo/

Router>enable
Router#conf t
Router(config)#hostname R4
R4(config)#interface f0/0
R4(config-if)#ip add 14.14.14.4 255.0.0.0
R4(config-if)#no sh
R4(config-if)#interface f1/1
R4(config-if)#ip add 192.24.2.4 255.255.255.128
R4(config-if)#no shSourceByrd's Weblog-https://note.t4x.org/route/ospf-configuration-demo/

OSPF配置:SourceByrd's Weblog-https://note.t4x.org/route/ospf-configuration-demo/

R1(config)#router ospf 100
R1(config-router)# network 192.168.1.254 0.0.0.0 area 0
R1(config-router)# network 172.13.0.0 0.0.255.255 area 0
R1(config-router)# network 14.0.0.0 0.255.255.255 area 0
R2(config)#router ospf 200
R2(config-router)#network 172.28.12.254 0.0.0.0 area 0
R2(config-router)#network 192.24.2.0 0.0.0.127 area 0
R2(config-router)#network 23.23.23.2 0.0.0.0 area 0
R3(config)#router ospf 300
R3(config-router)#network 10.10.10.0 0.0.0.255 area 0
R3(config-router)#network 172.13.1.3 0.0.0.0 area 0
R3(config-router)#net 23.23.23.3 0.0.0.0 area 0
R4(config)#router ospf 400
R4(config-router)#network 14.14.14.4 0.0.0.0 area 0
R4(config-router)#network 192.24.2.0 0.0.0.127 area 0
R1#show ip route 网络号、子网号 (O 23.16.0.0 [110/2] via 172.13.1.3, 00:00:04, FastEthernet0/1)
原因分析:由于IP配置为23.23.23.2/12,A类网络方位在00000000→011111111之间,所以23.X.X.X是属于A类网络,而A类网络默认的网络位是8位,而我们设定的网络位为12为,所以采用的子网掩码为255.240.0.0,由此可以判断出这个网络中存在网络数为24=16个网络,网络结点地址数(主机数)为220=1048576-2个主机数;
合法子网号为256-240=16,即23.0.0.0、23.16.0.0、23.32.0.0……23.240.0.0等16个子网络;
子网号: 23.0.0.0 23.16.0.0 23.32.0.0 23.48.0.0 23.64.0.0 23.240.0.0
第一个主机: 23.0.0.1 23.16.0.1 23.32.0.1 23.48.0.1 23.64.0.1 23.240.0.1
最后一个主机: 23.15.255.254 23.31.255.254 23.47.255.254 23.63.255.254 23.255.255.254
23.23.23.2→ 00010111 00010111 00010111 00000010
255.240.0.0→ 11111111 11110000 00000000 00000000
于运算的结果→00010111 00010000 00000000 00000000 (23.16.0.0)
修改Router-id:
R1(config)#router ospf 100
R1(config-router)#router-id 1.1.1.1
修改开销值(cost):
R1(config)#interface f0/1
R1(config-if)#ip ospf cost 20
配置明文密码认证:
1:定义密码;
2:开启明文认证(①接口下配置;②ospf进程下配置);
方法一:
R3(config)#interface fastEthernet 1/1
R3(config-if)#ip ospf authentication-key password
R3(config-if)#ip ospf authentication
R4(config)#interface fastEthernet 0/0
R4(config-if)#ip ospf authentication-key password
R4(config-if)#ip ospf authentication
方法二:
R1(config-if)#router ospf 100
R1(config-router)#area 0 authenticationSourceByrd's Weblog-https://note.t4x.org/route/ospf-configuration-demo/

除非注明,Byrd's Weblog文章均为原创,转载请以链接形式标明本文地址SourceByrd's Weblog-https://note.t4x.org/route/ospf-configuration-demo/

本文地址:http://note.t4x.org/route/ospf-configuration-demo/SourceByrd's Weblog-https://note.t4x.org/route/ospf-configuration-demo/

扩展:《OSPF相关补充资料SourceByrd's Weblog-https://note.t4x.org/route/ospf-configuration-demo/ SourceByrd's Weblog-https://note.t4x.org/route/ospf-configuration-demo/

申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!
Byrd
  • by Published on December 4, 2012
  • 原文链接:https://note.t4x.org/route/ospf-configuration-demo/
Comments  2  Guest  0  Pingback  2
匿名

Comment

Anonymous

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: