配置详情:
version 12.2
no service pad
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname sw1 (更改交换机开头名称)
!
enable secret 5 $1$m7BL$nAc44ABIyctEt8Jq/ (设置默认登录密码--优先级高)
enable password cisco (设置登录密码--优先级低)
!
no aaa new-model
ip subnet-zero
ip routing (开启路由功能)
!
!
!
!
!
!
no file verify auto
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
interface FastEthernet0/1
no switchport
ip address 192.168.1.3 255.255.255.0
!
interface FastEthernet0/2
switchport mode dynamic desirable
!
interface FastEthernet0/3
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/4
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/5
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/6
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/7
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/8
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/9
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/10
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/11
switchport access vlan 30
switchport mode access
!
interface FastEthernet0/12
switchport access vlan 30
switchport mode access
!
interface FastEthernet0/13
switchport access vlan 30
switchport mode access
!
interface FastEthernet0/14
switchport access vlan 30
switchport mode access
!
interface FastEthernet0/15
switchport access vlan 40
switchport mode access
!
interface FastEthernet0/16
switchport access vlan 40
switchport mode access
!
interface FastEthernet0/17
switchport access vlan 40
switchport mode access
!
interface FastEthernet0/18
switchport access vlan 40
switchport mode access
!
interface FastEthernet0/19
switchport access vlan 40
switchport mode access
!
interface FastEthernet0/20
switchport access vlan 40
switchport mode access
!
interface FastEthernet0/21
switchport access vlan 40
switchport mode access
!
interface FastEthernet0/22
switchport access vlan 40
switchport mode access
!
interface FastEthernet0/23
switchport access vlan 50
switchport mode access
!
interface FastEthernet0/24
switchport access vlan 50
switchport mode access
!
interface FastEthernet0/25
switchport access vlan 50
switchport mode access
!
interface FastEthernet0/26
switchport access vlan 50
switchport mode access
!
interface FastEthernet0/27
switchport access vlan 60
switchport mode access
!
interface FastEthernet0/28
switchport access vlan 60
switchport mode access
!
interface FastEthernet0/29
switchport access vlan 60
switchport mode access
!
interface FastEthernet0/30
switchport access vlan 60
switchport mode access
!
interface FastEthernet0/31
switchport access vlan 60
switchport mode access
!
interface FastEthernet0/32
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/33
switchport access vlan 60
switchport mode access
!
interface FastEthernet0/34
switchport access vlan 60
switchport mode access
!
interface FastEthernet0/35
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/36
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/37
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/38
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/39
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/40
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/41
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/42
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/43
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/44
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/45
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/46
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/47
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/48
switchport access vlan 10
switchport mode access
!
interface GigabitEthernet0/1
switchport mode dynamic desirable
!
interface GigabitEthernet0/2
switchport mode dynamic desirable
!
interface Vlan1
no ip address
shutdown
!
interface Vlan10
ip address 192.168.10.1 255.255.255.0
ip access-group 1 in
!
interface Vlan20
ip address 192.168.20.1 255.255.255.0
ip access-group 1 in
!
interface Vlan30
ip address 192.168.30.1 255.255.255.0
ip access-group 1 in
!
interface Vlan40
ip address 192.168.40.1 255.255.255.0
ip access-group 1 in
!
interface Vlan50
ip address 192.168.50.1 255.255.255.0
ip access-group 1 in
!
interface Vlan60
ip address 192.168.60.1 255.255.255.0
ip access-group 1 in
!
ip classless
ip route 0.0.0.0 0.0.0.0 192.168.1.1
ip route 0.0.0.0 0.0.0.0 FastEthernet0/1
ip http server
ip http secure-server
!
!
control-plane
!
!
line con 0
line vty 0 4
password cisco
no login
line vty 5 15
no login
!
!
设置镜像口(监测口)
monitor session 1 source interface Fa0/1 (源)
monitor session 1 destination interface Fa0/2 (目标)
!
!
end
查看vlan信息
sw1#show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/2, Gi0/1, Gi0/2
10 vlan10 active Fa0/32, Fa0/35, Fa0/36, Fa0/37
Fa0/38, Fa0/39, Fa0/40, Fa0/41
Fa0/42, Fa0/43, Fa0/44, Fa0/45
Fa0/46, Fa0/47, Fa0/48
20 vlan20 active Fa0/3, Fa0/4, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
30 vlan30 active Fa0/11, Fa0/12, Fa0/13, Fa0/14
40 vlan40 active Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
50 vlan50 active Fa0/23, Fa0/24, Fa0/25, Fa0/26
60 vlan60 active Fa0/27, Fa0/28, Fa0/29, Fa0/30
Fa0/31, Fa0/33, Fa0/34
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
sw1#