其实交换机的基本操作包括设置特权登陆密码
,
设置控制台的密码等都跟路由器几乎一样的
.
在这里就不详说了
.
主要是讲一下如何划分
VLAN,
为后面的实验打下基础
.
首先在交换机上划分出
VLAN
sw#vlan database
sw(vlan)#vlan 10 name A
VLAN 10 added:
Name: A
sw(vlan)#vlan 20 name B
VLAN 20 added:
Name: B
sw(vlan)#vlan 30 name C
VLAN 30 added:
Name: C
sw(vlan)#vlan 40 name D
VLAN 40 added:
Name: D
sw(vlan)#vlan 50 name E
VLAN 50 added:
Name: E
sw(vlan)#exit (
注意这里一定要用
exit
来退出
,
交换机才会自动保存配置
)
APPLY completed.
Exiting....
sw#show vlan?
vlan-switch vlans (
这里比较郁闷
,
用模拟器做实验没办法
,
只能用这两个命令查看
VLAN
的配置了
)
sw#show version
Cisco Internetwork Operating System Software
IOS (tm) 3600 Software (C3640-JSX-M), Version 12.3(20), RELEASE SOFTWARE (fc2)
Technical Support: [url]http://www.cisco.com/techsupport[/url]
Copyright (c) 1986-2006 by cisco Systems, Inc.
Compiled Tue 08-Aug-06 16:37 by kesnyder
Image text-base: 0x60008B00, data-base: 0x61FAA000
ROM: ROMMON Emulation Microcode
ROM: 3600 Software (C3640-JSX-M), Version 12.3(20), RELEASE SOFTWARE (fc2)
sw uptime is 7 minutes
System returned to ROM by unknown reload cause - suspect boot_data[BOOT_COUNT] 0x0, BOOT_COUNT 0, BOOTDATA 19
System image file is "tftp://255.255.255.255/unknown"
cisco 3640 (R4700) processor (revision 0xFF) with 91136K/7168K bytes of memory.
Processor board ID 00000000
R4700 CPU at 100MHz, Implementation 33, Rev 1.2
Bridging software.
X.25 software, Version 3.0.0 .
SuperLAT software (copyright 1990 by Meridian Technology Corp).
TN3270 Emulation software.
32 FastEthernet/IEEE 802.3 interface(s)
DRAM configuration is 64 bits wide with parity enabled.
125K bytes of non-volatile configuration memory.
8192K bytes of processor board System flash (Read/Write)
Configuration register is 0x2102
只能勉强凑合着做了
.
sw#show vlans
No Virtual LANs configured.
这个命令有点不懂
?
没有虚拟的
LAN
配置
?
在其它的交换机可能不会显示这样的结果
.
sw#show vlan-switch
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/0, Fa0/1, Fa0/2, Fa0/3
Fa0/4, Fa0/5, Fa0/6, Fa0/7
Fa0/8, Fa0/9, Fa0/10, Fa0/11
Fa0/12, Fa0/13, Fa0/14, Fa0/15
Fa1/0, Fa1/1, Fa1/2, Fa1/3
Fa1/4, Fa1/5, Fa1/6, Fa1/7
Fa1/8, Fa1/9, Fa1/10, Fa1/11
Fa1/12, Fa1/13, Fa1/14, Fa1/15
10 A
active
20 B active
30 C
active
40 D active
50 E active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 1002 1003
10 enet 100010 1500 - - - - - 0 0
20 enet 100020 1500 - - - - - 0 0
30 enet 100030 1500 - - - - - 0 0
40 enet 100040 1500 - - - - - 0 0
50 enet 100050 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 1 1003
1003 tr 101003 1500 1005 0 - - srb 1 1002
1004 fdnet 101004 1500 - - 1 ibm - 0 0
1005 trnet 101005 1500 - - 1 ibm - 0 0
可以看到已经建立的
VLAN
A
、B、C、D、
E
了
.
好了
,
下面看下怎样将接口划分到指定的
VLAN
sw#conf t
Enter configuration commands, one per line. End with CNTL/Z.
sw(config)#interface fa0/1
sw(config-if)#switchport access vlan 10
sw(config-if)#no shut (
将接口
Fa0/1
划分到
VLAN 10,
记得加上
no shut!)
其它的同样处理即可
sw(config)#int fa0/2
sw(config-if)#switchport access vlan 20
sw(config-if)#no shut
sw(config-if)#int fa0/3
sw(config-if)#switchport access vlan 30
sw(config-if)#no shut
sw(config-if)#int fa0/4
sw(config-if)#switchport access vlan 40
sw(config-if)#no shut
sw(config-if)#int fa0/5
sw(config-if)#switchport access vlan 50
sw(config-if)#no shut
sw#show vlans
No Virtual LANs configured.
sw#show vlan-switch
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/0, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa1/0
Fa1/1, Fa1/2, Fa1/3, Fa1/4
Fa1/5, Fa1/6, Fa1/7, Fa1/8
Fa1/9, Fa1/10, Fa1/11, Fa1/12
Fa1/13, Fa1/14, Fa1/15
10 A
active Fa0/1
20 B active Fa0/2
30 C
active Fa0/3
40 D active Fa0/4
50 E active Fa0/5
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 1002 1003
10 enet 100010 1500 - - - - - 0 0
20 enet 100020 1500 - - - - - 0 0
30 enet 100030 1500 - - - - - 0 0
40 enet 100040 1500 - - - - - 0 0
50 enet 100050 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 1 1003
1003 tr 101003 1500 1005 0 - - srb 1 1002
1004 fdnet 101004 1500 - - 1 ibm - 0 0
1005 trnet 101005 1500 - - 1 ibm - 0 0
我们可以看到
,
已经将接口划分到指定的
VLAN
了
.
接下来要配置的是给
VLAN
配置
IP
地址及默认网关
sw#conf t
Enter configuration commands, one per line. End with CNTL/Z.
sw(config)#int vlan 10
sw(config-if)#ip address 192.168.1.2 255.255.255.0
sw(config-if)#ip default-gateway 192.168.1.1
sw(config)#exit
应该是配置成功的了
,
只是在这里没相应的命令查看得到
.
记住一下就可以了
.
简单的交换机配置就说到这里了
.
也许你们会觉得太简单
,
这里才刚刚开始
,
交换机是相当复杂的设备
,
它不像路由器用
IOS
去配置
,
而是用集成电路板去工作的
.
后面学的东西多了就会知道交换机的配置没想象中的简单
.