全部博文(1015)
分类: 系统运维
2011-11-16 09:56:42
Switch# configure terminal
Switch(config)# hostname SH-CXXX-WS3560
SH-CXXX-WS3560(config)# vtp mode transparent
SH-CXXX-WS3560(config)# enable password xxxxxxxx
SH-CXXX-WS3560(config)# line vty 0 4
SH-CXXX-WS3560(config-line)# password xxxxxxxx
SH-CXXX-WS3560(config-line)#login
SH-CXXX-WS3560(config-line)# exit
SH-CXXX-WS3560(config)#vlan 3020
SH-CXXX-WS3560(config-vlan)#vlan 80
SH-CXXX-WS3560(config-vlan)#vlan 81
SH-CXXX-WS3560(config-vlan)# vlan 82
SH-CXXX-WS3560(config-vlan)# vlan 83
SH-CXXX-WS3560(config-vlan)# vlan 84
SH-CXXX-WS3560(config-vlan)# vlan 85
SH-CXXX-WS3560(config-vlan)# vlan 86
SH-CXXX-WS3560(config-vlan)# vlan 87
SH-CXXX-WS3560(config-vlan)#exit // 这里一定要exit 退出。
SH-CXXX-WS3560(config)# int vlan 3020
SH-CXXX-WS3560(config-if)# ip address 10.31.255.34 255.255.255.252
SH-CXXX-WS3560(config-if)# no shut
SH-CXXX-WS3560(config-if)# exit
SH-CXXX-WS3560(config)# int range F0/23 – 24
SH-CXXX-WS3560(config-if-range)# switchport mode access
SH-CXXX-WS3560(config-if-range)# switchport access vlan 3020
SH-CXXX-WS3560(config-if-range)#exit
SH-CXXX-WS3560(config)# int vlan 80
SH-CXXX-WS3560(config-if)# ip address 10.1.80.1 255.255.255.0
SH-CXXX-WS3560(config-if)#no shutdown
SH-CXXX-WS3560(config-if)# int vlan 81
SH-CXXX-WS3560(config-if)#ip add 10.1.81.1 255.255.255.0
SH-CXXX-WS3560(config-if)#no sh
SH-CXXX-WS3560(config-if)#int vlan 82
SH-CXXX-WS3560(config-if)#ip add 10.1.82.1 255.255.255.0
SH-CXXX-WS3560(config-if)#no sh
SH-CXXX-WS3560(config-if)#int vlan 83
SH-CXXX-WS3560(config-if)# ip add 10.1.83.1 255.255.255.0
SH-CXXX-WS3560(config-if)#no sh
SH-CXXX-WS3560(config-if)#int vlan 84
SH-CXXX-WS3560(config-if)#ip add 10.1.84.1 255.255.255.0
SH-CXXX-WS3560(config-if)#no sh
SH-CXXX-WS3560(config-if)#int vlan 85
SH-CXXX-WS3560(config-if)# ip add 10.1.85.1 255.255.255.0
SH-CXXX-WS3560(config-if)# no sh
SH-CXXX-WS3560(config-if)# int vlan 86
SH-CXXX-WS3560(config-if)# ip add 10.1.86.1 255.255.255.0
SH-CXXX-WS3560(config-if)# no sh
SH-CXXX-WS3560(config-if)# int vlan 87
SH-CXXX-WS3560(config-if)# ip add 10.1.87.254 255.255.255.0
SH-CXXX-WS3560(config-if)# no sh
SH-CXXX-WS3560(config-if)#exit
SH-CXXX-WS3560(config)# int rang F0/1 – 6
SH-CXXX-WS3560(config-if-range)# switchport mode access
SH-CXXX-WS3560(config-if-range)# switchport access vlan 80
SH-CXXX-WS3560(config-if-range)#exit
SH-CXXX-WS3560(config-)# int range F0/7 – 10
SH-CXXX-WS3560(config-if-range)# switchport mode access
SH-CXXX-WS3560(config-if-range)#switchport access vlan 86
SH-CXXX-WS3560(config-if-range)#exit
SH-CXXX-WS3560(config)# int range F0/11-14
SH-CXXX-WS3560(config-if-range)# switchport mode access
SH-CXXX-WS3560(config-if-range)#switchport access vlan 81
SH-CXXX-WS3560(config-if-range)#exit
SH-CXXX-WS3560(config)# int range F0/15-18
SH-CXXX-WS3560(config-if-range)# switchport mode access
SH-CXXX-WS3560(config-if-range)#switchport access vlan 82
SH-CXXX-WS3560(config-if-range)#exit
SH-CXXX-WS3560(config)# int range F0/19-20
SH-CXXX-WS3560(config-if-range)# switchport trunk encapsulation dot1q
SH-CXXX-WS3560(config-if-range)# switchport mode trunk
SH-CXXX-WS3560(config-if-range)# switchport trunk allowed vlan 1,87,82,84,85
SH-CXXX-WS3560(config-if-range)#exit
SH-CXXX-WS3560(config)# int range F0/21-22
SH-CXXX-WS3560(config-if-range)# switchport trunk encapsulation dot1q
SH-CXXX-WS3560(config-if-range)# switchport mode trunk
SH-CXXX-WS3560(config-if-range)# switchport trunk allowed vlan 1,87,82,83
SH-CXXX-WS3560(config-if-range)#exit
SH-CXXX-WS3560(config)# ip routing
SH-CXXX-WS3560(config)# ip route 0.0.0.0 0.0.0.0 10.31.255.33
SH-CXXX-WS3560(config)# snmp-server community shjyro ro
SH-CXXX-WS3560(config)# snmp-server community shjyrw rw
SH-CXXX-WS3560(config)# snmp-server host 10.0.9.5 shjyro
SH-CXXX-WS3560(config)# snmp-server enable traps
SH-CXXX-WS3560(config)#logging buffered
SH-CXXX-WS3560(config)#logging host 10.0.9.5
SH-CXXX-WS3560(config)#logging source-interface vlan 3020
以下是城西小学接入交换机按以上配置后show run的实例:
shcxxx-ws3560v2#show run
Building configuration...
Current configuration : 4964 bytes
!
version 12.2
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname shcxxx-ws3560v2
!
boot-start-marker
boot-end-marker
!
enable password xxxxxxxx
!
no aaa new-model
system mtu routing 1500
vtp mode transparent
ip subnet-zero
ip routing
!
spanning-tree mode pvst
spanning-tree etherchannel guard misconfig
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
vlan 80-87,3020
!
interface FastEthernet0/1
switchport access vlan 80
switchport mode access
!
interface FastEthernet0/2
switchport access vlan 80
switchport mode access
!
interface FastEthernet0/3
switchport access vlan 80
switchport mode access
!
interface FastEthernet0/4
switchport access vlan 80
switchport mode access
!
interface FastEthernet0/5
switchport access vlan 80
switchport mode access
!
interface FastEthernet0/6
switchport access vlan 80
switchport mode access
!
interface FastEthernet0/7
switchport access vlan 86
switchport mode access
!
interface FastEthernet0/8
switchport access vlan 86
switchport mode access
!
interface FastEthernet0/9
switchport access vlan 86
switchport mode access
!
interface FastEthernet0/10
switchport access vlan 86
switchport mode access
!
interface FastEthernet0/11
switchport access vlan 81
switchport mode access
!
interface FastEthernet0/12
switchport access vlan 81
switchport mode access
!
interface FastEthernet0/13
switchport access vlan 81
switchport mode access
!
interface FastEthernet0/14
switchport access vlan 81
switchport mode access
!
interface FastEthernet0/15
switchport access vlan 82
switchport mode access
!
interface FastEthernet0/16
switchport access vlan 82
switchport mode access
!
interface FastEthernet0/17
switchport access vlan 82
switchport mode access
!
interface FastEthernet0/18
switchport access vlan 82
switchport mode access
!
interface FastEthernet0/19
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 1,82,84,85,87
switchport mode trunk
!
interface FastEthernet0/20
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 1,82,84,85,87
switchport mode trunk
!
interface FastEthernet0/21
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 1,82,83,87
switchport mode trunk
!
interface FastEthernet0/22
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 1,82,83,87
switchport mode trunk
!
interface FastEthernet0/23
switchport access vlan 3020
switchport mode access
!
interface FastEthernet0/24
switchport access vlan 3020
switchport mode access
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
no ip address
!
interface Vlan80
ip address 10.1.80.1 255.255.255.0
!
interface Vlan81
ip address 10.1.81.1 255.255.255.0
!
interface Vlan82
ip address 10.1.82.1 255.255.255.0
!
interface Vlan83
ip address 10.1.83.1 255.255.255.0
!
interface Vlan84
ip address 10.1.84.1 255.255.255.0
!
interface Vlan85
ip address 10.1.85.1 255.255.255.0
!
interface Vlan86
ip address 10.1.86.1 255.255.255.0
!
interface Vlan87
ip address 10.1.87.254 255.255.255.0
!
interface Vlan3020
ip address 10.31.255.34 255.255.255.252
!
ip classless
ip route 0.0.0.0 0.0.0.0 10.31.255.33
ip http server
ip http secure-server
!
logging source-interface Vlan3020
logging 10.0.9.5
snmp-server community shjyro RO
snmp-server community shjyrw RW
snmp-server enable traps snmp authentication linkdown linkup coldstart warmstart
snmp-server enable traps transceiver all
snmp-server enable traps tty
snmp-server enable traps eigrp
snmp-server enable traps cluster
snmp-server enable traps entity
snmp-server enable traps cpu threshold
snmp-server enable traps power-ethernet group 1
snmp-server enable traps power-ethernet police
snmp-server enable traps rep
snmp-server enable traps vtp
snmp-server enable traps vlancreate
snmp-server enable traps vlandelete
snmp-server enable traps flash insertion removal
snmp-server enable traps port-security
snmp-server enable traps auth-framework sec-violation
snmp-server enable traps dot1x auth-fail-vlan guest-vlan no-auth-fail-vlan no-gu
est-vlan
snmp-server enable traps envmon fan shutdown supply temperature status
snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-c
hange inconsistency
snmp-server enable traps config-copy
snmp-server enable traps config
snmp-server enable traps config-ctid
snmp-server enable traps hsrp
snmp-server enable traps energywise
snmp-server enable traps bridge newroot topologychange
snmp-server enable traps stpx inconsistency root-inconsistency loop-inconsistenc
y
snmp-server enable traps syslog
snmp-server enable traps mac-notification change move threshold
snmp-server enable traps vlan-membership
snmp-server enable traps errdisable
snmp-server host 10.0.9.5 shjyro
!
control-plane
!
line con 0
line vty 0 4
password xxxxxxxx
login
line vty 5 15
login
!
end
shcxxx-ws3560v2#