一、首先实现第三个要求
1、配置r4环回
[r4]interface LoopBack 0
[r4-LoopBack0]ip address 4.4.4.4 24
2、基于192.168.1. 0 24进行子网划分
2个网段+三个环回
192.168.1.0 24用于骨干 192.168.1.0 29 192.168.1.8 29
R1环回:192.168.1.64 26---192.168.1.64 27 192.168.1.80 27
R2环回:92.168.1.128 26---192.168.1.128 27 192.168.1.144 27
R3环回:192.168.1.192 26---192.168.1.192 27 192.168.1.208 27
3、具体配置ip和环回
R1:
[r1]interface gi 0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 29
[r1-GigabitEthernet0/0/0]q
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.1.65 26
R2:
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.1.2 29
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 192.168.1.129 26
R3:
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.1.3 29
[r3-GigabitEthernet0/0/1]q
[r3]interface LoopBack 0
[r3-LoopBack0]ip address 192.168.1.193 26
R4:
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.1.9 29
1、启动ospf协议并且将各接口划分到对应区域
R1:接口与环回均在区域0
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.65 0.0.0.0
R2:接口与环回均在区域0
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.1.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 192.168.1.129 0.0.0.0
R3:左边接口与环回均在区域0 右边接口·在区域1
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.1.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 192.168.1.193 0.0.0.0
[r3-ospf-1-area-0.0.0.0]q
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]ne
[r3-ospf-1-area-0.0.0.1]network 192.168.1.13 0.0.0.0
R4:接口与环回均在区域1并且r4环回不能宣告
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 1
[r4-ospf-1-area-0.0.0.1]network 192.168.1.9 0.0.0.0
三、实现第三个要求
R1:
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ospf dr-priority 0
R2:
[r2]interface gi 0/0/0
[r2-GigabitEthernet0/0/0]ospf dr-priority 0
四、实现第四个要求
1、r4不能直接宣告(缺省路由)
[r4]ospf
[r4-ospf-1]default-route-advertise always
2、测试(ping)
ping 4.4.4.4
PING 4.4.4.4: 56 data bytes, press CTRL_C to break
Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=254 time=50 ms
Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=254 time=60 ms
Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=254 time=50 ms
Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=254 time=70 ms
Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=254 time=50 ms
--- 4.4.4.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 50/56/70 ms
3、保证更新安全(手工认证)
r1~r2~r3
[r1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123
[r2-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123
[r3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 12
r3~r4
[r3-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 456
[r4-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 456
4、避免环路(空接口路由)
r1:[r1]ip route-static 192.168.1.64 26 NULL 0
r2:[r1]ip route-static 192.168.1.128 26 NULL 0
r3:[r1]ip route-static 192.168.1.192 26 NULL 0
r4:[r1]ip route-static 4.4.4.0 NULL 0
5、减少路由条目数量(手工汇总)
[r3]ospf
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]abr-summary 192.168.1.0 255.255.255.0