实验一VLAN TRUNK.docx
- 文档编号:15964704
- 上传时间:2023-07-09
- 格式:DOCX
- 页数:16
- 大小:100.16KB
实验一VLAN TRUNK.docx
《实验一VLAN TRUNK.docx》由会员分享,可在线阅读,更多相关《实验一VLAN TRUNK.docx(16页珍藏版)》请在冰点文库上搜索。
实验一VLANTRUNK
实验一:
VLANTRUNK
一:
实验目标
(1)实现小型企业局域网二层广播域VLAN隔离和三层全网全联通
(2)掌握VLAN,TRUNK,单臂路由的配置方法
(3)分析小型企业局域网广播域大小及二层网络通信范围
(4)分析PC1pingPC3的三层通信过程和二层通信过程
二:
拓扑图
三:
预期结果
PC1ping通PC3
四:
调试
SW3基本配置(SW4基本配置一样):
Switch>enable
Switch#conft
Switch(config)#hostnameSW3//设置主机名SW3
SW3(config)#noipdomain-lookup//禁用域名查找
SW3(config)#lineconsole0//进入console口线路模式
SW3(config-line)#loggingsynchronous//console信息显示自动换行
SW3(config-line)#nologin//配置console口登录不认证
SW3(config-line)#privilegelevel15//配置console口登录为最高特权级别
SW3(config-line)#linevty04
SW3(config-line)#nologin
SW3(config-line)#privilegelevel15//配置telent口登录为最高特权级别
SW3(config-line)#exit
SW3(config)#end
SW3,SW4VLAN创建:
SW3#vlandatabase
SW3(vlan)#vlan10//创建VLAN10
VLAN10added:
Name:
VLAN0010
SW3(vlan)#vlan8//创建VLAN8
VLAN8added:
Name:
VLAN0008
SW3(vlan)#vlan11//创建VLAN11
VLAN11added:
Name:
VLAN0011
SW3(vlan)#exit
APPLYcompleted.
Exiting....
SW4#vlandatabase
SW4(vlan)#vlan8
VLAN8added:
Name:
VLAN0008
SW4(vlan)#vlan10
VLAN10added:
Name:
VLAN0010
SW4(vlan)#vlan11
VLAN11added:
Name:
VLAN0011
SW4(vlan)#exit
APPLYcompleted.
Exiting....
SW3,SW4的Access接口配置:
SW3#conft
SW3(config)#intf0/10//与PC1相连的接口
SW3(config-if)#switchportmodeaccess//配置为access接口
SW3(config-if)#switchportaccessvlan10//将接口加入vlan10
SW3(config-if)#exit
SW3(config)#intf0/11
SW3(config-if)#switchportmodeaccess
SW3(config-if)#switchportaccessvlan11
SW3(config-if)#exit
SW3(config)#end
SW4#conft
SW4(config)#intf0/10
SW4(config-if)#switchportmodeaccess
SW4(config-if)#switchportaccessvlan10
SW4(config-if)#exit
SW4(config)#intf0/11
SW4(config-if)#switchportmodeaccess
SW4(config-if)#switchportaccessvlan11
SW4(config-if)#exit
SW3-SW4的Trunk链路配置:
SW3(config)#intf0/3
SW3(config-if)#switchporttrunkencapsulationdot1q//封装协议为dot1q
SW3(config-if)#switchportmodetrunk//配置接口为Trunk接口
SW3(config-if)#switchporttrunkallowedvlanall//配置该trunk接口允许所有VLAN通过
SW3(config-if)#exit
SW3(config)#end
SW4(config)#intf0/3
SW4(config-if)#switchporttrunkencapsulationdot1q
SW4(config-if)#switchportmodetrunk
SW4(config-if)#switchporttrunkallowedvlanall
SW4(config-if)#exit
SW4(config)#end
SW3,SW4的网管接口配置:
SW3#conft
SW3(config)#intvlan8
SW3(config-if)#ipadd192.168.8.130255.255.255.128
SW3(config-if)#nosh
SW3(config-if)#exit
SW3(config)#end
SW4#conft
SW4(config)#intvlan8
SW4(config-if)#ipadd192.168.8.130255.255.255.128
SW4(config-if)#nosh
SW4(config-if)#exit
SW4(config)#end
五:
测试
SW3:
showipintbri
SW3:
showvlan-switch
SW3:
showinttrunk
SW4:
showipintbri
SW4:
showvlan-switch
SW4:
showinttrunk
PC1pingPC3:
PC1pingPC4:
六:
总结与原理分析
数据流分析:
1Pc1封装icmp包,IP中目的IP地址为pc3的IP地址,源IP地址为本身IP地址,由于在ARP表中没有目标MAC地址,所以发送ARP请求,mac地址为全F,从fa0/10口进入交换机;
2ARP请求在入交换机SW3时,被打上vlan10的标签;进入交换机后,交换机查询MAC地址表,发现没有PC1的mac地址,便将PC1的mac地址存入MAC地址表,再查询目的mac发现全为F,所以将arp请求从各个端口洪泛出去;
3要从fa0/11口洪泛出去的arp请求,由于不能在fa0/11口被拆标,所以不能从fa0/11口出去;
4从fa0/3口洪泛的arp请求,由于在trunk口中一般不打标,也不拆标,所以就直接从SW3的fa0/3口进入到SW4的fa0/3口,此过程既不打标也不拆标;
5ARP请求进入SW4后,SW4查询ARP缓存表,发现没有PC1的MAC地址,便将PC1的mac地址存入mac地址表,再查询arp请求的目的mac,发现全为F,所以将arp请求从各个端口洪泛出去;
6要从fa0/11口洪泛出去的arp请求,由于不能在fa0/11口被拆标,所以不能从fa0/11口出去;
7从fa0/10口洪泛出去的arp请求,在出接口时,由于处于同一个vlan所以被拆标,成功进入到PC3中;
8进入pc3后,pc3查询arp缓存表,发现没有pc1的mac地址,便更新arp缓存表,将pc1的mac地址存入进去;pc3查询arp请求的目的IP地址,发现是自己的,于是封装一个arp应答,将自己的MAC地址封装入arp应答,再发出去;
9Arp应答通过fa0/10口时,被打上vlan10的标签,进入到交换机SW4;
10SW4通过查询MAC地址表,发现没有pc3的mac地址,便更新MAC地址表,将pc3的mac地址存入进去,然后查询目的mac,发现mac地址表中存在,于是通过fa0/3口转发到sw3;
11Arp应答进入sw3后,sw3查询MAC地址表,发现没有pc3的mac地址,便更新mac地址表,将pc3的mac地址存入进去,然后查询目的mac,发现mac表中存在,于是通过fa0/10转发arp应答到PC1中;
12Arp应答在通过fa0/10时,由于处于同一个vlan10,所以arp应答包被拆标;
13Pc1收到arp应答后,更新自己的arp缓存表,并将pc3的mac地址封装到icmp包中去,将icmp包封装好后,由fa0/10口进入sw3;
14Icmp包在fa0/10口时,被打上了vlan10的标记后,进入sw3;
15Icmp包进入sw3后,sw3查询mac地址表,发现了icmp包中的目的mac,通过目的mac转发包到fa0/3;
16由于sw3的fa0/3和sw4的fa0/3均为trunk口,所以既不打标也不拆标,从而进入sw4;
17Icmp包进入sw4后,sw4查询mac地址表,发现了目的mac,通过目的mac转发icmp包,由fa0/10出交换机;
18在fa0/10口,由于处于同一个vlan,所以icmp包被拆掉了vlan10的标,进入pc3;
19进入pc3后,pc3发现目的mac是自己的,目的ip也是自己的就打开icmp包,同时封装一个icmp回应包,从fa0/10口发出去;
20Icmp回应包在接口fa0/10被打上了vlan10的标签,进入sw4;
21进入sw4后,sw4查mac地址表,转发icmp回应包由fa0/3,到达sw3;
22Sw3同样查询mac地址表,转发icmp回应包由fa0/10口出去;
23在fa0/10口时,icmp回应包中的标签被拆掉;
24Pc1收到icmp回应包,解开各层封装,查看数据内容。
七:
配置showrun
SW3:
!
version12.3
servicetimestampsdebugdatetimemsec
servicetimestampslogdatetimemsec
noservicepassword-encryption
!
hostnameSW3
!
boot-start-marker
boot-end-marker
!
!
noaaanew-model
!
resourcepolicy
!
memory-sizeiomem5
ipsubnet-zero
!
!
ipcef
noipdhcpusevrfconnected
!
!
noipdomainlookup
noftp-serverwrite-enable
!
!
!
!
interfaceFastEthernet0/0
!
interfaceFastEthernet0/1
!
interfaceFastEthernet0/2
!
interfaceFastEthernet0/3
switchportmodetrunk
!
interfaceFastEthernet0/4
!
interfaceFastEthernet0/5
!
interfaceFastEthernet0/6
!
interfaceFastEthernet0/7
!
interfaceFastEthernet0/8
!
interfaceFastEthernet0/9
!
interfaceFastEthernet0/10
switchportaccessvlan10
!
interfaceFastEthernet0/11
switchportaccessvlan11
!
interfaceFastEthernet0/12
!
interfaceFastEthernet0/13
!
interfaceFastEthernet0/14
!
interfaceFastEthernet0/15
!
interfaceVlan1
noipaddress
!
interfaceVlan8
ipaddress192.168.8.130255.255.255.0
!
iphttpserver
ipclassless
!
!
!
!
!
control-plane
!
!
linecon0
loggingsynchronous
lineaux0
linevty04
!
End
SW4:
!
version12.3
servicetimestampsdebugdatetimemsec
servicetimestampslogdatetimemsec
noservicepassword-encryption
!
hostnameSW4
!
boot-start-marker
boot-end-marker
!
!
noaaanew-model
!
resourcepolicy
!
memory-sizeiomem5
ipsubnet-zero
!
!
ipcef
noipdhcpusevrfconnected
!
!
noipdomainlookup
noftp-serverwrite-enable
!
!
!
!
interfaceFastEthernet0/0
!
interfaceFastEthernet0/1
!
interfaceFastEthernet0/2
!
interfaceFastEthernet0/3
switchportmodetrunk
!
interfaceFastEthernet0/4
!
interfaceFastEthernet0/5
!
interfaceFastEthernet0/6
!
interfaceFastEthernet0/7
!
interfaceFastEthernet0/8
!
interfaceFastEthernet0/9
!
interfaceFastEthernet0/10
switchportaccessvlan10
!
interfaceFastEthernet0/11
switchportaccessvlan11
!
interfaceFastEthernet0/12
!
interfaceFastEthernet0/13
!
interfaceFastEthernet0/14
!
interfaceFastEthernet0/15
!
interfaceVlan1
noipaddress
!
interfaceVlan8
ipaddress192.168.8.131255.255.255.128
!
iphttpserver
ipclassless
!
!
!
!
!
control-plane
!
!
linecon0
loggingsynchronous
lineaux0
linevty04
!
end
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 实验一VLAN TRUNK 实验 VLAN
![提示](https://static.bingdoc.com/images/bang_tan.gif)