Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | Email

第 6 章 Switch

目錄

6.1. 交換機初始化
6.1.1. 密碼設置
6.1.2. 域名,網管
6.1.3. Telnet
6.1.3.1. privilege level
6.1.4. 保存當前配置
6.1.5. 恢復交換機出廠值
6.2. interface
6.2.1. show interfaces status
6.2.2. ip address
6.2.3. 配置連接埠速率及雙工模式
6.2.4. range
6.2.5. 連接埠隔離
6.3. DHCP
6.3.1. Gateway
6.3.2. snooping
6.3.3. DHCP中繼代理
6.4. Route port
6.5. 交換機連接埠鏡像配置
6.6. Ethernet Port Groups
6.6.1. LACP
6.6.2. desirable
6.7. VLAN
6.7.1. vlan database
6.7.2. 兩層Switch配置講解
6.7.3. 3 Layer Switch
6.7.4. VTP
6.7.4.1. Configuring a VTP Server
6.7.4.2. Configuring a VTP Client
6.7.4.3. example for vtp
6.8. ACL
6.9. 流量控制
6.9.1. 粗糙的流量限制
6.9.2. bandwidth
6.9.3. priority
6.10. stack-manager
6.11. HSRP(Hot Standby Router Protocol)
6.12. CDP (Cisco Discovery Protocol)
6.12.1. clear cdp counters
6.12.2. show cdp
6.12.3. show cdp entry
6.12.4. show cdp interface
6.12.5. show cdp neighbors
6.13. 4506/4507 專有命令
6.13.1. 用戶認證
6.13.2. PoE
6.13.3. show module
6.14. Switch Config Example
6.14.1. VLan Router
6.14.1.1. VLAN間DHCP
6.14.1.2. 多vlan與vlan間路由,並且每個vlan配合一個DHCP池,所有vlan均能訪問internet
6.14.2. VLAN下聯Switch
6.14.3. LAN to LAN
6.14.4. Cisco 2811 Router + 2960 Switch
6.14.4.1. running-config
6.14.5. Cisco Catalyst 3750 series DHCP + VLAN + Routing Example
6.14.6. Cisco Catalyst 3750 + Cisco Catalyst 2960 VTP Example
6.14.6.1. VTP Server
6.14.6.2. VTP Client
6.14.6.3. Cisco Config File

Cisco 固定配置交換機命名規則

對於Cisco的固定配置的交換機,一般有3750,3550,3560,2960,2970這幾個系列。

它們在型號命令上有自己相應的規則,特總結如下:

eg: WS-C3750G-48TS-S

C3750表明這款產品屬於3750這個系列,也就是產品的型號。

G----表明其所有介面都是支持千兆或以上,如果沒有這個就表明其主要連接埠都是10/100M的或者100M的

48----表明其擁有主要的連接埠數量為48個

