一、进行子网划分
二、配置交换机
分析要求,要vlan2和vlan3互通,则要配置单臂路由
1、创建VLAN
SW1*************
[sw1]vlan batch 2 to 3 创建vlan2 vlan3
[sw1]interface Ethernet0/0/1 单独将某个接口划分到对应的vlan
[sw1-Ethernet0/0/1]port link-type access 先将该接口修改为接入模式
[sw1-Ethernet0/0/1]port default vlan 2 再将该接口划分到对应的vlan中
[sw1]interface Ethernet0/0/2
[sw1-Ethernet0/0/2]port link-type access
[sw1-Ethernet0/0/2]port default vlan 3
[sw1]interface e0/0/3
[sw1-Ethernet0/0/3]port link-type trunk 将接口修改trunk模式
[sw1-Ethernet0/0/3]port trunk allow-pass vlan 2 to 3
[sw1]interface e0/0/4
[sw1-Ethernet0/0/5]port link-type trunk
[sw1-Ethernet0/0/5]port trunk allow-pass vlan 2 to 3
SW2***********
[sw2]vlan batch 2 to 3 创建vlan2 vlan3
[sw2]interface Ethernet0/0/1 单独将某个接口划分到对应的vlan
[sw2-Ethernet0/0/1]port link-type access 先将该接口修改为接入模式
[sw2-Ethernet0/0/1]port default vlan 2 再将该接口划分到对应的vlan中
[sw2]interface Ethernet0/0/2
[sw2-Ethernet0/0/2]port link-type access
[sw2-Ethernet0/0/2]port default vlan 3
[sw1]interface e0/0/3
[sw1-Ethernet0/0/3]port link-type trunk 将接口修改trunk模式
[sw1-Ethernet0/0/3]port trunk allow-pass vlan 2 to 3
2、配置路由器子接口并开启dhcp
[r2]int g0/0/2.1
****创建子接口
[r2-GigabitEthernet0/0/2.1]ip ad 192.168.1.1 29
[r2-GigabitEthernet0/0/2.1]dot1q termination vid 2
****该接口用于通过vlan2
Jul 16 2022 15:32:27-08:00 r2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP on the interface GigabitEthernet0/0/2.1 has entered the UP state.
[r2-GigabitEthernet0/0/2.1]arp broadcast enable
****开启arp
[r2-GigabitEthernet0/0/2.1]int g0/0/2.2
[r2-GigabitEthernet0/0/2.2]ip ad 192.168.1.9 29
[r2-GigabitEthernet0/0/2.2]dot1q termination vid 3
Jul 16 2022 15:33:17-08:00 r2 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP on the interface GigabitEthernet0/0/2.2 has entered the UP state.
[r2-GigabitEthernet0/0/2.2]arp broadcast enable
[r2-GigabitEthernet0/0/2.2]q
[r2]dhcp enable
****开启路由器DHCP
Info: The operation may take a few seconds. Please wait for a moment.done.
[r2]ip pool v2
****创建地址池
Info: It's successful to create an IP address pool.
[r2-ip-pool-v2]network 192.168.1.0 mask 29
****设定该地址池范围
[r2-ip-pool-v2]gateway-list 192.168.1.1
****设置网关
[r2-ip-pool-v2]dns-list 8.8.8.8
****设置dns
[r2-ip-pool-v2]ip pool v3
Info: It's successful to create an IP address pool.
[r2-ip-pool-v3]network 192.168.1.8 mask 29
[r2-ip-pool-v3]gateway-list 192.168.1.9
[r2-ip-pool-v3]dns-list 8.8.8.8
[r2-ip-pool-v3]int g0/0/2.1
[r2-GigabitEthernet0/0/2.1]dhcp select global
[r2-GigabitEthernet0/0/2.1]int g0/0/2.2
[r2-GigabitEthernet0/0/2.2]dhcp select global
****在对应的接口开启DHCP
三、配置路由器
分析要求,要全网互通且汇总R1的环回,访问ISP外的网络,1000M通路在故障时启用100M通道
则路由表中要有缺省路由,配置路由表的浮动静态也就是给100M路由设置优先值
R1
[r1]ip route-static 0.0.0.0 0 192.168.1.37
[r1]ip route-static 0.0.0.0 0 192.168.1.26
****缺省路由
[r1]ip route-static 192.168.1.0 28 192.168.1.26
****vlan2 vlan3
[r1]ip route-static 192.168.1.28 30 192.168.1.26
[r1]ip route-static 192.168.1.32 30 192.168.1.37
[r1]ip route-static 192.168.1.40 30 192.168.1.37
[r1]ip route-static 192.168.1.40 30 192.168.1.26
[r1]ip route-static 192.168.1.44 30 192.168.1.26 pre 61
[r1]ip route-static 192.168.1.44 30 192.168.1.37 pre 61
****1000M 100M
[r1]ip route-static 100.1.1.0 24 192.168.1.37
[r1]ip route-static 100.1.1.0 24 192.168.1.26
[r1]ip route-static 192.168.1.0 25 NULL 0
****设置通向192.168.1.0/25 的空接口
R2
[r2]ip route-static 0.0.0.0 0 192.168.1.30
[r2]ip route-static 192.168.1.0 28 NULL 0
[r2]ip route-static 192.168.1.32 30 192.168.1.30
[r2]ip route-static 192.168.1.36 30 192.168.1.25
[r2]ip route-static 192.168.1.0 25 192.168.1.25
****R1环回
[r2]ip route-static 192.168.1.40 30 192.168.1.30
[r2]ip route-static 192.168.1.44 30 192.168.1.30 pre 61
[r2]ip route-static 100.1.1.0 24 192.168.1.30
R3
[r3]ip route-static 0.0.0.0 0 192.168.1.42
[r3]ip route-static 0.0.0.0 0 192.168.1.46 pre 61
[r3]ip route-static 100.1.1.0 24 192.168.1.42
[r3]ip route-static 100.1.1.0 24 192.168.1.46 pre 61
[r3]ip route-static 192.168.1.36 30 192.168.1.34
[r3]ip route-static 192.168.1.24 30 192.168.1.29
[r3]ip route-static 192.168.1.0 28 192.168.1.29
[r3]ip route-static 192.168.1.0 25 192.168.1.29
[r3]ip route-static 192.168.1.0 25 192.168.1.34
[r3]ip route-static 192.168.1.0 26 NULL 0
R4
[r4]ip route-static 0.0.0.0 0 192.168.1.33
[r4]ip route-static 192.168.1.40 30 192.168.1.33
[r4]ip route-static 192.168.1.44 30 192.168.1.33 pre 61
[r4]ip route-static 100.1.1.0 24 192.168.1.33
[r4]ip route-static 192.168.1.0 25 192.168.1.38
[r4]ip route-static 192.168.1.0 28 192.168.1.38
[r4]ip route-static 192.168.1.0 28 192.168.1.33
[r4]ip route-static 192.168.1.24 30 192.168.1.38
[r4]ip route-static 192.168.1.28 30 192.168.1.33
R5
[r5]ip route-static 0.0.0.0 0 100.1.1.2
[r5]ip route-static 192.168.1.0 26 192.168.1.41
[r5]ip route-static 192.168.1.0 26 192.168.1.45 pre 61
****R1-R4之间干路汇总
[r5]ip route-static 192.168.1.0 25 192.168.1.41
[r5]ip route-static 192.168.1.0 25 192.168.1.45 pre 61
****R1环回
[r5]ip route-static 192.168.1.0 28 192.168.1.41
[r5]ip route-static 192.168.1.0 28 192.168.1.45 pre 61
****vlan
ISP
ip route-static 192.168.1.0 24 100.1.1.1
四、测试
vlan2 ping vlan3
pc1 ping 1.1.1.0/24
pc1 ping R1环回