返回列表 发帖

[技术文章] Cisco WS-C2960L-8TS-LL交换机配置IP 配置VLAN的方法

一、连接电脑与交换机
使用配置电缆(RS232-RJ45)连接电脑串口和交换机Console口,使用Xshell 6软件进行登录,参数如下:
新建连接:
名称:Cisco
协议:SERIAL
SSH/SERIAL参数:默认(COM1/9600/8/1/None/None)
二、设置IP、划分VLAN
Xshell登录交换机,交换机断电再送电,根据如下红色字体部分设置:
         --- System Configuration Dialog ---

Enable secret warning
----------------------------------
In order to access the device manager, an enable secret is required
If you enter the initial configuration dialog, you will be prompted for the enable secret
If you choose not to enter the intial configuration dialog, or if you exit setup without setting the enable secret,
please set an enable secret using the following CLI in configuration mode-
enable secret 0 <cleartext password>
----------------------------------
Would you like to enter the initial configuration dialog? [yes/no]: y

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 setup instead of extended setup? [yes/no]: y
Configuring global parameters:

  Enter host name [Switch]: CiscoSwitch-SP1

  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: sx******

  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: sx******
% Please choose a password that is different from the enable secret
  Enter enable password: sx******2019

  The virtual terminal password is used to protect
  access to the router over a network interface.
  Enter virtual terminal password: sx******
  Configure SNMP Network Management? [no]: 回车

Current interface summary

Any interface listed with OK? value "NO" does not have a valid configuration

Interface              IP-Address      OK? Method Status                Protocol
Vlan1                  unassigned      NO  unset  up                    down   
GigabitEthernet0/1     unassigned      YES unset  down                  down   
GigabitEthernet0/2     unassigned      YES unset  down                  down   
GigabitEthernet0/3     unassigned      YES unset  down                  down   
GigabitEthernet0/4     unassigned      YES unset  down                  down   
GigabitEthernet0/5     unassigned      YES unset  down                  down   
GigabitEthernet0/6     unassigned      YES unset  down                  down   
GigabitEthernet0/7     unassigned      YES unset  down                  down   
GigabitEthernet0/8     unassigned      YES unset  down                  down   
GigabitEthernet0/9     unassigned      YES unset  down                  down   
GigabitEthernet0/10    unassigned      YES unset  down                  down   

Enter interface name used to connect to the
management network from the above interface summary: vlan1

Configuring interface Vlan1:
  Configure IP on this interface? [yes]: 回车
    IP address for this interface: 192.168.10.1
    Subnet mask for this interface [255.255.255.0] :  回车
    Class C network is 192.168.10.0, 24 subnet bits; mask is /24
Would you like to enable as a cluster command switch? [yes/no]: n

The following configuration command script was created:

hostname CiscoSwitch-SP1
enable secret 5 $1$tKqT$WBdUepTCliI18Z2aJOvCn/
enable password sxcpwrhc2019
line vty 0 15
password sxcpwrhc
no snmp-server
!
no ip routing

!
interface Vlan1
no shutdown
ip address 192.168.10.1 255.255.255.0
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface GigabitEthernet0/3
!
interface GigabitEthernet0/4
!         
interface GigabitEthernet0/5
!         
interface GigabitEthernet0/6
!         
interface GigabitEthernet0/7
!         
interface GigabitEthernet0/8
!         
interface GigabitEthernet0/9
!         
interface GigabitEthernet0/10
!         
end      
         

[0] Go to the IOS command prompt without saving this config.
[1] Return back to the setup without saving this config.
[2] Save this configuration to nvram and exit.

Enter your selection [2]:  回车
Building configuration...
[OK]
Use the enabled mode 'configure' command to modify this configuration.




Press RETURN to get started!


CiscoSwitch-SP1>
Jul 23 05:59:48.987: SMI Director is not configured, disabling SMI
Jul 23 05:59:48.987: disable_smartinstall_operationisabling SMI
Jul 23 06:00:23.010: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to up
Jul 23 06:00:24.010: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
Jul 23 06:00:31.506: %PNP-6-PNP_DISCOVERY_STOPPED: PnP Discovery stopped (Startup Config Present)
Jul 23 06:00:35.311: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to down
Jul 23 06:00:36.311: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to down
Jul 23 06:00:40.010: %LINK-3-UPDOWN: Interface GigabitEthernet0/6, changed state to up
Jul 23 06:00:41.010: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/6, changed state to up
Jul 23 06:00:51.411: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/6, changed state to down
Jul 23 06:00:52.411: %LINK-3-UPDOWN: Interface GigabitEthernet0/6, changed state to down
Jul 23 06:00:55.110: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to up
Jul 23 06:00:56.110: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
Jul 23 06:01:23.114: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
Jul 23 06:06:25.562: %LINK-5-CHANGED: Interface Bluetooth0, changed state to administratively down
CiscoSwitch-SP1>show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Gi0/1, Gi0/2, Gi0/3, Gi0/4
                                                Gi0/5, Gi0/6, Gi0/7, Gi0/8
                                                Gi0/9, Gi0/10
2    VLAN2                            active   
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0   
2    enet  100002     1500  -      -      -        -    -        0      0   
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------

CiscoSwitch-SP1>enable //进入特权模式
Password:
CiscoSwitch-SP1#conf t  //进入配置模式
Enter configuration commands, one per line.  End with CNTL/Z.

CiscoSwitch-SP1(config)#vlan 2                        //创建Vlan 2
CiscoSwitch-SP1(config-vlan)#name VLAN2    //给vlan 2改名为VLAN2
CiscoSwitch-SP1(config-vlan)#exit
CiscoSwitch-SP1(config)#int range Gi0/5-10    //进入端口5到10
CiscoSwitch-SP1(config-if-range)#switchport access vlan 2    //将第5个到第10个端口划到VLAN2
CiscoSwitch-SP1(config-if-range)#exit    //退出端口
CiscoSwitch-SP1(config)#exit    //退出配置模式
CiscoSwitch-SP1#wr     //保存

CiscoSwitch-SP1#reload    //重启交换机
CiscoSwitch-SP1#erase startup-config    //删除所有配置
欢迎光临:逐梦论坛

删除VLAN的方法

CiscoSwitch-SP1>en
Password: 密码
CiscoSwitch-SP1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
CiscoSwitch-SP1(config)#int range Gi0/5-10
CiscoSwitch-SP1(config-if-range)#switchport access vlan 1
CiscoSwitch-SP1(config-if-range)#no switchport access vlan 2    //是否需要执行?
CiscoSwitch-SP1(config-if-range)#exit
CiscoSwitch-SP1(config)#no vlan 2
CiscoSwitch-SP1(config)#exit
CiscoSwitch-SP1#wr
欢迎光临:逐梦论坛

TOP

Web方式修改VLAN方法

如果要调整VLAN,Web页面只能查看不能调整(CLI命令行界面命令执行失败,新建权限为15的用户无法登录),需要使用思科命令行界面分析器Cisco CLI Analyzer(下载地址:https://cway.cisco.com/go/sa)以telnet方式登录后运行命令。
欢迎光临:逐梦论坛

TOP

返回列表

Powered by Discuz! 7.2   论坛QQ群:逐梦论坛群

© 2001-2021 Comsenz Inc. 鲁公网安备 37120302000001号