路由如下:
要求:
1.全网可达
2.拓扑中所需地址全部基于192.168.0.0/24划分所得
3.静态路由(不许使用其他路由)
4.R2环回需要汇总
首先,对192.168.0.0/24进行子网划分
r2环回:192.168.0.64 26
192.168.0.64 28 192.168.0.80 28 192.168.0.96 28
vlan 2:192.168.0.128 26
vlan 3:192.168.0.192 26
r1-r2:192.168.0.0 30
r2-r4:192.168.0.4 30
r1-r3:192.168.0.8 30
r3-r4:192.168.0.12 30
r3-r5:上面:192.168.0.16 30 下面:192.168.0.20 30
r5-ISP:100.1.1.0 24
配置命令:
vlan+dhcp配置:
lw1:
[lw1]vlan batch 2 to 3
[lw1-Ethernet0/0/2]port link-type access
[lw1-Ethernet0/0/2]port default vlan 2
[lw1-Ethernet0/0/3]port link-type access
[lw1-Ethernet0/0/3]port default vlan 3
[lw1-Ethernet0/0/1]port link-type trunk
[lw1-Ethernet0/0/1]port trunk allow-pass vlan 2 to 3
[lw1-Ethernet0/0/4]port link-type trunk
[lw1-Ethernet0/0/4]port trunk allow-pass vlan 2 to 3
lw2:
[lw2]vlan batch 2 to 3
[lw2-Ethernet0/0/2]port link-type access
[lw2-Ethernet0/0/2]port default vlan 2
[lw2-Ethernet0/0/3]port link-type access
[lw2-Ethernet0/0/3]port default vlan 3
[lw2-Ethernet0/0/1]port link-type trunk
[lw2-Ethernet0/0/1]port trunk allow-pass vlan 2 to 3
r4:
[r4]dhcp enable
[r4]ip pool a
[r4-ip-pool-a]network 192.168.0.128 mask 26
[r4-ip-pool-a]gateway-list 192.168.0.129
[r4-ip-pool-a]dns-list 8.8.8.8
[r4]ip pool b
[r4-ip-pool-b]network 192.168.0.192 mask 26
[r4-ip-pool-b]gateway-list 192.168.0.193
[r4-ip-pool-b]dns-list 8.8.8.8
[r4]int g0/0/2.1
[r4-GigabitEthernet0/0/2.1]ip add 192.168.0.129 26
[r4-GigabitEthernet0/0/2.1]dot1q termination vid 2
[r4-GigabitEthernet0/0/2.1]arp broadcast enable
[r4-GigabitEthernet0/0/2.1]dhcp select global
[r4-GigabitEthernet0/0/2.1]int g0/0/2.2
[r4-GigabitEthernet0/0/2.2]ip add 192.168.0.193 26
[r4-GigabitEthernet0/0/2.2]dot1q termination vid 3
[r4-GigabitEthernet0/0/2.2]arp broadcast enable
[r4-GigabitEthernet0/0/2.2]dhcp select global
静态路由:
r1:
[r1]ip route-static 192.168.0.128 26 192.168.0.1
[r1]ip route-static 192.168.0.128 26 192.168.0.10
[r1]ip route-static 192.168.0.192 26 192.168.0.10
[r1]ip route-static 192.168.0.192 26 192.168.0.1
[r1]ip route-static 192.168.0.12 30 192.168.0.10
[r1]ip route-static 192.168.0.64 26 192.168.0.1
[r1]ip route-static 192.168.0.4 30 192.168.0.1
[r1]ip route-static 192.168.0.16 30 192.168.0.10
[r1]ip route-static 192.168.0.20 30 192.168.0.10
r2:
[r2]ip route-static 192.168.0.8 30 192.168.0.2
[r2]ip route-static 192.168.0.16 30 192.168.0.2
[r2]ip route-static 192.168.0.20 30 192.168.0.2
[r2]ip route-static 192.168.0.12 30 192.168.0.6
[r2]ip route-static 192.168.0.16 30 192.168.0.6
[r2]ip route-static 192.168.0.20 30 192.168.0.6
[r2]ip route-static 192.168.0.128 26 192.168.0.6
[r2]ip route-static 192.168.0.192 26 192.168.0.6
r3:
[r3]ip route-static 192.168.0.0 30 192.168.0.9
[r3]ip route-static 192.168.0.4 30 192.168.0.13
[r3]ip route-static 192.168.0.128 26 192.168.0.13
[r3]ip route-static 192.168.0.192 26 192.168.0.13
[r3]ip route-static 192.168.0.64 26 192.168.0.9
[r3]ip route-static 192.168.0.64 26 192.168.0.13
r4:
[r4]ip route-static 192.168.0.0 30 192.168.0.5
[r4]ip route-static 192.168.0.8 30 192.168.0.14
[r4]ip route-static 192.168.0.16 30 192.168.0.14
[r4]ip route-static 192.168.0.20 30 192.168.0.14
[r4]ip route-static 192.168.0.64 26 192.168.0.5
r5:
[r5]ip route-static 192.168.0.8 30 192.168.0.21
[r5]ip route-static 192.168.0.12 30 192.168.0.21
[r5]ip route-static 192.168.0.0 30 192.168.0.21
[r5]ip route-static 192.168.0.4 30 192.168.0.21
[r5]ip route-static 192.168.0.128 26 192.168.0.21
[r5]ip route-static 192.168.0.196 26 192.168.0.21
[r5]ip route-static 192.168.0.64 26 192.168.0.21
ISP:
路由器想要访问运行商,需要配置一条缺省
r1:
[r1]ip route-static 0.0.0.0 0 192.168.0.10
r2:
[r2]ip route-static 0.0.0.0 0 192.168.0.2
[r2]ip route-static 0.0.0.0 0 192.168.0.6
因为黑洞路由和缺省路由相遇肯定会回环,所以需要配置一条汇总指向空接口
[r2]ip route-static 192.168.0.64 26 NULL 0
r3:
[r3]ip route-static 0.0.0.0 0 192.168.0.22
r4:
[r4]ip route-static 0.0.0.0 0 192.168.0.14
r5:
[r5]ip route-static 0.0.0.0 0 192.168.0.26
最后配置浮动路由:
r3:
[r3]ip route-static 0.0.0.0 0 192.168.0.18 preference 70
r5:
[r5]ip route-static 192.168.0.8 30 192.168.0.17 preference 70
[r5]ip route-static 192.168.0.12 30 192.168.0.17 preference 70
[r5]ip route-static 192.168.0.0 30 192.168.0.17 preference 70
[r5]ip route-static 192.168.0.4 30 192.168.0.17 preference 70
[r5]ip route-static 192.168.0.128 26 192.168.0.17 preference 70
[r5]ip route-static 192.168.0.192 26 192.168.0.17 preference 70
对r5进行配置nat
[r5]acl 2000
[r5-acl-basic-2000]rule permit source 192.168.0.0 0.0.0.255
[r5]int g 0/0/1
[r5-GigabitEthernet0/0/1]nat outbound 2000
ping一下: