企业网络搭建与应用-交换机的配置与管理

 任务一  交换机的端口配置

    用户会在首次配置交换机或者当交换机的配置出现变更,导致带内管理失效时,需要使用带外管理对交换机进行配置。例如,用户希望通过远程TelnetHTTP来访问交换机时,必须首先通过Console口给交换机配置一个IP地址。 下面以思科模拟器Cisco Packet为例进行说明和演示。

步骤1  Console线的一端与计算机的RS-232串口相连;另一端与交换机的Console口相连 

      

步骤2  连接成功后, 进行初始设置。点击PC0>单击Terminal.

 

 步骤 3  在“每秒位数”下拉列表中选择“9600”,在“数据位”下拉列表中选择“8”,在“奇偶校验”下拉列表中选择“无”,在“停止位”下拉列表中选择“1”,在“数据流控制”下拉列表中选择“无”,单击“确定"或OK“”按钮

 步骤4   这时,系统会打开超级终端连接窗口,按<Enter>键,进入交换机CLICommand Line Interface,命令行界面)。

 步骤5  配置交换机IP地址。在进行带内管理之前,必须通过带外管理配置交换机的IP地址,代码如下:

Switch>enable                  				//进入特权模式
Switch#config terminal           			//进入全局配置模式
Switch(config)#interface vlan 1                        //进入vlan1接口配置模式
Switch(config-if)#ip address 10.1.128.235 255.255.255.0
					//为vlan1分配IP地址和网络掩码
Switch(config-if)#no shutdown                        	//开启vlan 1端口
Switch(config-if)#exit                               		//退出接口配置模式

CLI运行截图如下:

 任务二  交换机的VLAN划分

信科上海分公司的财务部和客服部位于同一楼层,所有信息端口都连接在一台交换机上。为了保证两个部门网络的相对独立,不影响内部的通信效率,需要划分VLAN,使这2个部门处于不同的VLAN内,网络拓扑图如下图所示。具体操作如下:

 

 步骤1  规划交换机的VLAN及端口,分配计算机的IP地址,如表所示。

表1  划分交换机的VLAN、端口与计算机的IP地址 

 

 

 

 

 步骤2  交换机上创建VLAN并验证,代码如下:

Switch>enable
Switch#configure terminal
Switch(config)#vlan 10                       //创建vlan 10
Switch(config-vlan)#name AD           //设置vlan10的名字为AD
Switch(config-vlan)#exit                    //退出vlan配置模式
Switch(config)#vlan 20                      //创建vlan 20
Switch(config-vlan)#name FD           //设置vlan 20的名字为FD
Switch(config-vlan)#exit                    //退出vlan配置模式
Switch(config)#                        	//退出全局配置模式

CLI具体执行指令图如下:

 提示:如果我们要验证VLAN是否配置成功,可在命令行输入命令“show vlan后按【Enter】键。

步骤3  VLAN添加端口,代码如下: 

Switch(config)#inter range f0/1-8                                	//进入端口配置模式
Switch(config-if-range)#switchport access vlan 10
						//为端口1-8分配vlan 10 
Switch(config-if-range)#ex
Switch(config)#inter range f0/9-15
Switch(config-if-range)#switchport access vlan 20  
						//为端口9-15分配 vlan 20
Switch(config-if-range)#ex
Switch(config)#

CLI具体执行指令图如下: 

 

 步骤4  验证互通性,如表所示。

拓展说明:

 表 2

 任务三  交换机间的相同VLAN的通信

 步骤1  隔离交换机端口,拓扑图如图所示。

 

 步骤2  SW0上创建VLAN,代码如下:

Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#na
Switch(config-vlan)#name HR
Switch(config-vlan)#ex
Switch(config)#

 

为端口分配VLAN 

 

Switch(config)#inter f0/1
Switch(config-if)#sw
Switch(config-if)#switchport acc
Switch(config-if)#switchport access vlan 10
Switch(config-if)#ex
Switch(config)#

 步骤3-4   SW1上创建VLAN,将SW1的端口分配到VLAN中代码如下:

Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#name HR
Switch(config-vlan)#ex
Switch(config)#vlan 20
Switch(config-vlan)#na
Switch(config-vlan)#name FD
Switch(config-vlan)#ex
Switch(config)#inter ran
Switch(config)#inter range f0/1-10
Switch(config-if-range)#swi
Switch(config-if-range)#switchport acc
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#ex
Switch(config)#inter range f0/11-22
Switch(config-if-range)#switchport access vlan 20
Switch(config-if-range)#ex
Switch(config)#

 

步骤  交换机SW1SW2相连的端口定义为中继模式,代码如下: 

 

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#inter f0/24
Switch(config-if)#switchport mode trunk 

Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up

Switch(config-if)#no shutdown 
Switch(config-if)#ex
Switch(config)#

 注:SW1的配置与SW1相同

 

Switch(config)#inter f0/24
Switch(config-if)#switchport mode trunk 
Switch(config-if)#no shut
Switch(config-if)#ex
Switch(config)#

 

 

 

 步骤6  验证人事部的计算机可以互相通信,表示实现跨交换机相同VLAN通信

 

猜你喜欢

转载自blog.csdn.net/qq_24526483/article/details/126821366