今天通过三个思科路由器来进行一个运行OSPF的综合配置实验,下面是实验的拓扑图、步骤和全部配置命令的报告。这个实验有助于掌握和熟悉ospf在cisco设备组网时候的作用。 一、实验拓扑: R1、R2模拟内部网络路由器,运行OSPF协议,R3模拟互联网路由器,现需要通过R2上配置默认路由,让R1能学习到R3的3.3.3.3路由条目。
二、实验步骤: R1: interface Loopback0 ip address 1.1.1.1 255.255.255.0 interface FastEthernet0/0 ip address 192.168.1.1 255.255.255.0 duplex auto speed auto router ospf 10 router-id 1.1.1.1 log-adjacency-changes network 1.1.1.0 0.0.0.255 area 0 network 192.168.1.0 0.0.0.255 area 0 R2: interface FastEthernet0/0 ip address 192.168.1.2 255.255.255.0 duplex auto interface Serial1/0 ip address 221.16.1.1 255.255.255.252 serial restart-delay 0 router ospf 10 router-id 2.2.2.2 log-adjacency-changes network 192.168.1.0 0.0.0.255 area 0 default-information originate always R3: interface Loopback0 ip address 3.3.3.3 255.255.255.0 interface Serial0/0 ip address 221.16.1.2 255.255.255.252 serial restart-delay 0 ip route 0.0.0.0 0.0.0.0 Serial0/0 查看R1和R2的邻接关系和路由表: R1#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 1 FULL/BDR 00:00:35 192.168.1.2 FastEthernet0/0 R1#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is 192.168.1.2 to network 0.0.0.0 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 C 192.168.1.0/24 is directly connected, FastEthernet0/0 O*E2 0.0.0.0/0 [110/1] via 192.168.1.2, 00:02:07, FastEthernet0/0 R2#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 1.1.1.1 1 FULL/DR 00:00:35 192.168.1.1 FastEthernet0/0 R2#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is 0.0.0.0 to network 0.0.0.0 1.0.0.0/32 is subnetted, 1 subnets O 1.1.1.1 [110/2] via 192.168.1.1, 00:01:53, FastEthernet0/0 221.16.1.0/30 is subnetted, 1 subnets C 221.16.1.0 is directly connected, Serial1/0 C 192.168.1.0/24 is directly connected, FastEthernet0/0 S* 0.0.0.0/0 is directly connected, Serial1/0 测试从R1到3.3.3.3的网络连通性: R1#ping 3.3.3.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 408/508/640 ms
2、通过上个实验观察到R1学到O*E2的度量值为1,现在扩大度量值: R2上配置: R2 http://www.luyouqiwang.com/14422/ (config)#router ospf 10 R2(config-router)#default-information originate always metric 30 测试R1路由表: R1#show ip route ospf O*E2 0.0.0.0/0 [110/30] via 192.168.1.2, 00:00:13, FastEthernet0/0 //度量值变成30了,当然R1 PING 3.3.3.3肯定还是通的。 3、通过上个实验观察到R1的OE2度量值变成30,现在需要把OE2变成OE1,配置: R2(config)#router ospf 10 R2(config-router)#default-information originate always metric-type 1 metric 30 查看R1路由表: R1#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is 192.168.1.2 to network 0.0.0.0 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 C 192.168.1.0/24 is directly connected, FastEthernet0/0 O*E1 0.0.0.0/0 [110/31] via 192.168.1.2, 00:00:11, FastEthernet0/0 //31的度量值的算法:宣告外部路由进来为30,从R2到192.168.1.1的METRIC=1,根据OE1的度量值算法为:内部到ASBR+外部路径度量值=31 R2#show ip ospf database router LS age: 1356 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 1.1.1.1 Advertising Router: 1.1.1.1 LS Seq Number: 80000003 Checksum: 0x64D8 Length: 48 Number of Links: 2 Link connected to: a Transit Network (Link ID) Designated Router address: 192.168.1.1 (Link Data) Router Interface address: 192.168.1.1 Number of TOS metrics: 0 TOS 0 Metrics: 1 4、现在R3上增加网段4.4.4.0/24,R1 PING 3.3.3.0/24,4.4.4.0/24情况: R1#ping 3.3.3.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 364/471/568 ms R1#ping 4.4.4.4 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 284/417/620 ms R2上配置路由策略过滤掉3.3.3.0/24网段: R2(config)#access-list 1 permit 3.3.3.0 0.0.0.255 R2(config)#route-map ccna permit 10 R2(config-route-map)#match ip address 1 R2(config-route-map)#set metr R2(config-route-map)#set metric 30 R2(config-route-map)#end R2(config)#router ospf 10 R2(config-router)#no default-information originate always route-map ccna R1#ping 4.4.4.4 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 284/417/620 ms R1#ping 3.3.3.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: ..... Success rate is 0 percent (0/5) R1#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is 192.168.1.2 to network 0.0.0.0 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 C 192.168.1.0/24 is directly connected, FastEthernet0/0 O*E1 0.0.0.0/0 [110/31] via 192.168.1.2, 00:02:51, FastEthernet0/0 |
不良信息举报Q:2000617|Archiver|ROS软路由论坛 ROSABC.com 网络方案网络工程交流
GMT+8, 2024-5-16 10:57 , Processed in 0.101703 second(s), 15 queries .
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.