计算机通信网络实验讲义.docx
- 文档编号:10190848
- 上传时间:2023-02-09
- 格式:DOCX
- 页数:18
- 大小:20.04KB
计算机通信网络实验讲义.docx
《计算机通信网络实验讲义.docx》由会员分享,可在线阅读,更多相关《计算机通信网络实验讲义.docx(18页珍藏版)》请在冰豆网上搜索。
计算机通信网络实验讲义
实验一计算机和交换机基本设置
添加一个交换机,一个计算机,双击交换机,进入终端配置:
password:
[Quidway]sysnameS3026;交换机命名
[S3026]superpassword111;设置特权密码
[S3026]user-interfacevty04;设置TELNET用户有5个,从0到4
[S3026-ui-vty0-4]authentication-modepassword;认证模式为密码
[S3026-ui-vty0-4]setauthentication-modepasswordsimple222;设置密码为明文222
[S3026-ui-vty0-4]userprivilegelevel3;用户权限为3
[S3026-ui-vty0-4]quit;退出
[S3026]quit;退出
password:
111;设置系统密码为111
[S3026]displaycurrect-config;显示当前配置
[S3026]discurr;显示当前配置
[S3026]vlan2;创建VLAN2
[S3026-vlan2]portethernet0/2;把端口2放入VLAN2
[S3026-vlan2]porte0/4toet0/6;把端口4,5,6放入VLAN2
[S3026-vlan2]quit;退出
[S3026]disvlan;显示当前VLAN
[S3026]inte0/3;进入端口3视图
[S3026-Ethernet1]portaccessvlan2;把端口1放入VLAN2
[S3026-Ethernet1]quit;退出
[S3026]disvlan;显示VLAN现状
[S3026]discurr;显示当前配置
[S3026]interfacevlan1;进入VLAN1接口视图
[S3026-Vlan-interface1]ipaddress10.65.1.8255.255.0.0;配置IP地址
[S3026-Vlan-interface1]quit
[S3026]iproute-static0.0.0.00.0.0.010.65.1.2;配置静态路由
[S3026]ipdefault-gateway10.65.1.2;配置默认网关
[S3026]discurr
[S3026]save;保持配置信息到FLASH
双击小电脑:
login:
root;登陆系统
password:
linux;密码为LINUX
[root@PCAroot]#ifconfigeth010.65.1.1netmask255.255.0.0;设置IP地址和掩码
[root@PCAroot]#ifconfig;显示IP地址
[root@PCAroot]#routeadddefaultgw10.65.1.2;设置默认网关
[root@PCAroot]#route;显示默认网关
[root@PCAroot]#ping10.65.1.8;测试本机与10.65.1.8主机间的连通性
[root@PCAroot]#telnet10.65.1.8;远程登陆10.65.1.8主机对交换机进行配置
实验二配置端口聚合
要求聚合的端口工作在全双工,速度一致,在同一槽口且连续。
参数:
ingress:
源MAC,both:
源和目的MAC
对于SwitchA:
[Quidway]sysnameSwitchA;设置交换机名
[SwitchA]interfaceethernet0/1;进入接口1视图
[SwitchA-Ethernet0/1]duplexfull;设置接口通信方式为全双工
[SwitchA-Ethernet0/1]speed100;设置接口速率为100M
[SwitchA-Ethernet0/1]portlink-typetrunk;设置端口链路类型为TRUNK
[SwitchA-Ethernet0/1]porttrunkpermitvlanall;允许所有VLAN中的端口数据都能从本端口通过
[SwitchA-Ethernet0/1]inte0/2
[SwitchA-Ethernet0/2]duplexfull
[SwitchA-Ethernet0/2]speed100
[SwitchA-Ethernet0/2]portlink-typetrunk
[SwitchA-Ethernet0/2]porttrunkpermitvlanall
对于SwitchB:
[Quidway]sysnameSwitchB
[SwitchB]interfaceethernet0/1
[SwitchB-Ethernet0/1]duplexfull
[SwitchB-Ethernet0/1]speed100
[SwitchB-Ethernet0/1]portlink-typetrunk
[SwitchB-Ethernet0/1]porttrunkpermitvlanall
[SwitchB-Ethernet0/1]inte0/2
[SwitchB-Ethernet0/2]duplexfull
[SwitchB-Ethernet0/2]speed100
[SwitchB-Ethernet0/2]portlink-typetrunk
[SwitchB-Ethernet0/2]porttrunkpermitvlanall
聚合操作:
[SwitchA]link-aggregationethernet0/1toethernet0/2both;把端口1和端口2进行捆绑
[SwitchB]link-aggregationethernet0/1toethernet0/2both
[SwitchA]displaylink-aggregationethernet0/1;显示端口1捆绑情况
[SwitchA]undolink-aggregationall;去除所有捆绑配置
实验三基本VLAN设置
[SwitchA]vlan2;创建VLAN2
[SwitchA-vlan2]porte0/2;VLAN2中放入端口2
[SwitchA-vlan2]porte0/3toe0/4;VLAN2中放入端口3,4
[SwitchA-vlan2]vlan3;
[SwitchA-vlan3]porte0/5toe0/6
[SwitchA]disvlanall;显示全部VLAN信息
[SwitchA]discurrent显示当前配置信息
[SwitchB]vlan2
[SwitchB-vlan2]porte0/3toe0/4
[SwitchB-vlan2]vlan3
[SwitchB-vlan3]porte0/5toe0/6
[SwitchB-vlan3]quit
[SwitchB]disvlanall
[SwitchB]discurrent
设置计算机的IP为:
PCA:
10.65.1.1PCB:
10.66.1.1PCC:
10.65.1.3PCD:
10.66.1.3
[root@PCAroot]#ping10.65.1.1通(本机IP)
[root@PCAroot]#ping10.65.1.3不通(中间连接线是vlan1)
[root@PCAroot]#ping10.66.1.1不通(不同网络,不同vlan)
[root@PCAroot]#ping10.66.1.3不通(不同网络,不同vlan)
[root@PCBroot]#ping10.66.1.3不通(中间连接线是vlan1)
将PCA改接到SwitchAE0/2(vlan1)
[root@PCAroot]#ping10.65.1.3不通(同网络,不同vlan)
将PCC改接到SwitchBE0/2(vlan1)
[root@PCAroot]#ping10.65.1.3通(同网络,同在vlan1)
再改回来,并设置trunk:
[S3026A]interfaceethernet0/8;进入端口8视图
[S3026A-Ethernet0/8]portlink-typetrunk;设置端口8链路类型为TRUNK
[S3026A-Ethernet0/8]porttrunkpermitvlanall;端口8允许所有VLAN数据通过
[S3026B]interfaceethernet0/1
[S3026B-Ethernet0/1]portlink-typetrunk
[S3026B-Ethernet0/1]porttrunkpermitvlanall
[S3026B-Ethernet0/1]quit
[S3026B]discurr
[root@PCAroot]#ping10.65.1.3通
[root@PCAroot]#ping10.66.1.3不通
[root@PCBroot]#ping10.66.1.3通
即:
PCA和PCC同在vlan2是通的,PCB和PCD同在vlan3是通的。
PCA和PCB是不通的。
同理PCC和PCD也是不通的。
------------------------------------------------------------
再加入一个交换机switchC,将它串入switchA和switchB之间,连接方式:
switchA:
E0/8-->switchC:
E0/3;switchC:
E0/6-->switchB:
E0/1
(1)新加入的SwitchC默认状态时,测试连通性。
从PCA->PCC,从PCB->PCD测试:
[root@PCAroot]#ping10.65.1.3(不通)
[root@PCBroot]#ping10.66.1.3(不通)
由于新加入的交换机没有设置trunk,端口默认vlan1,交换机的trunk
要成对出现,因为当dot1q不能和另一端交换信息时,会自动down掉。
(2)将交换机之间的连线都设置成trunk时,再测试连通性。
[S3026C]interfaceethernet0/3
[S3026C-Ethernet0/1]portlink-typetrunk
[S3026C-Ethernet0/1]porttrunkpermitvlanall
[S3026C]interfaceethernet0/6
[S3026C-Ethernet0/8]portlink-typetrunk
[S3026C-Ethernet0/8]porttrunkpermitvlanall
现在有两条正确的trunk,再看一下联通情况:
[root@PCAroot]#ping10.65.1.3(通)
[root@PCBroot]#ping10.66.1.3(通)
实验四配置primaryVLAN和secondaryVLAN
主附vlan一般用于一个网络段的情况,主vlan和子vlan间可以访问,
而子vlan之间是不能访问的。
[SwitchA]vlan2
[SwitchA-vlan2]portethernet0/5toethernet0/6
[SwitchA]vlan3
[SwitchA-vlan3]portethernet0/7toethernet0/8
[SwitchA]vlan5
[SwitchA-vlan5]portethernet0/1toethernet0/4
[SwitchA-vlan5]isolate-user-vlanenable;vlan5是主vlan
[SwitchA-vlan5]quit
[SwitchA]isolate-user-vlan5secondary2,3;vlan2,3是子vlan
[SwitchB]vlan2
[SwitchB-vlan2]portethernet0/5toethernet0/6
[SwitchB]vlan3
[SwitchB-vlan3]portethernet0/7toethernet0/8
[SwitchA]vlan4
[SwitchB-vlan4]portethernet0/1toethernet0/4
[SwitchB-vlan4]isolate-user-vlanenable;vlan4是主vlan
[SwitchB-vlan4]quit
[SwitchB]isolate-user-vlan4secondary2,3;vlan2,3是子vlan
实验五交换机的镜像与生成树
(一)设置镜像
镜像是一个端口的数据被映射到另一个端口,进行数据分析。
[Quidway]monitor-porte0/8;被镜像端口
[Quidway]portmirrore0/1;镜像端口
或:
[Quidway]portmirrore0/1toe0/2observing-porte0/8端口1,2镜像端口8
(二)生成树
[Quidway]stp{enable|disable}
[Quidway]stppriority4096设置交换机的优先级
[Quidway]stprootprimary设置交换机为树根
[Quidway-Ethernet0/1]stpcost200设置交换机端口的花费
实验七直联路由
password:
;输入系统密码
[Quidway]interfaceethernet0;进入端口0
[Quidway-Ethernet0]ipaddr10.65.1.2255.255.255.0;配置IP地址
[Quidway-Ethernet0]undoshutdown;打开端口0
[Quidway-Ethernet0]inte1;进入端口1
[Quidway-Ethernet1]ipaddr10.66.1.2255.255.255.0
[Quidway-Ethernet1]undoshutdown
[root@PCAroot]#ifconfigeth010.65.1.1netmask255.255.0.0设置PC的IP地址和掩码
[root@PCBroot]#ifconfigeth010.66.1.1netmask255.255.0.0
[root@PCAroot]#ping10.65.1.2(通,没有关只能ping直连的口)
[root@PCAroot]#ping10.66.1.2(不通,PCA没有设置网关)
[root@PCAroot]#routeadddefaultgw10.65.1.2
[root@PCAroot]#ping10.66.1.2(通)
[root@PCAroot]#ping10.66.1.1(不通,因PCB没有网关)
[root@PCBroot]#routeadddefaultgw10.66.1.2
[root@PCAroot]#ping10.66.1.1(通)
去掉计算机HostB与Router的连线,再ping:
[root@PCAroot]#ping10.66.1.2不通(没有接线端口会自动down掉)
再连接HostB与Router的连线,再ping:
[root@PCAroot]#ping10.66.1.2(通)
实验八单臂路由
设置PCAip:
10.65.1.1gateway:
10.65.1.2
设置PCBip:
10.66.1.1gateway:
10.66.1.2
1.一个接口两个IP的情况
password:
[Quidway]interfaceethernet0
[Quidway-Ethernet0]ipaddr10.65.1.2255.255.255.0;设置端口0的IP地址
[Quidway-Ethernet0]ipaddr10.66.1.2255.255.255.0secondary;设置端口0的次IP地址
[Quidway-Ethernet0]undoshutdown;打开端口0
[root@PCAroot]#ping10.66.1.1通
2.划分两个子接口,对两个vlan的路由
[SwitchA]vlan2
[SwitchA-vlan2]porte0/3
[SwitchA]vlan3
[SwitchA-vlan3]porte0/6
[SwitchA]inee0/1;进入端口1
[SwitchA-Ethernet0/1]portlink-typetrunk;设置端口链路类型为TRUNK
[SwitchA-Ethernet0/1]porttrunkpermitvlanall;此端口允许所有VLAN通过
[SwitchA-Ethernet0/1]porttrunkencapdot1q;此端口允许802。
1Q协议
[SwitchA]discurr
[Quidway]inte0
[SwitchA-Ethernet0]inte0.1;进入子端口1
[SwitchA-Ethernet0.1]encapsulationdot1q2;允许802。
1Q协议,后面的2指的是VLANID,意思是子接口1可与交换机的vlan2通讯
[SwitchA-Ethernet0.1]ipaddr10.65.1.2255.255.255.0;配置IP地址
[SwitchA-Ethernet0.1]nudoshut;打开子端口1
[SwitchA-Ethernet0.1]inte0.2
[SwitchA-Ethernet0.2]encapsulationdot1q3
[SwitchA-Ethernet0.2]ipaddr10.66.1.2255.255.255.0
[SwitchA-Ethernet0.2]nudoshut
[SwitchA]discurr
[root@PCAroot]#ping10.66.1.1通
实验九静态路由实验
PCA:
10.65.1.1PCB:
10.66.1.1PCC:
10.70.1.1PCD:
10.71.1.1
[RouterA]interfaceethernet0
[RouterA-Ethernet0]ipaddrress10.65.1.2255.255.0.0
[RouterA-Ethernet0]undoshutdown
[RouterA-Ethernet0]inte1
[RouterA-Ethernet1]ipaddrress10.66.1.2255.255.0.0
[RouterA-Ethernet1]undoshutdown
[RouterA-Ethernet1]ints1
[RouterA-Serial1]ipaddrress10.68.1.2255.255.0.0
[RouterA-Serial1]undoshutdown
[RouterA-Serial1]clockrate64000;配置该端口为DCE(时钟频率为64000)
[RouterA-Serial1]quit
[RouterA]iprouting;路由器路由使能
[RouterA]discurr
[RouterB]interfaceethernet0
[RouterB-Ethernet0]ipaddrress10.70.1.2255.255.0.0
[RouterB-Ethernet0]undoshutdown
[RouterB-Ethernet0]inte1
[RouterB-Ethernet1]ipaddrress10.71.1.2255.255.0.0
[RouterB-Ethernet1]undoshutdown
[RouterB-Ethernet1]ints0
[RouterB-Serial0]ipaddrress10.68.1.1255.255.0.0
[RouterB-Serial0]undoshutdown
[RouterB-Serial0]quit
[RouterB]iprouting
[RouterB]discurr
[root@PCAroot]#ifconfigeth010.65.1.1netmask255.255.0.0
[root@PCAroot]#routeadddefaultgw10.65.1.2
[root@PCAroot]#ping10.65.1.2通
[root@PCAroot]#ping10.66.1.2通
[root@PCAroot]#ping10.67.1.2通
[root@PCAroot]#ping10.68.1.2不通
[root@PCAroot]#ping10.69.1.2不通
[RouterA]iproute-static10.69.0.0255.255.0.010.67.1.1;配置静态路由:
去目的网络10.69.0.0下一跳地址为10.67.1.1
[root@PCAroot]#ping10.69.1.1通
三个路由器的静态路由(参考实验九图)
设置RouterA的IP:
f0/0:
10.65.1.2--->PCA:
10.65.1.1
f0/1:
10.66.1.2--->PCB:
10.66.1.1
s0/0:
10.67.1.2
s0/1:
10.68.1.2--->接RouterCs0/0
设置RouterC的IP:
s0/0:
10.68.1.1<---
s0/1:
10.78.1.2--->接RouterBs0/0
设置RouterB的IP:
s0/0:
10.78.1.1<---
s0/1:
10.67.1.1
f0/0:
10.69.1.2--->PCC:
10.69.1.1
f0/1:
10.70.1.2--->PCD:
10.70.1.1
设置从PCA到PCC的静态路由
[ROA]iprouting
[ROA]iproute-static10.69.0.0255.255.0.010.68.1.1
[ROA]displayiproute;显示当前路由表
[ROB]iproute-static10.69.0.0255.255.0.010.78.1.1
[ROB]display
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 通信 网络 实验 讲义