三.在帧中继网络上运行ospf 2006,完成第二个要求。
R6: R6(config)#int loopback 0
R6(config-if)#ip add 6.6.6 .6 255.255.255.0
R6(config)#router ospf 2006
R6(config-router)#router-id 6.6.6 .6
R6(config-router)#network 99.99.99.0 0.0.0 .15 area 0
R5: R5(config)#int loopback 0
R5(config-if)#ip add 5.5.5 .5 255.255.255.0
R5(config)#router ospf 2006
R5(config-router)#router-id 5.5.5 .5
R5(config-router)#network 99.99.99.0 0.0.0 .15 area 0
R4: R4(config)#int loo 0
R4(config-if)#ip add 4.4.4 .4 255.255.255.0
R4(config)#router ospf 2006
R4(config-router)#router-id 4.4.4 .4
R4(config-router)#net 99.99.99.0 0.0.0 .15 area 0
***** R6#sh ip ospf neighbor
R6#
配到这你会发现邻居没有起来,R4、R5、R6之间没有起邻居
***
R6#sh ip ospf interface
Serial1/0.1
is up, line protocol is up
Internet Address 99.99.99.6/28, Area 0
Process ID 2006, Router ID 6.6.6 .6, Network Type NON_BROADCAST, Cost: 64Transmit Delay is 1 sec, State DR , Priority 2
Designated Router (ID) 6.6.6 .6, Interface address 99.99.99.6
No backup designated router on this networkTimer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5oob-resync timeout 120
****
通过这个命令可以看到网络类型是NBMA的,在这网络类型下,不可以发送广播,hello包无法送达。所以不能建立邻居。我们需要改变网络类型****
R6(config)#int s1/0.1
R6(config-if)#ip ospf network broadcast
R5(config)#int s1/0
R5(config-if)#ip ospf network broadcast
R4(config)#int s1/0
R4(config-if)#ip ospf network broadcast
R4#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
6.6.6
.6 1 2WAY/DROTHER 00:00:38 99.99.99.6 Serial1/0
R4#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
6.6.6
.6 1 FULL/DR 00:00:33 99.99.99.6 Serial1/0
R6#sh ip ospf interface
Serial1/0.1 is up, line protocol is up
Internet Address 99.99.99.6/28, Area 0
Process ID 2006, Router ID 6.6.6 .6, Network Type BROADCAST, Cost: 64Transmit Delay is 1 sec, State DR , Priority 2
Designated Router (ID) 6.6.6 .6, Interface address 99.99.99.6
Backup Designated router (ID) 5.5.5 .5, Interface address 99.99.99.5
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit
*******
网络类型变为了广播类型
,邻居建立起来了**********
R6(config)#int s1/0.1
R6(config-if)#ip ospf priority 2
*******
要让R6变为永久的DR, 需要改变优先级,默认优先级是1
*****
*****
要想R5、R4 永不参与DR和BDR的选举,也需要修改优先级****
R6#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
4.4.4
.4 1 FULL/DROTHER 00:00:34 99.99.99.4 Serial1/0.1
5.5.5
.5 1 FULL/BDR 00:00:36 99.99.99.5 Serial1/0.1
*****
没有修改优先级时,他们参与了选举。O(∩_∩)O~********
R4(config)#int s1/0
R4(config-if)#ip ospf priority 0
R5(config)#int s1/0
R5(config-if)#ip ospf priority 0
****
优先级改为0就表明永不参与DR与BDR的选举*****
R6#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
4.4.4
.4 0 FULL/DROTHER 00:00:30 99.99.99.4 Serial1/0.1
5.5.5
.5 0 FULL/DROTHER 00:00:32 99.99.99.5 Serial1/0.1
R6# *****
查看后R4和R5全都变成了DROTHER
*****
四、 完成要求3,配置R4 R5 R1 Area 145 这个区域为完全末梢区域。
R4: R4(config)#int f0/0
R4(config-if)#no shut
R4(config-if)#ip add 145.145.145.4 255.255.255.240
R4(config)#router ospf 2006
R4(config-router)#network 145.145.145.0 0.0.0 .15 area 145
R5: R5(config)#int f0/0
R5(config-if)#ip add 145.145.145.5 255.255.255.240
R5(config)#router ospf 2006
R5(config-router)#network 145.145.145.0 0.0.0 .15 area 145
R1: R1(config)#int f0/0
R1(config-if)#ip add 145.145.145.1 255.255.255.240
R1(config-if)#no shut
R1(config)#router ospf 2006
R1(config-router)#router-id 1.1.1 .1
R1(config-router)#net 145.145.145.0 0.0.0 .15 Area 145
******
在咱们没有配置完全末梢区域时,我们先看看R1的路由表******
R1#sh 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-2ia - IS-IS inter area, * - candidate default, U - per-user static routeo - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0 .0/24 is subnetted, 1 subnets
C 1.1.1 .0 is directly connected, Loopback0
99.0.0.0/28 is subnetted, 1 subnets
O IA 99.99.99.0 [110/65] via 145.145.145.5, 00:01:37, FastEthernet0/0
[110/65] via 145.145.145.4, 00:01:37, FastEthernet0/0
145.145.0.0/28 is subnetted, 1 subnets
C 145.145.145.0 is directly connected, FastEthernet0/0
******
这是没有配置前的R1的路由表***************
R4: R4(config)#router ospf 2006
R4(config-router)#area 145 stub no-summary
********
配置完全末梢区域别忘了加no-summary这条命令
******
R5: R5(config)#router ospf 2006
R5(config-router)#area 145 stub no-summary
*******
我们在看看R1的路由表O(∩_∩)O~********
R1 1.0.0 .0/24 is subnetted, 1 subnets
C 1.1.1 .0 is directly connected, Loopback0
145.145.0.0/28 is subnetted, 1 subnets
C 145.145.145.0 is directly connected, FastEthernet0/0
O
*
I A 0.0.0 .0/0 [110/2] via 145.145.145.5, 00:00:03, FastEthernet0/0
[110/2] via 145.145.145.4, 00:00:03, FastEthernet0/0
****
我们发现完全末梢区域会产生一套
三类的默认汇总路由
O(
∩_∩)O~****
五、 完成要求4将R3 R2 加入到网络中来。
R6: R6(config)#int s1/1
R6(config-if)#ip add 36.36.36.6 255.255.255.240
R6(config-if)#clock rate 64000
R6(config-if)#no shut
R6(config)#router ospf 2006
R6(config-router)#network 36.36.36.0 0.0.0 .15 area 36
R3: R3(config)#int s1/0
R3(config-if)#no shut
R3(config-if)#ip add 36.36.36.3 255.255.255.240
R3(config)#int f0/0
R3(config-if)#no shut
R3(config-if)#ip add 23.23.23 .3 255.255.255.240
R3(config)#router ospf 2006
R3(config-router)#router-id 3.3.3 .3
R3(config-router)#network 36.36.36.0 0.0.0 .15 area 36
R3(config-router)#network 23.23.23 .0 0.0.0.15 area 23
R2: R2(config)#int f0/0
R2(config-if)#ip add 23.23.23 .2 255.255.255.240
R2(config-if)#no shut
R2(config)#router ospf 2006
R2(config-router)#router-id 2.2.2 .2
R2(config-router)#network 23.23.23 .0 0.0.0.15 Area 23
*******
现在我们看看R2的路由表,O(∩_∩)O~
R2# 2.0.0 .0/24 is subnetted, 1 subnets
C 2.2.2 .0 is directly connected, Loopback0
23.0.0 .0/28 is subnetted, 1 subnets
C 23.23.23 .0 is directly connected, FastEthernet0/0
路由表里面只有直连没有外面来的路由,这是因为这个区域没有和area 0 相连,
解决方案是虚链路。
O(
∩_∩)O~O(∩_∩)O~************
R6
:R6(config-router)#area 36 virtual-link 3.3.3 .3
R3: R3(config-router)#area 36 virtual-link 6.6.6 .6
****
这条命令 区域是穿越的区域,后面是对方的router-id
*****
*********
我们再看看
R2
的路由
表,O(∩_∩)O~O(∩_∩)O~******
R2# 2.0.0 .0/24 is subnetted, 1 subnets
C 2.2.2 .0 is directly connected, Loopback0
99.0.0.0/28 is subnetted, 1 subnets
O IA 99.99.99.0 [110/129] vi a 23.23.23 .3, 00:03:46, FastEthernet0/0
36.0.0.0/28 is subnetted, 1 subnets
O IA 36.36.36.0 [110/65] vi a 23.23.23 .3, 00:04:18, FastEthernet0/0
23.0.0 .0/28 is subnetted, 1 subnets
C 23.23.23 .0 is directly connected, FastEthernet0/0
145.145.0.0/28 is subnetted, 1 subnets
O IA 145.145.145.0 [110/130] vi a 23.23.23 .3, 00:03:46, FastEthernet0/0
*******R2
已经收到了路由,表明我们的
虚链路成功了
!!O(∩_∩)O~*****
六、 让内网的用户访问外网都通过R6,通过R6注入一条默认路由。
R6(config)#int f0/0
R6(config-if)#ip add 67.67.67.6 255.255.255.0
R6(config-if)#no shut
R6(config)#ip route 0.0.0 .0 0.0. 0.0 f 0/0
R6(config)#router ospf 2006
R6(config-router)#default-information originate
R7(config)#int f0/0
R7(config-if)#ip add 67.67.67.7 255.255.255.0
R7(config)#ip route 0.0.0 .0 0.0. 0.0 f 0/0
********
内网的
路由器路由表中
都会形成这样一条路由O(∩_∩)O~
O*E2 0.0.0 .0/0
[110/1] via 36.36.36.6, 00:09:05, Serial1/0
R3#ping 67.67.67.7
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 67.67.67.7, timeout is 2 secon
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/81/156
内网任意一台路由器都可以
ping
通外网
R7.
不再演示其余那几台了路由器了。O(∩_∩)O~要求5完成o(�Rv�Q)o~~好棒******
七、 实现area 0 的md5认证,密码是cisco
R6(config)#router ospf 2006
R6(config-router)#area 0 authentication message-digest
R6(config)#int s1/0.1
R6(config-subif)#ip ospf message-digest-key 1 md5 cisco
R4(config)#router ospf 2006
R4(config-router)#area 0 authentication message-digest
R4(config)#int s1/0
R4(config-if)#ip ospf message-digest-key 1 md5 cisco
R5(config)#router ospf 2006
R5(config-router)#area 0 authentication message-digest
R5(config)#int s1/0
R5(config-if)#ip ospf message-digest-key 1 md5 cisco
八、 把七八两个要求合起来做,R1作为DR,R1访问外网优先通过r4.
且R4与R5之间保持tow-way状态。O(∩_∩)O~
R1(config)#int f0/0
R1(config-if)#ip ospf priority 2
R4(config)#int f0/0
R4(config-if)#ip ospf priority 0
R5(config)#int f0/0
R5(config-if)#ip ospf priority 0
R5#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
6.6.6
.6 2 FULL/DR 00:00:29 99.99.99.6 Serial1/0
1.1.1
.1 2 FULL/DR 00:00:33 145.145.145.1 FastEthernet0/0
4.4.4
.4
0
2WAY
/DROTHER 00:00:37 145.145.145.4 FastEthernet0/0
******R5
和R4
已经保持tow-way
了。*******
******
我们先看一下R1的路由表,O(∩_∩)O~
1.0.0 .0/24 is subnetted, 1 subnets
C 1.1.1 .0 is directly connected, Loopback0
145.145.0.0/28 is subnetted, 1 subnets
C 145.145.145.0 is directly connected, FastEthernet0/0
O*I A 0.0.0 .0/0 [110/
2
] via 145.145.145.5, 00:00:04, FastEthernet0/0
[110/
2
] via 145.145.145.4, 00:00:04, FastEthernet0/0
R1
这条三类的默认路由是通过
负载均衡
的路径出去的*************
R4(config)#router ospf 2006
R4(config-router)#area 145 default-cost 5
R5(config)#router ospf 2006
R5(config-router)#area 145 default-cost 10
/////
这条命令是修改向stub区域下方默认路由时的度量值
/////
R1# 1.0.0 .0/24 is subnetted, 1 subnets
C 1.1.1 .0 is directly connected, Loopback0
145.145.0.0/28 is subnetted, 1 subnets
C 145.145.145.0 is directly connected, FastEthernet0/0
O*I A 0.0.0 .0/0
[110/
6
] via 1
45.145.145.4
, 00:00:10, FastEthernet0/0
****R1
的路由表只有R4一条路径了,
且度量值变为6
O(
∩_∩)O~ 完成*****
九、 所有区域中明文认证,密码是cisco
R2(config)#router ospf 2006
R2(config-router)#area 23 authentication
R2(config)#int f0/0
R2(config-if)#ip ospf authentication-key cisco
**********************
不再一一列举了,参照R2**********************