交换机及其配置相关代码

  • 格式:docx
  • 大小:20.85 KB
  • 文档页数:4
(将端口f0/24划分在248号vlan中)
命令格式:
set vlan <vlan-num> <mod/port>
Switch-PHY-6500>(enable) setvlan 42 5/20
VLAN Trunk配置
1、进入交换机端口配置模式
Switch-PHY-3548 # configure t
Switch-PHY-3548(config-if) # switchport trunk encapsulation isl (封装ISL协议)
Switch-PHY-3548(config-if) # switchport trunk encapsulation negotiate P (自动协商)
Switch-PHY-3548 (vlan )# vexit
4、删除VLAN
Switch-PHY-3548 (vlan )# no vlan 1000
5、修改VLAN
Switch-PHY-3548 (vlan )# vlan 100 name v1000
1、建立VLAN
命令格式:
set vlan <vlan ID> name <vlan_name>
Switch-PHY-6500>(enable) set port duplex5/1 half(设置为半双工)
Switch-PHY-6500>(enable) set port duplex5/1-24 half
4、配置交换机端口的传输速率
1、进入端口配置模式
Switch-PHY-3548(config) # interface f0/24
2、配置缺省路由:
Switch-PHY-6500>(enable) set ip route 0.0.0.0 203.105.1.1
交换机端口配置
1、配置交换机的端口描述
1、进入端口配置模式
Switch-PHY-3548(config) # interface f0/24
2、配置端口描述信息Switch-PHY-3548(config-if) # descripition To-lib
Switch-PHY-3548(config) # ip default-gateway 203.105.1.1
1、配置IP地址:
命令格式:
set interface sc0 <ip_addr> <ip_mask> <ip_addr>(广播地址,可选)
Switch-PHY-6500>(enable) set interface sc0 203.105.1.63 255.255.255.0 203.105.1.255
为交换机端口分配vlan
1、进入交换机端口配置模式
Switch-PHY-3548 # configure t
Switch-PHY-3548(config) # interface f0/24
2、为端口分配VLAN
命令格式:
switchport access vlan <vlan-num>
Switch-PHY-3548(config-if) # switchport access vlan 248
set port duplex <mod/port> full
set port duplex <mod/port> half
Switch-PHY-6500>(enable) set port duplex5/1 full(设置为全双工)
Switch-PHY-6500>(enable) set port duplex5/1-24 full
命令格式: spanning-tree vlan <vlan> (启用STP)
no spanning-tree vlan <vlan> (关闭STP)
Switch-PHY-3548(config) # spanning-tree vlan 3
Switch-PHY-3548(config) #no spanning-tree vlan 3
Switch-PHY-6500>(enable) set port enable 4/5
Switch-PHY-6500>(enable) set port disable 4/5
3、配置交换机端口的通信方式
1、进入端口配置模式
Switch-PHY-3548(config) # interface f0/24
2、配置端口通信方式Switch-PHY-3548(config-if) # duplex auto(自适应)
Switch-PHY-3548(config-if) # duplex full(全双工) Switch-PHY-3548(config-if) # duplex half(半双工)
命令格式:
Switch-PHY-6500>(enable) settrunk 5/1 on dot1q
Switch-PHY-6500>(enable) settrunk 5/1 vlan 37-42
Switch-PHY-6500>(enable)clear trunk 5/24 3-36
交换机STP的配置
打开或关闭STP
5、配置设备管理地址(IP地址)与缺省路由(默认路由)
1、配置IP地址:
Switch-PHY-3548(config) # interface VLAN 1
Switch-PHY-3548(config-if) # ip address 203.105.1.62 255.255.255.0
2、配置缺省路由:
Switch-PHY-6500>(enable) setvlan 999 name vlan999
2、删除VLAN
命令格式:
clear vlan <vlan_num>
Switch-PHY-6500>(enable)clear vlan 999
3、修改vlan
Switch-PHY-6500>(enable) setvlan 999 name v999
Switch-3548(config-line) # password (0) zzz(明文)
Switch-3548(config-line) # password 7 zzz(加密)
Switch-PHY-6500>(enable) set password
4、设置系统时间
命令格式:clock set hh:mm:ss day month year
命令格式:set spantree enable <vlans>(启用STP)
set spantree disable <vlans>(关闭STP)
Switch-PHY-6500>(enable) setspantree enable 3
Switch-PHY-6500>(enable) setspantree disable 3
2、关闭或开启端口Switch-PHY-3548(config-if) #shutdown
Switch-PHY-3548(config-if) # no shutdown
命令格式:
set port enable <mod/port>(开启)
set port disable <mod/port>(关闭)
Switch-3548(config) # enable password 7 zzz(加密)
Switch-3548(config) # enable secret 5 zzz(明文)
Switch-6500> (enable) set enablepass
3、设置远程登录口令
Switch-PHY-3548(config) # line vty 0 4
Switch-PHY-3548#clock set 23:00:00 23 february 2007
命令格式:set time [day_of_week] [mm/dd/yy] ][hh:mm:ss]
Switch-PHY-6500>(enable) set time fri 2/23/2007 23:00:00
建立和删除VLAN
1、进入VLAN配置模式
Switch-PHY-3548 (vlan )# vlan dataID> name <vlan_name>
Switch-PHY-3548(vlan )# vlan 100 name vlan1000
3、退出并返回特权用户模式
3、配置VTP工作模式
Switch-PHY-3548(config) # vtpmode transpareant/client/server
(server为缺省值)
1、配置VTP域名
Switch-PHY-6500>(enable) setvtp domain pku
2、配置VTP工作模式
Switch-PHY-6500>(enable) setvtp mode server/client/transparent/off
配置交换机的主系统信息
1、配置交换机的主机名
Switch-3548 (config) # hostname Switch-PHY-3548
Switch-6500> (enable) set system name Switch-PHY-6500>
2、配置超级用户口令
Switch-3548(config) # enable password zzz(明文)
步骤名称(IOS/CatOS)