Packet Tracer 5.0实验(四) 利用三层交换机实现VLAN间路由
一、實(shí)驗(yàn)?zāi)繕?biāo)
- 掌握交換機(jī)Tag VLAN 的配置;
- 掌握三層交換機(jī)基本配置方法;
- 掌握三層交換機(jī)VLAN路由的配置方法;
- 通過三層交換機(jī)實(shí)現(xiàn)VLAN間相互通信;
?
二、實(shí)驗(yàn)背景
某企業(yè)有兩個主要部門,技術(shù)部和銷售部,分處于不同的辦公室,為了安全和便于管理,對兩個部門的主機(jī)進(jìn)行了VLAN的劃分,技術(shù)部和銷售部分處于不同的VLAN?,F(xiàn)由于業(yè)務(wù)的需求,需要銷售部和技術(shù)部的主機(jī)能夠相互訪問,獲得相應(yīng)的資源,兩個部門的交換機(jī)通過一臺三層交換機(jī)進(jìn)行了連接。
?
三、技術(shù)原理
三層交換機(jī)具備網(wǎng)絡(luò)層的功能,實(shí)現(xiàn)VLAN間相互訪問的原理是:利用三層交換機(jī)的路由功能,通過識別數(shù)據(jù)包的IP地址,查找路由表進(jìn)行選路轉(zhuǎn)發(fā)。三層交換機(jī)利用直連路由可以實(shí)現(xiàn)不同VLAN之間的互相訪問。三層交換機(jī)給接口配置IP地址,采用SVI(交換虛擬接口)的方式實(shí)現(xiàn)VLAN間互連。SVI是指為交換機(jī)中的VLAN創(chuàng)建虛擬接口,并且配置IP地址。
?
四、實(shí)驗(yàn)步驟
實(shí)驗(yàn)拓?fù)?/p>
?
1、在二層交換機(jī)上配置VLAN 2、VLAN 3,分別將端口2、端口3劃到VLAN 2、VLAN 3;
2、將二層交換機(jī)與三層交換機(jī)相連的端口Fa0/1定義為Tag VLAN模式;
Switch>en Switch#conf t Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#vlan 2 Switch(config-vlan)#exit Switch(config)#vlan 3 Switch(config-vlan)#exit Switch(config)#interface fa0/2 Switch(config-if)#switchport access vlan 2 Switch(config-if)#exit Switch(config)#interface fa0/3 Switch(config-if)#switchport access vlan 3 Switch(config-if)#exit Switch(config)#interface fa0/1 Switch(config-if)#switchport mode trunk%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upSwitch(config-if)#3、在三層交換機(jī)上配置VLAN 2、VLAN 3,分別將端口2、端口3劃到VLAN 2、VLAN 3;
Switch>en Switch#conf t Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#vlan 2 Switch(config-vlan)#exit Switch(config)#vlan 3 Switch(config-vlan)#exit Switch(config)#interface fa0/2 Switch(config-if)#switchport access vlan 2 Switch(config-if)#exit Switch(config)#interface fa0/3 Switch(config-if)#switchport access vlan 3 Switch(config-if)#exitSwitch(config)#
4、設(shè)置三層交換機(jī)VLAN間通信,創(chuàng)建VLAN 2、VLAN 3的虛擬接口,并配置虛擬接口VLAN 2、VLAN 3的IP地址;
Switch(config)#interface vlan 2 //創(chuàng)建 VLAN 2 的虛擬接口 Switch(config-if)# %LINK-5-CHANGED: Interface Vlan2, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to upSwitch(config-if)#ip address 192.168.1.1 255.255.255.0 //配置虛擬接口 VLAN 2 的IP地址 Switch(config-if)#no shutdown Switch(config-if)#exit Switch(config)#interface vlan 3 //創(chuàng)建 VLAN 2 的虛擬接口 Switch(config-if)# %LINK-5-CHANGED: Interface Vlan3, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan3, changed state to upSwitch(config-if)#ip address 192.168.2.1 255.255.255.0 //配置虛擬接口 VLAN 2 的IP地址 Switch(config-if)#no shutdown Switch(config-if)#endSwitch#
5、查看三層交換機(jī)路由表
Switch#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area* - candidate default, U - per-user static route, o - ODRP - periodic downloaded static routeGateway of last resort is not setC 192.168.1.0/24 is directly connected, Vlan2 C 192.168.2.0/24 is directly connected, Vlan3 Switch#6、將VLAN 2、VLAN 3下的主機(jī)默認(rèn)網(wǎng)關(guān)分別設(shè)置為相應(yīng)虛擬接口的IP地址;
?
五、驗(yàn)證
打開PC1 Command Prompt
Packet Tracer PC Command Line 1.0 PC>ipconfigIP Address......................: 192.168.1.2 Subnet Mask.....................: 255.255.255.0 Default Gateway.................: 192.168.1.1PC>ping 192.168.1.3Pinging 192.168.1.3 with 32 bytes of data:Reply from 192.168.1.3: bytes=32 time=187ms TTL=128 Reply from 192.168.1.3: bytes=32 time=93ms TTL=128 Reply from 192.168.1.3: bytes=32 time=110ms TTL=128 Reply from 192.168.1.3: bytes=32 time=93ms TTL=128Ping statistics for 192.168.1.3:Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:Minimum = 93ms, Maximum = 187ms, Average = 120msPC>ping 192.168.2.2Pinging 192.168.2.2 with 32 bytes of data:Request timed out. Reply from 192.168.2.2: bytes=32 time=188ms TTL=127 Reply from 192.168.2.2: bytes=32 time=112ms TTL=127 Reply from 192.168.2.2: bytes=32 time=125ms TTL=127Ping statistics for 192.168.2.2:Packets: Sent = 4, Received = 3, Lost = 1 (25% loss), Approximate round trip times in milli-seconds:Minimum = 112ms, Maximum = 188ms, Average = 141msPC>ping 192.168.2.3Pinging 192.168.2.3 with 32 bytes of data:Request timed out. Reply from 192.168.2.3: bytes=32 time=125ms TTL=127 Reply from 192.168.2.3: bytes=32 time=78ms TTL=127 Reply from 192.168.2.3: bytes=32 time=64ms TTL=127Ping statistics for 192.168.2.3:Packets: Sent = 4, Received = 3, Lost = 1 (25% loss), Approximate round trip times in milli-seconds:Minimum = 64ms, Maximum = 125ms, Average = 89ms轉(zhuǎn)載于:https://www.cnblogs.com/mchina/archive/2012/07/14/2591598.html
總結(jié)
以上是生活随笔為你收集整理的Packet Tracer 5.0实验(四) 利用三层交换机实现VLAN间路由的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 查找当前地形位置上的贴图信息
- 下一篇: ArcGIS API for Silve