要求如图所示,接下来划分ip
首先配置各路由器IP,保证内网连通性
R1:
[r1]int lo0
[r1-LoopBack0]ip add 192.168.1.1 28
[r1-LoopBack0]int lo1
[r1-LoopBack1]ip add 192.168.1.17 28
[r1-LoopBack1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.129 30
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 192.168.1.137 30
R2:
[r2]int lo0
[r2-LoopBack0]ip add 192.168.1.33 28
[r2-LoopBack0]q
[r2]int lo1
[r2-LoopBack1]ip add 192.168.1.49 28
[r2-LoopBack1]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.130 30
[r2-GigabitEthernet0/0/0]int g 0/0/1
[r2-GigabitEthernet0/0/1]ip add 192.168.1.133 30
R3:
[r3]int lo0
[r3-LoopBack0]ip add 192.168.1.65 28
[r3-LoopBack0]q
[r3]int lo1
[r3-LoopBack1]ip add 192.168.1.81 28
[r3-LoopBack1]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.1.138 30
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.1.141 30
R4:
[r4]int lo0
[r4-LoopBack0]ip add 192.168.1.97 28
[r4-LoopBack0]q
[r4]int lo1
[r4-LoopBack1]ip add 192.168.1.113 28
[r4-LoopBack1]q
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.134 30
[r4-GigabitEthernet0/0/0]int g 0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.1.142 30
[r4-GigabitEthernet0/0/1]int g 4/0/0
[r4-GigabitEthernet4/0/0]ip add 192.168.1.145 30
[r4-GigabitEthernet4/0/0]int g0/0/2
[r4-GigabitEthernet0/0/2]ip add 192.168.1.149 30
R5:
[r5]int lo0
[r5-LoopBack0]ip add 5.5.5.5 24
[r5-GigabitEthernet0/0/1]ip add 192.168.1.146 30
[r5-GigabitEthernet0/0/0]ip add 192.168.1.150 30
配置内网静态路由:
R1:
[r1]ip route-s
[r1]ip route-static 192.168.1.32 27 192.168.1.130
[r1]ip route-static 192.168.1.132 30 192.168.1.130
[r1]ip route-static 192.168.1.96 27 192.168.1.130
[r1]ip route-static 192.168.1.96 27 192.168.1.138
[r1]ip route-static 192.168.1.140 30 192.168.1.138
[r1]ip route-static 192.168.1.64 27 192.168.1.138
[r1]ip route-static 192.168.1.144 30 192.168.1.138
[r1]ip route-static 192.168.1.144 30 192.168.1.130
R2:
[r2]ip route-static 192.168.1.96 27 192.168.1.134
[r2]ip route-static 192.168.1.140 30 192.168.1.134
[r2]ip route-static 192.168.1.64 27 192.168.1.134
[r2]ip route-static 192.168.1.64 27 192.168.1.129
[r2]ip route-static 192.168.1.136 30 192.168.1.129
[r2]ip route-static 192.168.1.0 27 192.168.1.129
[r2]ip route-static 192.168.1.144 30 192.168.1.134
[r2]ip route-static 192.168.1.148 30 192.168.1.134
R3:
[r3]ip route-static 192.168.1.96 27 192.168.1.142
[r3]ip route-static 192.168.1.132 30 192.168.1.14
[r3]ip route-static 192.168.1.32 27 192.168.1.142
[r3]ip route-static 192.168.1.32 27 192.168.1.137
[r3]ip route-static 192.168.1.128 30 192.168.1.137
[r3]ip route-static 192.168.1.0 27 192.168.1.137
[r3]ip route-static 192.168.1.144 30 192.168.1.142
[r3]ip route-static 192.168.1.148 30 192.168.1.142
R4:
[r4]ip route-static 192.168.1.64 27 192.168.1.141
[r4]ip route-static 192.168.1.136 30 192.168.1.141
[r4]ip route-static 192.168.1.0 27 192.168.1.141
[r4]ip route-static 192.168.1.0 27 192.168.1.133
[r4]ip route-static 192.168.1.128 30 192.168.1.133
[r4]ip route-static 192.168.1.32 27 192.168.1.133
测试内网连通性:
无误
配置缺省路由,连接公网:
[r1]ip route-static 0.0.0.0 0.0.0.0 192.168.1.130
[r1]ip route-static 0.0.0.0 0.0.0.0 192.168.1.138
[r2]ip route-static 0.0.0.0 0.0.0.0 192.168.1.134
[r3]ip route-static 0.0.0.0 0.0.0.0 192.168.1.142
[r4]ip route-static 0.0.0.0 0.0.0.0 192.168.1.146
[r4]ip route-static 0.0.0.0 0.0.0.0 192.168.1.150 preference 61
配置公网与内网间的静态路由:
[r5]ip route-static 192.168.1.96 27 192.168.1.145
[r5]ip route-static 192.168.1.140 30 192.168.1.145
[r5]ip route-static 192.168.1.64 27 192.168.1.145
[r5]ip route-static 192.168.1.136 30 192.168.1.145
[r5]ip route-static 192.168.1.0 27 192.168.1.145
[r5]ip route-static 192.168.1.128 30 192.168.1.145
[r5]ip route-static 192.168.1.32 27 192.168.1.145
[r5]ip route-static 192.168.1.132 30 192.168.1.145
[r5]ip route-static 192.168.1.96 27 192.168.1.149 p61
[r5]ip route-static 192.168.1.140 30 192.168.1.149 p61
[r5]ip route-static 192.168.1.64 27 192.168.1.149 p61
[r5]ip route-static 192.168.1.136 30 192.168.1.149 p61
[r5]ip route-static 192.168.1.0 27 192.168.1.149 p61
[r5]ip route-static 192.168.1.128 30 192.168.1.149p61
[r5]ip route-static 192.168.1.32 27 192.168.1.149 p61
[r5]ip route-static 192.168.1.132 30 192.168.1.149 p61
为防止路由黑洞的出现,在各路由器上配置空接口:
[r1]ip route-static 192.168.1.0 27 NULL 0
[r2]ip route-static 192.168.1.32 27 NULL 0
[r3]ip route-static 192.168.1.64 27 NULL 0
[r4]ip route-static 192.168.1.96 27 NULL 0
测试是否全网可达:
完成小实验