一、各交换机上配置:
1、各交换机上创建VLAN
2、交换机上的各个接口划分到对应的VLAN中
3、将与交换机、路由器相连的接口创建trunk干道
SW1:
[sw1]vlan batch 2 to 3 批量创建VLAN2-3
[sw1]interface Ethernet0/0/1 单独将某个接口划分到对应的vlan
[sw1-Ethernet0/0/1]port link-type access 先将该接口修改为接入模式
[sw1-Ethernet0/0/1]port default vlan 2 再将该接口划分到对应的vlan中
[sw1-Ethernet0/0/1]interface Ethernet0/0/2
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default vlan 3
[sw1]interface e0/0/5
[sw1-Ethernet0/0/5]port link-type trunk 将接口修改trunk模式
[sw1-Ethernet0/0/5]port trunk allow-pass vlan 2 to 3 创建允许通过的列表
SW2:
[sw2]vlan batch 2 to 3 批量创建VLAN2-3
[sw2]interface Ethernet0/0/2 单独将某个接口划分到对应的vlan
[sw2-Ethernet0/0/2]port link-type access 先将该接口修改为接入模式
[sw2-Ethernet0/0/2]port default vlan 2 再将该接口划分到对应的vlan中
[sw2]interface Ethernet0/0/3
[sw2-Ethernet0/0/3]port link-type access
[sw2-Ethernet0/0/3]port default vlan 3
[sw2]interface e0/0/1
[sw2-Ethernet0/0/1]port link-type trunk 将接口修改trunk模式
[sw2-Ethernet0/0/1]port trunk allow-pass vlan 2 to 3 创建允许通过的列表
[sw2]interface e0/0/4
[sw2-Ethernet0/0/4]port link-type trunk
[sw2-Ethernet0/0/4]port trunk allow-pass vlan 2 to 3
SW3:
[sw3]vlan batch 2 to 3 批量创建VLAN2-3
[sw3]interface Ethernet0/0/2 单独将某个接口划分到对应的vlan
[sw3-Ethernet0/0/2]port link-type access 先将该接口修改为接入模式
[sw3-Ethernet0/0/2]port default vlan 2 再将该接口划分到对应的vlan中
[sw3]interface Ethernet0/0/3
[sw3-Ethernet0/0/3]port link-type access
[sw3-Ethernet0/0/3]port default vlan 3
[sw3]interface e0/0/1
[sw3-Ethernet0/0/1]port link-type trunk 将接口修改trunk模式
[sw3-Ethernet0/0/1]port trunk allow-pass vlan 2 to 3 创建允许通过的列表
二、各交换机上的配置:
1、配置路由器子接口
2、定义其管理的VLAN
3、配置子接口的IP地址
4、开启子接口的ARP功能
5、开启DHCP服务
6、创建对应广播域数量的池塘
7、关联接口,定义池塘可分配的IP地址范围
8、输入该网段的网关
9、填写DNS服务器地址
10、回到分配IP地址的接口,启动DHCP服务
11、配置静态路由,确保全网可达
R1:
[r1]interface g0/0/0.1 创建子接口
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2 定义其管理的vlan
[r1-GigabitEthernet0/0/0.1]ip address 192.168.1.1 25 子接口的IP地址
[r1-GigabitEthernet0/0/0.1]arp broadcast enable 开启子接口ARP功能
[r1-GigabitEthernet0/0/0.1]q
[r1]interface g0/0/0.2
[r1-GigabitEthernet0/0/0.2]dot1q termination vid 3
[r1-GigabitEthernet0/0/0.2]ip address 192.168.1.128 25
[r1-GigabitEthernet0/0/0.2]arp broadcast enable
[r1]dhcp enable 先开启DHCP服务
[r1]ip pool a 创建名为a的DHCP池塘
[r1-ip-pool-a]network 192.168.1.0 mask 25 关联接口,定义该池塘可分配ip地址的范围
[r1-ip-pool-a]gateway-list 192.168.1.1 该网段网关
[r1-ip-pool-a]dns-list 192.168.1.20 114.114.114.114 DNS服务器地址
[r1]interface g0/0/0.1 转到分配ip地址的接口
[r1-GigabitEthernet0/0/0.1]dhcp select global 启动DHCP服务
[r1]ip pool b
[r1-ip-pool-b]network 192.168.1.128 mask 25
[r1-ip-pool-b]gateway-list 192.168.1.129
[r1-ip-pool-b]dns-list 192.168.1.20 114.114.114.114
[r1]interface g0/0/0.2
[r1-GigabitEthernet0/0/0.2]dhcp select global
[r1-GigabitEthernet0/0/1]ip address 192.168.3.1 24 路由器IP另一地址
[r1]ip route-static 192.168.2.0 255.255.255.0 192.168.3.2 配置静态路由
R2:
[r2]interface g0/0/1.1 创建子接口
[r2-GigabitEthernet0/0/1.1]dot1q termination vid 2 定义其管理的vlan
[r2-GigabitEthernet0/0/1.1]ip address 192.168.2.1 25 子接口的IP地址
[r2-GigabitEthernet0/0/1.1]arp broadcast enable 开启子接口ARP功能
[r2-GigabitEthernet0/0/1.1]q
[r2]interface g0/0/1.2
[r2-GigabitEthernet0/0/1.2]dot1q termination vid 3
[r2-GigabitEthernet0/0/1.2]ip address 192.168.2.128 25
[r2-GigabitEthernet0/0/1.2]arp broadcast enable
[r2]dhcp enable 先开启DHCP服务
[r2]ip pool c 创建名为c的DHCP池塘
[r2-ip-pool-c]network 192.168.2.0 mask 25 关联接口,定义该池塘可分配ip地址的范围
[r2-ip-pool-c]gateway-list 192.168.2.1 该网段网关
[r2-ip-pool-c]dns-list 114.114.114.114 DNS服务器地址
[r2]interface g0/0/1.1 转到分配ip地址的接口
[r2-GigabitEthernet0/0/1.1]dhcp select global 启动DHCP服务
[r2]ip pool d
[r2-ip-pool-d]network 192.168.2.128 mask 25
[r2-ip-pool-d]gateway-list 192.168.2.129
[r2-ip-pool-d]dns-list 114.114.114.114
[r2]interface g0/0/1.2
[r2-GigabitEthernet0/0/1.2]dhcp select global
[r2-GigabitEthernet0/0/1]ip address 192.168.3.2 24 路由器IP另一地址
[r2]ip route-static 192.168.1.0 255.255.255.0 192.168.3.1 配置静态路由
至此:全网可达,实验结束