一.实验目的
- 掌握trunk的配置
- 掌握VTP基本操作、
- 理解VTP角色之间的区别
二.拓扑与需求
拓扑:
需求:
1.MSW1和SW2之间的线路需配置为Trunk,采用Dot1q封装协议
2.MSW1和SW2上创建VLAN 10、20,MSW1 配置SVI 10的IP为192.168.10.254,SVI 20的IP为192.168.20.254,作为PC1和PC2的网关,SW2将接口E0/1划分到VLAN 10,E0/2划分到VLAN 20
3.在MSW1上配置两个DHCP地址池,地址池名Produce,分发地址范围192.168.10.0/24,网关为192.168.10.254,DNS地址为114.114.114.114,要求下发IP地址时不允许下发192.168.10.254;地址池名Office,分发地址范围192.168.20.0/24,网关为192.168.20.254,DNS地址为114.114.114.114,要求下发IP地址时不允许下发192.168.20.254
三.配置与实现
1.MSW1和SW2之间的线路需配置为Trunk,采用Dot1q封装协议
MSW1
MSW1(config)#interface ethernet 0/0
MSW1(config-if)#switchport trunk encapsulation dot1q
MSW1(config-if)#switchport mode trunk
SW2
sw2(config)#int e0/0
sw2(config-if)#switchport trunk encapsulation dot1q sw2(config-if)#switchport mo t
2.MSW1和SW2上创建VLAN 10、20,MSW1 配置SVI 10的IP为192.168.10.254,SVI 20的IP为192.168.20.254,作为PC1和PC2的网关,SW2将接口E0/1划分到VLAN 10,E0/2划分到VLAN 20
MSW1
MSW1(config)#vlan 10,20
MSW1(config-vlan)#interface vlan 10
MSW1(config-if)#ip address 192.168.10.254 255.255.255.0
MSW1(config-if)#no shutdown
MSW1(config-if)#interface vlan 20
MSW1(config-if)#ip address 192.168.20.254 255.255.255.0
MSW1(config-if)#no shutdown
SW2
SW2(config)#interface ethernet 0/1
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 10
% Access VLAN does not exist. Creating vlan 10
SW2(config-if)#interface ethernet 0/2
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 20
% Access VLAN does not exist. Creating vlan 20
3.在MSW1上配置两个DHCP地址池,地址池名Produce,分发地址范围192.168.10.0/24,网关为192.168.10.254,DNS地址为114.114.114.114,要求下发IP地址时不允许下发192.168.10.254;地址池名Office,分发地址范围192.168.20.0/24,网关为192.168.20.254,DNS地址为114.114.114.114,要求下发IP地址时不允许下发192.168.20.254
MSW1
MSW1(config)#ip dhcp pool Produce
MSW1(dhcp-config)#network 192.168.10.0 /24
MSW1(dhcp-config)#default-router 192.168.10.254
MSW1(dhcp-config)#dns-server 114.114.114.114
MSW1(config)#ip dhcp pool Office
MSW1(dhcp-config)#network 192.168.20.0 /24
MSW1(dhcp-config)#default-router 192.168.20.254
MSW1(dhcp-config)#dns-server 114.114.114.114
MSW1(config)#ip dhcp excluded-address 192.168.10.254
MSW1(config)#ip dhcp excluded-address 192.168.20.254
pc
PC1(config)#interface ethernet 0/1
PC1(config-if)#ip address dhcp
PC1(config-if)#no shutdown
PC2(config)#interface ethernet 0/2
PC2(config-if)#ip address dhcp
PC2(config-if)#no shutdown
最后在PC上查看IP信息即可
实验结束