T----表明其主要連接埠是電口(也就是所謂的Twirst Pair的連接埠

P----表明其主要連接埠是電口,同時支持PoE乙太網供電

S----表明其帶的擴展的介面為SFP類型的介面

最後部分的-S表明交換機帶的軟件是SMI標準影像的,-E表明是EMI影像的
	

6.1. 交換機初始化

Cisco Catalyst 2960 Series Switches

		
Press RETURN to get started!


*Mar  1 00:00:25.073: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, cha                                                                                                 nged state to down
*Mar  1 00:00:26.189: %SPANTREE-5-EXTENDED_SYSID: Extended SysId enabled for typ                                                                                                 e vlan
*Mar  1 00:00:47.102: %SYS-5-RESTART: System restarted --
Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(44)SE6, REL                                                                                                 EASE SOFTWARE (fc1)
Copyright (c) 1986-2009 by Cisco Systems, Inc.
Compiled Mon 09-Mar-09 18:10 by gereddy


         --- System Configuration Dialog ---

Would you like to enter the initial configuration dialog? [yes/no]:
Would you like to enter the initial configuration dialog? [yes/no]: yes

At any point you may enter a question mark '?' for help.
Use ctrl-c to abort configuration dialog at any prompt.
Default settings are in square brackets '[]'.


Basic management setup configures only enough connectivity
for management of the system, extended setup will ask you
to configure each interface on the system

Would you like to enter basic management setup? [yes/no]: yes
Configuring global parameters:

  Enter host name [Switch]:

  The enable secret is a password used to protect access to
  privileged EXEC and configuration modes. This password, after
  entered, becomes encrypted in the configuration.
  Enter enable secret: chen

  The enable password is used when you do not specify an
  enable secret password, with some older software versions, and
  some boot images.
  Enter enable password: chen
% Please choose a password that is different from the enable secret
  Enter enable password: chen

  The virtual terminal password is used to protect
  access to the router over a network interface.
  Enter virtual terminal password: chen
  Configure SNMP Network Management? [no]: yes
    Community string [public]:

Current interface summary

Interface              IP-Address      OK? Method Status                Protocol
Vlan1                  unassigned      YES unset  up                    down
FastEthernet0/1        unassigned      YES unset  down                  down
FastEthernet0/2        unassigned      YES unset  down                  down
FastEthernet0/3        unassigned      YES unset  down                  down
FastEthernet0/4        unassigned      YES unset  down                  down
FastEthernet0/5        unassigned      YES unset  down                  down
FastEthernet0/6        unassigned      YES unset  down                  down
FastEthernet0/7        unassigned      YES unset  down                  down
FastEthernet0/8        unassigned      YES unset  down                  down
FastEthernet0/9        unassigned      YES unset  down                  down
FastEthernet0/10       unassigned      YES unset  down                  down
FastEthernet0/11       unassigned      YES unset  down                  down
FastEthernet0/12       unassigned      YES unset  down                  down
FastEthernet0/13       unassigned      YES unset  down                  down
FastEthernet0/14       unassigned      YES unset  down                  down
FastEthernet0/15       unassigned      YES unset  down                  down
FastEthernet0/16       unassigned      YES unset  down                  down
FastEthernet0/17       unassigned      YES unset  down                  down
FastEthernet0/18       unassigned      YES unset  down                  down
FastEthernet0/19       unassigned      YES unset  down                  down
FastEthernet0/20       unassigned      YES unset  down                  down
FastEthernet0/21       unassigned      YES unset  down                  down
FastEthernet0/22       unassigned      YES unset  down                  down
FastEthernet0/23       unassigned      YES unset  down                  down
FastEthernet0/24       unassigned      YES unset  down                  down
GigabitEthernet0/1     unassigned      YES unset  down                  down
GigabitEthernet0/2     unassigned      YES unset  down                  down

Enter interface name used to connect to the
management network from the above interface summary: FastEthernet0/24

Configuring interface FastEthernet0/24:
  Configure IP on this interface? [no]: yes
    IP address for this interface: 172.16.0.253
    Subnet mask for this interface [255.255.0.0] :
    Class B network is 172.16.0.0, 16 subnet bits; mask is /16
Would you like to enable as a cluster command switch? [yes/no]: yes
Enter cluster name: cl1

The following configuration command script was created:

hostname Switch
enable secret 5 $1$W1RW$ZdWR.sS/g2RwJMv4F5sRq0
enable password chen
line vty 0 15
password chen
snmp-server community public
!
!
interface Vlan1
shutdown
no ip address
!
interface FastEthernet0/1
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
 --More--

		
		

6.1.1. 密碼設置

基本操作

Switch command
Switch > en 進入特權模式
Switch # conf t 進入全局配置模式
Switch(config)# interface interface-num 進入介面
Switch(config)# hostname name 給交換機命名
Switch(config)# enable password password 設置明文密碼
Switch(config)# enable secret password 設置加密的啟用秘密口令。如果設置則取代明文口令
Switch # copy running-config startup-config
Switch # write 保存設置
			

6.1.2. 域名,網管

初始化設置

Switch setup
switch(config)# ip default-gateway ip-address
switch(config)# ip domain-name domain-name
switch(config)# ip name-server IP-address 交換機上設置遠程訪問,用於交換機管理
			

6.1.3. Telnet

通過Telnet進入命令行介面

Switch>enable
Switch#conf t
Switch(config)#line vty 0 4
Switch(config-line)#login
Switch(config-line)#password cisco
			

6.1.3.1. privilege level

line vty 5 15
 privilege level 15
 password neo
 login
!
				

6.1.4. 保存當前配置

Save

Switch#wr
Building configuration...
[OK]
			

6.1.5. 恢復交換機出廠值

Switch# erase startup-config