一、基于192.168.0.0/24划分IP地址
192.168.0.0/27
192.168.0.0/30
192.168.0.4/30
192.168.0.8/30
192.168.0.12/30
192.168.0.16/30
192.168.0.20/30
192.168.0.24/30
192.168.0.28/30
192.168.0.32/27
192.168.0.64/27
192.168.0.96/27
192.168.0.128/27
192.168.0.160/27
192.168.0.192/27
192.168.0.224/27
对R2三个环回网段进行汇总
0000 0000
0010 0000
0100 0000
0110 0000
192.168.0.0/25
二、配置IP地址
R1
R2
R3
R4
R5
ISP
三、静态路由
R1
[R1]ip route-static 192.168.0.0 25 192.168.0.1
[R1]ip route-static 192.168.0.20 30 192.168.0.1
[R1]ip route-static 192.168.0.128 27 192.168.0.1
[R1]ip route-static 192.168.0.160 27 192.168.0.1
[R1]ip route-static 192.168.0.8 30 192.168.0.6
[R1]ip route-static 192.168.0.12 30 192.168.0.6
[R1]ip route-static 192.168.0.16 30 192.168.0.6
R2
[R2]ip route-static 192.168.0.4 30 192.168.0.2
[R2]ip route-static 192.168.0.8 30 192.168.0.2
[R2]ip route-static 192.168.0.12 30 192.168.0.2
[R2]ip route-static 192.168.0.16 30 192.168.0.22
[R2]ip route-static 192.168.0.128 27 192.168.0.22
[R2]ip route-static 192.168.0.160 27 192.168.0.22
R3
[R3]ip route-static 192.168.0.0 30 192.168.0.5
[R3]ip route-static 192.168.0.0 25 192.168.0.5
[R3]ip route-static 192.168.0.20 30 192.168.0.18
[R3]ip route-static 192.168.0.128 27 192.168.0.18
[R3]ip route-static 192.168.0.160 27 192.168.0.18
R4
[R4]ip route-static 192.168.0.0 25 192.168.0.21
[R4]ip route-static 192.168.0.0 30 192.168.0.21
[R4]ip route-static 192.168.0.4 30 192.168.0.17
[R4]ip route-static 192.168.0.8 30 192.168.0.17
[R4]ip route-static 192.168.0.12 30 192.168.0.17
R5(有浮动静态路由)
[R5]ip route-static 192.168.0.0 25 192.168.0.13
[R5]ip route-static 192.168.0.0 25 192.168.0.9 preference 80
[R5]
[R5]ip route-static 192.168.0.0 30 192.168.0.13
[R5]ip route-static 192.168.0.0 30 192.168.0.9 preference 80
[R5]
[R5]ip route-static 192.168.0.4 30 192.168.0.13
[R5]ip route-static 192.168.0.4 30 192.168.0.9 preference 80
[R5]
[R5]ip route-static 192.168.0.20 30 192.168.0.13
[R5]ip route-static 192.168.0.20 30 192.168.0.9 preference 80
[R5]
[R5]ip route-static 192.168.0.16 30 192.168.0.13
[R5]ip route-static 192.168.0.16 30 192.168.0.9 preference 80
[R5]
[R5]ip route-static 192.168.0.128 27 192.168.0.13
[R5]ip route-static 192.168.0.128 27 192.168.0.9 preference 80
[R5]
[R5]ip route-static 192.168.0.160 27 192.168.0.13
[R5]ip route-static 192.168.0.160 27 192.168.0.9 preference 80
四、缺省路由
[R1]ip route-static 0.0.0.0 0 192.168.0.6
[R2]ip route-static 0.0.0.0 0 192.168.0.2
为防止出现环路
[R2]ip route-static 192.168.0.0 25 NULL 0
[R3]ip route-static 0.0.0.0 0 192.168.0.14
[R3]ip route-static 0.0.0.0 0 192.168.0.10 preference 80
[R4]ip route-static 0.0.0.0 0 192.168.0.17
[R5]ip route-static 0.0.0.0 0 100.1.1.2
五、划分VLAN
SW1
[SW1]vlan batch 2 to 3
[SW1-GigabitEthernet0/0/1]port link-type trunk
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW1]in g0/0/2
[SW1-GigabitEthernet0/0/2]port link-type trunk
[SW1-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[SW1]in e0/0/1
[SW1-Ethernet0/0/1]port link-type access
[SW1-Ethernet0/0/1]port default vlan 2
[SW1]in e0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]port default vlan 3
SW2
[SW2]vlan batch 2 to 3
[SW2]in g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type trunk
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW2]in e0/0/1
[SW2-Ethernet0/0/1]port link-type access
[SW2-Ethernet0/0/1]port default vlan 2
[SW2]in e0/0/2
[SW2-Ethernet0/0/2]port link-type access
[SW2-Ethernet0/0/2]port default vlan 3
[R4]in g0/0/2.1
[R4-GigabitEthernet0/0/2.1]dot1q termination vid 2
[R4-GigabitEthernet0/0/2.1]arp broadcast enable
[R4]in g0/0/2.2
[R4-GigabitEthernet0/0/2.2]dot1q termination vid 3
[R4-GigabitEthernet0/0/2.2]arp broadcast enable
为了访问ISP需要在R5上配置NAT
[R5]acl 2000
[R5-acl-basic-2000]rule 1 permit source any
[R5]in g0/0/2
[R5-GigabitEthernet0/0/2]nat outbound 2000