三層交換機配置學習
1.給vlan配置IP
在連接PC的交換機上劃分3個VLAN,並按圖-1把PC機加入相應VLAN
tarenasw-3L (config-vlan)#vlan 2 //vlan1是默認VLAN,不需創建
tarenasw-3L (config-vlan)#vlan 3
tarenasw-3L (config-vlan)#exit
tarenasw-3L (config)#interface f0/1
tarenasw-3L (config-if)#switchport access vlan 1
tarenasw-3L (config-if)#interface f0/2
tarenasw-3L (config-if)#switchport access vlan 2
tarenasw-3L (config-if)#interface f0/3
tarenasw-3L (config-if)#switchport access vlan 3
查看劃分完的VLAN信息
VLAN1是默認VLAN,不需單獨創建,也不能改名。所有端口默認都在VLAN1中。
tarenasw-2L#show vlan
VLAN Name Status Ports
---- ----------------------- --------- ---------------------
1 default active Fa0/1, Fa0/4, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23, Fa0/24, Gig1/1, Gig1/2
2 vlan0002 active Fa0/2
3 vlan0003 active Fa0/3
步驟三:為vlan1、vlan2、vlan3分別設置管理IP並開啟三層交換機路由功能
tarenasw-3L #enable
tarenasw-3L #configure terminal
tarenasw-3L (config)#ip routing //開啟三層交換機路由功能
tarenasw-3L (config)#interface vlan 1 //給三層交換機上的vlan123配置IP地址。
tarenasw-3L (config-if)#ip address 192.168.1.254 255.255.255.0
tarenasw-3L (config-if)#no shutdown
tarenasw-3L (config-if)#exit
tarenasw-3L (config)#interface vlan 2
tarenasw-3L (config-if)#ip address 192.168.2.254 255.255.255.0
tarenasw-3L (config-if)#no shutdown
tarenasw-3L (config-if)#exit
tarenasw-3L (config)#interface vlan 3
tarenasw-3L (config-if)#ip address 192.168.3.254 255.255.255.0
tarenasw-3L (config-if)#no shutdown
步驟四:給客戶端配置IP地址並測試網絡連通性如圖-2圖-3所示
在PC1三上測試網絡連通性
PC1>ping 192.168.3.1
Pinging 192.168.3.1 with 32 bytes of data:
Reply from 192.168.3.1: bytes=32 time=11ms TTL=128
Reply from 192.168.3.1: bytes=32 time=1ms TTL=128
Reply from 192.168.3.1: bytes=32 time=1ms TTL=128
Reply from 192.168.3.1: bytes=32 time=4ms TTL=128
Ping statistics for 192.168.3.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 11ms, Average = 4ms
=============================================================================
2.給端口配置IP地址。
tarenasw-3L (config)#interface f0/1
tarenasw-3L (config-if)#no switchport
tarenasw-3L (config-if)#ip addresses IP 子網掩碼
tarenasw-3L (config-if)#no shutdown
tarenasw-3L (config)#interface f0/2
tarenasw-3L (config-if)#no switchport
tarenasw-3L (config-if)#ip addresses IP 子網掩碼
tarenasw-3L (config-if)#no shutdown
tarenasw-3L (config)#interface f0/3
tarenasw-3L (config-if)#no switchport
tarenasw-3L (config-if)#ip addresses IP 子網掩碼
tarenasw-3L (config-if)#no shutdown
tarenasw-3L (config)#ip routing //開啟三層交換機路由功能
三層交換機配置學習