Cisco Packer Tracer 组建虚拟局域网(VLAN)
实验目的:
1、安装Cisco Packer Tracer
2、了解Cisco Packet Tracer软件界面功能
3、利用Cisco Packet Tracer 组建虚拟局域网(VLAN)
实验设备:
Switch_2960 2台;PC 4台;直连线
实验步骤:
1.选择网络设备
2.选择交换机
3.将其拖入到面板中
4.选择端设备
5.在端设备选项中选择PC并拖入到面板中
6.选择连接选项
7.可以选择直通线,将两台PC的FastEthernet口连接到交换机,选择交叉线连接两台交换机。也可以让系统自动选择连接的线类型
8.连接好后设备连线出将会变为绿色
9.选择窗体右边菜单place Note ,在窗体内单击,可以输入文字备注
10.配置相关参数
Switch0:
Switch>enableSwitch#configure terminalSwitch(config)#vlan 10 Switch(config-vlan)#exitSwitch(config)#vlan 20Switch(config-vlan)#exitSwitch(config)#interface fastEthernet 0/1Switch(config-if)#switchport mode accessSwitch(config-if)#switchport access vlan 10Switch(config-if)#exitSwitch(config)#interface fastEthernet 0/2Switch(config-if)#switchport mode accessSwitch(config-if)#switchport access vlan 20Switch(config-if)#exitSwitch(config)#interface fastEthernet 0/3Switch(config-if)#switchport mode trunkSwitch(config-if)#switchport trunk allowed vlan allSwitch(config-if)#exitSwitch(config)#exitSwitch#write
Switch1:
Switch>enableSwitch#configure terminalSwitch(config)#hostname Sw2Sw2(config)#vlan 10 Sw2(config-vlan)#exitSw2(config)#vlan 20Sw2(config-vlan)#exitSw2(config)#interface fastEthernet 0/1Sw2(config-if)#switchport mode accessSw2(config-if)#switchport access vlan 10Sw2(config-if)#exitSw2(config)#interface fastEthernet 0/2Sw2(config-if)#switchport mode accessSw2(config-if)#switchport access vlan 20Sw2(config-if)#exitSw2(config)#interface fastEthernet 0/3Sw2(config-if)#switchport mode trunkSw2(config-if)#switchport trunk allowed vlan allSw2(config-if)#exitSwitch(config)#exitSw2#write
11.配置pc机地址
PC0
IP: 192.168.1.10
Submask: 255.255.255.0
Gateway: 192.168.1.1
PC1
IP: 192.168.1.11
Submask: 255.255.255.0
Gateway: 192.168.1.1
PC2
IP: 192.168.1.12
Submask: 255.255.255.0
Gateway: 192.168.1.1
PC3
IP: 192.168.1.13
Submask: 255.255.255.0
Gateway: 192.168.1.1
11、测试电脑连通性
结论:
相同vlan之间可以通信,不同vlan之间不可以通信
思科交换机路由器通过命令行接口(Command Line Interface, CLI) 进行配置操作的基本方法如下:
1. 查看用户配置模式下的基本命令。
当进入交换机的“命令行”界面时,按一下键盘上的“Enter”键就进入了交换机的用户配置模式。在该模式下可以查看交换机的软、硬件版本信息,并进行简单的测试。它的提示符为“>”,在该模式下可用的命令比较少,使用“?”命令可显示该模式下的所有命令。
Switch> ?
Exec commands:
<1-99> Session number to resume
connect Open a terminal connection
disconnect Disconnect an existing network connection
enable Turn on privileged commands
exit Exit from the EXEC
logout Exit from the EXEC
ping Send echo messages
resume Resume an active network connection
show Show running system information
telnet Open a telnet connection
terminal Set terminal line parameters
traceroute Trace route to destination
2. 查看特权模式下的基本命令。
特权模式下可对交换机的配置文件进行管理,查看交换机的配置信息,进行网络的测试和调试等。在用户配置模式下键入“enable”命令进入特权模式。特权模式的提示符为“#”。使用“?”命令可查看该模式下的所有命令。
Switch>
Switch>enable
Switch#?
Exec commands:
<1-99> Session number to resume
clear Reset functions
clock Manage the system clock
configure Enter configuration mode
connect Open a terminal connection
copy Copy from one file to another
debug Debugging functions (see also 'undebug')
delete Delete a file
dir List files on a filesystem
disable Turn off privileged commands
disconnect Disconnect an existing network connection
enable Turn on privileged commands
erase Erase a filesystem
exit Exit from the EXEC
logout Exit from the EXEC
more Display the contents of a file
no Disable debugging informations
ping Send echo messages
reload Halt and perform a cold restart
resume Resume an active network connection
setup Run the SETUP command facility
show Show running system information
telnet Open a telnet connection
terminal Set terminal line parameters
traceroute Trace route to destination
undebug Disable debugging functions (see also 'debug')
vlan Configure VLAN parameters
write Write running configuration to memory, network, or terminal
3. 查看全局配置模式下基本命令。
全局配置模式下可以配置交换机的全局性参数。在特权模式下输“configure terminal”或者“conf t”就可以进入全局配置模式。全局配置模式也称为“config”模式,使用“?”命令可查看改模式下的所有命令。
Switch# conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#?
Configure commands:
banner Define a login banner
boot Boot Commands
cdp Global CDP configuration subcommands
clock Configure time-of-day clock
do To run exec commands in config mode
enable Modify enable password parameters
end Exit from configure mode
exit Exit from configure mode
hostname Set system's network name
interface Select an interface to configure
ip Global IP configuration subcommands
line Configure a terminal line
mac-address-table Configure the MAC address table
no Negate a command or set its defaults
port-channel EtherChannel configuration
service Modify use of network based services
spanning-tree Spanning Tree Subsystem
username Establish User Name Authentication
vlan Vlan commands
vtp Configure global VTP state
4. 查看端口配置模式下的命令。
端口配置模式下可以对交换机的端口进行参数配置。一般交换机都拥有很多窗口,还可以添加不同的模块。默认情况下,交换机的所有端口都为以太网接口类型。进入端口配置模式,可以使用“interface Ethernet 0/1”命令。其中, interface 为进入端口命令; ethernet 表示以太网; 0/1 表示端口编号。使用“?”可查看该模式下的所有命令。
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#?
cdp Global CDP configuration subcommands
channel-group Etherchannel/port bundling configuration
channel-protocol Select the channel protocol (LACP, PAgP)
description Interface specific description
duplex Configure duplex operation.
exit Exit from interface configuration mode
mac-address Manually set interface MAC address
no Negate a command or set its defaults
shutdown Shutdown the selected interface
spanning-tree Spanning Tree Subsystem
speed Configure speed operation.
switchport Set switching mode characteristics
Switch(config-if)#
5. 模式之间的切换。
交换机各模式之间的切换可通过“exit”和“end”命令完成。
Switch>enable Switch#configure terminal Switch(config)#interface fastEthernet 0/5 Switch(config-if)#exit Switch(config)#end Switch# | !进入特权模式 !进入全局配置模式 !进入交换机 F 0/5 的接口配置模式 !退回到上一级操作模式 !直接退回到特权模式 |
6. 撤销某个命令。
no