在兩臺二層交換機上創建vlan【sw1?vlan10 sw2?vlan20】并將三個端口加入相應的vlan中 [sw1]vlan 10 [sw1-vlan10]q [sw1-GigabitEthernet0/0/1]undo sh Info: Interface GigabitEthernet0/0/1 is not shutdown. [sw1-Ethernet0/0/1]port link-type acc//選擇access模式 [sw1-Ethernet0/0/1]port def vlan 10 //加入vlan10 其他端口同理【sw2上只是把vlan10換成vlan20】
配置三層交換機: 創建vlan10、2 將vlan10/20加入端口【access模式】 配置vlanIP: [dhcp-Vlanif10]undo sh Info: Interface Vlanif10 is not shutdown. [dhcp-Vlanif10] [dhcp-Vlanif10] [dhcp-Vlanif10]ip add 192.168.10.254 255.255.255.0 [dhcp-Vlanif20]ip add 192.168.20.254 255.255.255.0 創建地址池: [dhcp]ip pool vlan-10 Info:It's successful to create an IP address pool. [dhcp-ip-pool-vlan-10]network 192.168.10.0 mask 255.255.255.0 [dhcp-ip-pool-vlan-10]gateway-list 192.168.10.254 [dhcp]ip pool vlan-20 Info:It's successful to create an IP address pool. [dhcp-ip-pool-vlan-20]network 192.168.20.0 mask 255.255.255.0 [dhcp-ip-pool-vlan-20]gateway-list 192.168.20.254 開啟DHCP功能,端口開啟DHCP全局: [dhcp]dhcp enable Info: The operation may take a few seconds. Please wait for a moment.done. [dhcp-Vlanif10]dhcp select global [dhcp-Vlanif20]dhcp select global 配置完成 3.驗證、測試、保存