1、计算机通信网络实验讲义实验一 计算机和交换机基本设置添加一个交换机,一个计算机,双击交换机,进入终端配置:systempassword:Quidwaysysname S3026 ;交换机命名S3026super password 111 ;设置特权密码S3026user-interface vty 0 4 ;设置TELNET用户有5个,从0到4S3026-ui-vty0-4authentication-mode password ;认证模式为密码S3026-ui-vty0-4set authentication-mode password simple 222 ;设置密码为明文222S3026
2、-ui-vty0-4user privilege level 3 ;用户权限为3S3026-ui-vty0-4quit ;退出S3026quit ;退出sys ;进入系统视图password:111 ;设置系统密码为111S3026display currect-config ;显示当前配置S3026dis curr ;显示当前配置S3026vlan 2 ;创建VLAN2S3026-vlan2port ethernet0/2 ;把端口2放入VLAN2S3026-vlan2port e0/4 to et0/6 ;把端口4,5,6放入VLAN2S3026-vlan2quit ;退出S3026dis
3、 vlan ;显示当前VLAN S3026int e0/3 ;进入端口3视图S3026-Ethernet1port access vlan 2 ;把端口1放入VLAN2S3026-Ethernet1quit ;退出S3026dis vlan ;显示VLAN现状S3026dis curr ;显示当前配置S3026interface vlan 1 ;进入VLAN1接口视图S3026-Vlan-interface1ip address 10.65.1.8 255.255.0.0 ;配置IP地址S3026-Vlan-interface1quitS3026ip route-static 0.0.0.0
4、0.0.0.0 10.65.1.2 ;配置静态路由S3026ip default-gateway 10.65.1.2 ;配置默认网关S3026dis currS3026save ;保持配置信息到FLASH双击小电脑:login:root ;登陆系统password:linux ;密码为LINUXrootPCA root#ifconfig eth0 10.65.1.1 netmask 255.255.0.0 ;设置IP地址和掩码rootPCA root#ifconfig ;显示IP地址rootPCA root#route add default gw 10.65.1.2 ;设置默认网关rootP
5、CA root#route ;显示默认网关rootPCA root#ping 10.65.1.8 ;测试本机与10.65.1.8主机间的连通性rootPCA root#telnet 10.65.1.8 ;远程登陆10.65.1.8主机对交换机进行配置实验二 配置端口聚合要求聚合的端口工作在全双工,速度一致,在同一槽口且连续。参数:ingress:源MAC, both:源和目的MAC对于SwitchA:Quidwaysysname SwitchA ;设置交换机名SwitchAinterface ethernet0/1 ;进入接口1视图SwitchA-Ethernet0/1duplex full
6、;设置接口通信方式为全双工SwitchA-Ethernet0/1speed 100 ;设置接口速率为100MSwitchA-Ethernet0/1port link-type trunk ;设置端口链路类型为TRUNKSwitchA-Ethernet0/1port trunk permit vlan all ;允许所有VLAN中的端口数据都能从本端口通过SwitchA-Ethernet0/1int e0/2SwitchA-Ethernet0/2duplex fullSwitchA-Ethernet0/2speed 100SwitchA-Ethernet0/2port link-type tru
7、nkSwitchA-Ethernet0/2port trunk permit vlan all对于SwitchB:Quidwaysysname SwitchBSwitchBinterface ethernet0/1SwitchB-Ethernet0/1duplex fullSwitchB-Ethernet0/1speed 100SwitchB-Ethernet0/1port link-type trunkSwitchB-Ethernet0/1port trunk permit vlan allSwitchB-Ethernet0/1int e0/2SwitchB-Ethernet0/2duple
8、x fullSwitchB-Ethernet0/2speed 100SwitchB-Ethernet0/2port link-type trunkSwitchB-Ethernet0/2port trunk permit vlan all聚合操作:SwitchAlink-aggregation ethernet0/1 to ethernet0/2 both ;把端口1和端口2进行捆绑SwitchBlink-aggregation ethernet0/1 to ethernet0/2 bothSwitchAdisplay link-aggregation ethernet0/1 ;显示端口1捆绑情
9、况SwitchAundo link-aggregation all ;去除所有捆绑配置实验三 基本VLAN设置SwitchAvlan 2 ;创建VLAN2SwitchA-vlan2port e0/2 ;VLAN2中放入端口2SwitchA-vlan2port e0/3 to e0/4 ;VLAN2中放入端口3,4SwitchA-vlan2vlan 3 ;SwitchA-vlan3port e0/5 to e0/6SwitchAdis vlan all ;显示全部VLAN信息SwitchAdis current 显示当前配置信息SwitchBvlan 2SwitchB-vlan2port e0/
10、3 to e0/4SwitchB-vlan2vlan 3SwitchB-vlan3port e0/5 to e0/6SwitchB-vlan3quitSwitchBdis vlan allSwitchBdis current设置计算机的IP为:PCA:10.65.1.1 PCB:10.66.1.1 PCC:10.65.1.3 PCD:10.66.1.3rootPCA root#ping 10.65.1.1 通 (本机IP)rootPCA root#ping 10.65.1.3 不通 (中间连接线是vlan 1)rootPCA root#ping 10.66.1.1 不通 (不同网络,不同vla
11、n)rootPCA root#ping 10.66.1.3 不通 (不同网络,不同vlan)rootPCB root#ping 10.66.1.3 不通 (中间连接线是vlan 1)将PCA改接到SwitchA E0/2 (vlan 1)rootPCA root#ping 10.65.1.3 不通 (同网络,不同vlan)将PCC改接到SwitchB E0/2 (vlan 1)rootPCA root#ping 10.65.1.3 通 (同网络,同在vlan 1)再改回来,并设置trunk:S3026Ainterface ethernet0/8 ;进入端口8视图S3026A-Ethernet0
12、/8port link-type trunk ;设置端口8链路类型为TRUNKS3026A-Ethernet0/8port trunk permit vlan all ;端口8允许所有VLAN数据通过S3026Binterface ethernet0/1S3026B-Ethernet0/1port link-type trunkS3026B-Ethernet0/1port trunk permit vlan allS3026B-Ethernet0/1quitS3026Bdis currrootPCA root#ping 10.65.1.3 通rootPCA root#ping 10.66.1.
13、3 不通rootPCB root#ping 10.66.1.3 通即:PCA和PCC同在vlan 2 是通的,PCB和PCD同在vlan 3是通的。 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 测试:rootPCA root# ping 10.65.1.3 (不通)rootPCB root# ping
14、 10.66.1.3 (不通) 由于新加入的交换机没有设置trunk,端口默认vlan 1,交换机的trunk要成对出现,因为当dot1q不能和另一端交换信息时,会自动down掉。(2) 将交换机之间的连线都设置成trunk时,再测试连通性。S3026Cinterface ethernet0/3S3026C-Ethernet0/1port link-type trunkS3026C-Ethernet0/1port trunk permit vlan allS3026Cinterface ethernet0/6S3026C-Ethernet0/8port link-type trunkS3026
15、C-Ethernet0/8port trunk permit vlan all现在有两条正确的trunk,再看一下联通情况:rootPCA root# ping 10.65.1.3 (通)rootPCB root# ping 10.66.1.3 (通)实验四 配置primary VLAN和secondary VLAN 主附vlan一般用于一个网络段的情况,主vlan和子vlan间可以访问,而子vlan之间是不能访问的。SwitchAvlan 2SwitchA-vlan2port ethernet 0/5 to ethernet 0/6SwitchAvlan 3SwitchA-vlan3port
16、 ethernet 0/7 to ethernet 0/8SwitchAvlan 5SwitchA-vlan5port ethernet 0/1 to ethernet 0/4SwitchA-vlan5isolate-user-vlan enable ;vlan5是主vlanSwitchA-vlan5quitSwitchAisolate-user-vlan 5 secondary 2,3 ;vlan2,3是子vlanSwitchBvlan 2SwitchB-vlan2port ethernet 0/5 to ethernet 0/6SwitchBvlan 3SwitchB-vlan3port
17、ethernet 0/7 to ethernet 0/8SwitchAvlan 4SwitchB-vlan4port ethernet 0/1 to ethernet 0/4SwitchB-vlan4isolate-user-vlan enable ;vlan4是主vlanSwitchB-vlan4quitSwitchBisolate-user-vlan 4 secondary 2,3 ;vlan2,3是子vlan实验五 交换机的镜像与生成树(一) 设置镜像镜像是一个端口的数据被映射到另一个端口,进行数据分析。Quidwaymonitor-port e0/8 ;被镜像端口Quidwayport
18、 mirror e0/1 ;镜像端口或:Quidwayport mirror e0/1 to e0/2 observing-port e0/8 端口1,2镜像端口8(二) 生成树Quidwaystp enable|disableQuidwaystp priority 4096 设置交换机的优先级Quidwaystp root primary 设置交换机为树根Quidway-Ethernet0/1stp cost 200 设置交换机端口的花费实验七 直联路由system ;进入系统视图password: ;输入系统密码Quidwayinterface ethernet0 ;进入端口0Quidwa
19、y-Ethernet0ip addr 10.65.1.2 255.255.255.0 ;配置IP地址Quidway-Ethernet0undo shutdown ;打开端口0Quidway-Ethernet0int e1 ;进入端口1Quidway-Ethernet1ip addr 10.66.1.2 255.255.255.0Quidway-Ethernet1undo shutdownrootPCA root#ifconfig eth0 10.65.1.1 netmask 255.255.0.0 设置PC的IP地址和掩码rootPCB root#ifconfig eth0 10.66.1.1
20、 netmask 255.255.0.0rootPCA root#ping 10.65.1.2 (通,没有关只能ping直连的口)rootPCA root#ping 10.66.1.2 (不通,PCA 没有设置网关)rootPCA root#route add default gw 10.65.1.2rootPCA root#ping 10.66.1.2 (通)rootPCA root#ping 10.66.1.1 (不通,因PCB没有网关)rootPCB root#route add default gw 10.66.1.2rootPCA root#ping 10.66.1.1 (通)去掉计
21、算机Host B与Router的连线,再ping:rootPCA root#ping 10.66.1.2 不通(没有接线端口会自动down掉)再连接Host B与Router的连线,再ping:rootPCA root#ping 10.66.1.2 (通)实验八 单臂路由 设置PCA ip:10.65.1.1 gateway:10.65.1.2设置PCB ip:10.66.1.1 gateway:10.66.1.21.一个接口两个IP的情况systempassword:Quidwayinterface ethernet0Quidway-Ethernet0ip addr 10.65.1.2 25
22、5.255.255.0 ;设置端口0的IP地址Quidway-Ethernet0ip addr 10.66.1.2 255.255.255.0 secondary ;设置端口0的次IP地址Quidway-Ethernet0undo shutdown ;打开端口0rootPCA root#ping 10.66.1.1 通2划分两个子接口,对两个vlan的路由SwitchAvlan 2SwitchA-vlan2port e0/3SwitchAvlan 3SwitchA-vlan3port e0/6 SwitchAine e0/1 ;进入端口1SwitchA-Ethernet0/1port link
23、-type trunk ;设置端口链路类型为TRUNKSwitchA-Ethernet0/1port trunk permit vlan all ;此端口允许所有VLAN通过SwitchA-Ethernet0/1port trunk encap dot1q ;此端口允许802。1Q协议SwitchAdis currQuidwayint e0SwitchA-Ethernet0int e0.1 ;进入子端口1SwitchA-Ethernet0.1encapsulation dot1q 2 ;允许802。1Q协议,后面的2指的是VLAN ID,意思是子接口1可与交换机的vlan2通讯SwitchA-
24、Ethernet0.1ip addr 10.65.1.2 255.255.255.0 ;配置IP地址SwitchA-Ethernet0.1nudo shut ;打开子端口1SwitchA-Ethernet0.1int e0.2SwitchA-Ethernet0.2encapsulation dot1q 3SwitchA-Ethernet0.2ip addr 10.66.1.2 255.255.255.0SwitchA-Ethernet0.2nudo shutSwitchAdis currrootPCA root#ping 10.66.1.1 通实验九 静态路由实验 PCA:10.65.1.1
25、PCB:10.66.1.1 PCC:10.70.1.1 PCD:10.71.1.1RouterAinterface ethernet0RouterA-Ethernet0ip addrress 10.65.1.2 255.255.0.0RouterA-Ethernet0undo shutdownRouterA-Ethernet0int e1RouterA-Ethernet1ip addrress 10.66.1.2 255.255.0.0RouterA-Ethernet1undo shutdownRouterA-Ethernet1int s1RouterA-Serial1ip addrress
26、10.68.1.2 255.255.0.0RouterA-Serial1undo shutdownRouterA-Serial1clock rate 64000 ;配置该端口为DCE(时钟频率为64000)RouterA-Serial1quitRouterAip routing ;路由器路由使能RouterAdis currRouterBinterface ethernet0RouterB-Ethernet0ip addrress 10.70.1.2 255.255.0.0RouterB-Ethernet0undo shutdownRouterB-Ethernet0int e1RouterB-
27、Ethernet1ip addrress 10.71.1.2 255.255.0.0RouterB-Ethernet1undo shutdownRouterB-Ethernet1int s0RouterB-Serial0ip addrress 10.68.1.1 255.255.0.0RouterB-Serial0undo shutdownRouterB-Serial0quitRouterBip routingRouterBdis currrootPCA root#ifconfig eth0 10.65.1.1 netmask 255.255.0.0rootPCA root#route add
28、 default gw 10.65.1.2rootPCA root#ping 10.65.1.2 通rootPCA root#ping 10.66.1.2 通rootPCA root#ping 10.67.1.2 通rootPCA root#ping 10.68.1.2 不通rootPCA root#ping 10.69.1.2 不通RouterAip route-static 10.69.0.0 255.255.0.0 10.67.1.1 ;配置静态路由:去目的网络10.69.0.0下一跳地址为10.67.1.1rootPCA root#ping 10.69.1.1 通三个路由器的静态路由
29、(参考实验九图) 设置RouterA的IP:f0/0: 10.65.1.2 -PCA:10.65.1.1f0/1: 10.66.1.2 -PCB:10.66.1.1s0/0: 10.67.1.2s0/1: 10.68.1.2 -接RouterC s0/0 设置RouterC的IP:s0/0: 10.68.1.1 接RouterB s0/0 设置RouterB的IP:s0/0: 10.78.1.1 PCC:10.69.1.1f0/1: 10.70.1.2 -PCD:10.70.1.1 设置从PCA到PCC的静态路由ROAip routingROAip route-static 10.69.0.0 255.255.0.0 10.68.1.1ROAdisplay ip route ;显示当前路由表ROBip route-static 10.69.0.0 255.255.0.0 10.78.1.1ROBdisplay
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1