电脑技术学习

交换机专题 [必读]

dn001

  Cisco 3548(3524) 交换机:
  
  第一次连接交换机,配置终端参数为:
  波特率:9600;数据位:8;停止位:1;奇偶校验:无;流控制:无。
  通过串口线连上路由器后,按回车,即可看到配置向导:
  (假如不是第一次配置,可以进入超级用户模式后用命令setup调用以下过程)
  
  --- System Configuration Dialog ---
  
  At any point you may enter a question mark '?' for help. 任何时候可以打?取得帮助
  Use ctrl-c to abort configuration dialog at any prompt. 按Ctrl-C可以取消并退出
  Default settings are in square brackets '[]'. 默认参数在[]中
  
  Continue with configuration dialog? [yes/no]: y 继续交互配置吗?回答:y
  Enter IP address: 10.1.1.249 ip地址
  Enter IP netmask: 255.255.255.0 子网掩码
  Would you like to enter a default gateway address? [yes]: y 设置默认网关?y
  IP address of default gateway: 10.1.1.254 默认网关
  Enter host name [3548_9A]:
  
  The enable secret is a one-way cryptographic secret used
  instead of the enable passWord when it exists.
  
  Enter enable secret: _password 输入超级用户密码
  
  Would you like to configure a Telnet password? [yes]: y
  Enter Telnet password: _password 输入telnet密码
  Would you like to enable as a cluster command switch? [yes/no]: n 集群模式?n
  
  The following configuration command script was created: 已建立以下配置信息
  
  ip subnet-zero
  interface VLAN1
  ip address 10.1.1.249 255.255.255.0
  ip default-gateway 10.1.1.254
  enable secret 5 $1$biZ3$AOLb9cMTtBwMtGB9lyBzr.
  line vty 0 15
  password _domainwlzx
  snmp community private rw
  snmp community public ro
  !
  end
  
  Use this configuration? [yes/no]: 使用该配置信息吗? y
  
  修改配置:
  
  禁止通过snmp治理:
  3548>enable
  password:
  3548#config term
  3548(config)#no snmp community private
  3548(config)#no snmp community public
  
  接着配置干道:(确定上级交换机对应端口已设为干道模式)
  3548(config)#inter g0/1 选择第一个千兆口
  3548(config if)# switchport mode trunk 设为干道模式
  假如g0/2用于连接另一台3548,也设为干道
  3548(config)#inter g0/2
  3548(config if)# switchport mode trunk
  返回
  3548(config if)# exit
  3548(config)# exit
  3548#
  验证: ping 10.1.1.254
  
  配置Vlan数据:
  3548#vlan database
  3548(vlan)#reset 清除以前的配置
  3548(vlan)#vtp client 设为vtp客户模式
  3548(vlan)#vtp domain _domain vtp域是_domain
  3548(vlan)#vtp password ******** 设定vtp域密码
  3548(vlan)#exit
  3548#
  验证: show vtp status 显示vlan 数据
  show vtp counters
  show vlan
  同步后看到的vlan数目和名称应与6506上的一致
  
  指定端口到Vlan、配置端口为portfast方式(快速建立连接):
  方法1:命令方式
  3548#config term
  3548(config)#inter f0/1 配置1号快速以太网端口
  3548(config if)# switchport Access vlan 2 指定端口到Vlan 2
  3548(config if)# spanning-tree portfast 配置端口为portfast方式
  3548(config)#inter f0/2 配置1号快速以太网端口
  3548(config if)# switchport access vlan 2 指定端口到Vlan 2
  3548(config if)# spanning-tree portfast 配置端口为portfast方式
  ... 对每个要设定的端口重复上述步骤。

  3548(config if)# exit
  3548(config)# exit
  3548#
  方法1:Web 方式
  (预先要安装插件:jre-1-2-2-005-win-i-09-mar-2000.exe)
  打开浏览器连接设备:在地址栏输入设备的治理页面url,如3548_9a(10.1.1.248)为:http://10.1.1.249/basiccfg.Html
  选中菜单port -> port configure -> 设port fast 为Enable
  选中菜单vlan -> vlan membership -> 指定端口所属的Vlan号 可同时指定多个端口
  
  ! 注重: 假如把一个端口指定到不存在的VLAN上,3548交换机的VLAN同步会异常,此时应该为正确VLAN并重新“配置Vlan数据”
  
  保存配置信息:
  方法1:命令方式
  3548# write ( 或 copy running-config startup-config )
  方法1:Web 方式
  选中设备(而不是单个端口),点击save configure按钮。
  
  Cisco 4000,6500交换机:
  
  第一次连接交换机,配置终端参数为:
  波特率:9600;数据位:8;停止位:1;奇偶校验:无;流控制:无。
  连接上后看到:
  console>
  进入超级用户模式:
  console> enable
  console>(enable)
  在此打入以下命令设置系统:
  set system name 6506 #设置系统名称
  set password _password #设置telnet密码
  set enablepass _password #设置enable(超级用户)密码
  
  set interface sc0 1 10.1.1.253/255.255.255.0 10.1.1.255 #设置本交换机的IP地址
  set ip route 0.0.0.0/0.0.0.0 10.1.1.254 #设置默认网关
  set ip alias default 0.0.0.0 #设置ip对应的设备名,方便治理
  set ip alias 6506 10.1.1.253 #用途如:ping 2620, telnet 3548_2a
  
  set vtp domain _domain # 设置设置VTP域名
  set vtp passwd ******** # VTP域密码
  set vlan 2 name vlan2 #建立VLAN
  set vlan 3 name vlan3
  ...
  set trunk 2/1 on dot1q 1-1005 #设置2/1为运行802.1Q协议的干道,答应vlan 1-1005通过
  set trunk 2/2 nonegotiate isl 1-1005 #设置3/4为运行isl协议的干道,答应vlan 1-1005通过
  ...
  set trunk 3/1 on dot1q 1-1005 #设置Port Channel(链路聚合)
  set trunk 3/2 on dot1q 1-1005 #Port Channel 各成员要有相同配置
  set port channel 3/1-2 mode on #假如是4000交换机,不要将连接L3模块的端口设为Channel,否则无法支持ACL
  
  set vlan 5 2/1 #指定端口2/1到vlan 5
  ...
  set port name 2/1 gg #设置端口名称
  ...
  
  set mls flow full #设置多层交换流类型
  
  说明: 1.任何命令输入之后立即保存并生效
  2.本配置方法仅说明方法,具体参数选择参看最近配置文件
  
  Msfc 配置方法
  功能:路由/多层交换/DHCP动态主机配置
  
  进入配置:(通过6506,如过配置了telnet密码,也可直接telnet 10.1.1.254)
  6506> (enable) session 15 (MSFC安装在交换引擎内,槽号为15 务份引擎内的MSFC为16)
  Trying Router-15...
  Connected to Router-15.
  Escape character is '^]'.
  
  msfc>enable 进入超级用户状态
  Password:
  msfc#config term 进入全局配置状态
  Enter configuration commands, one per line. End with CNTL/Z.
  msfc(config)#
  hostname msfc #配置系统名称
  enable secret ******** #配置超级用户密码
  no ip dhcp conflict logging #不使用dhcp冲突记录
  ip dhcp excluded-address 10.1.1.1 10.1.1.9 #不用于动态分配的地址范围
  ip dhcp excluded-address 10.1.1.200 10.1.1.254
  ip dhcp excluded-address 10.1.2.1 10.1.2.99
  ip dhcp excluded-address 10.1.3.1 10.1.3.99
  ...
  ip dhcp pool 1 #一个为动态分配预备的ip pool
  network 10.1.1.0 255.255.255.0 #网络地址-不用于动态分配的地址范围=用于动态分配的地址范围
  default-router 10.1.1.254 #为客户设定默认网关
  netbios-name-server 10.1.8.4 10.1.8.5 #为客户设定主备wins ../InfoList/Catalog_37_1.html" target="_blank" title="服务器" >服务器地址
  netbios-node-type h-node #为客户设定节点类型
  ip dhcp pool 2
  network 10.1.2.0 255.255.255.0
  default-router 10.1.2.254
  netbios-name-server 10.1.2.4 10.1.2.5 #Vlan 2 wins服务器地址
  netbios-node-type h-node
  
  interface Vlan1 #设置VLAN 1路由接口
  msfc(config if)# ip address 10.1.1.254 255.255.255.0 #设置IP地址、子网掩码
  no shutdown #启用端口
  
  interface Vlan2 #对每个VLAN重复配置过程
  ip address 10.1.2.254 255.255.255.0
  no shutdown
  msfc(config if)# exit
  msfc(config)# exit
  msfc# write ( 或 copy running-config startup-config ) 保存配置信息
  msfc# exit 退出
  msfc> exit 退出

标签: 交换机