大家好,我是Alex。近期几篇文章分享大家一些有关CISCO的基本配置命令。


Hostname姓名                                                          改系统名

2900系列以上交换机设置IP地址

(config)#interface vlan 1                                          (进入VLAN 1 接口)
(config-if)#ip address [IP地址] [掩码]                   (设置IP地址)
(config-if)#no shutdown                                           (打开该接口)
(config-if)#exit                                                          (返回到全局模式)
(config)#

例:

(config)#interface vlan 1
(config-if)# ipaddress 192.168.1.253 255.255.255.0
(config-if)# noshutdown
(config-if)#exit

Router设置IP地址


(config)#interface [接口名]                              (进入接口)
(config-if)#ip address [IP地址] [掩码]           (设置IP地址)
(config-if)#no shutdown                                   (打开该接口)
(config-if)#exit                                                  (返回到全局模式)
(config)#

例:

(config)#interface f0/0
(config-if)# ipaddress 192.168.1.254 255.255.255.0
(config-if)# noshutdown
(config-if)#exit
(config)#

定义从用户模式进入特权模式的口令:

(config)#enable password [口令]                     (设置明文口令)
(config)#enable secret [口令]                           (设置密文口令)

例:

(config)#enablepassword 12345
(config)#enablesecret cisco


定义Console接口的口令




例:

(config)#line con 0                                      (进入控制接口)
(config-line)#password [口令]                   (设置口令)
(config-line)#login                                       (设置口令生效)
(config-line)#exit                                         (返回到特权模式)
(config)#
User AccessVerification
Password:___________  (Console接口的口令)
s1>enable
Password:___________  (从用户模式进入特权模式的口令)
s1#

定义Telnet用户接口的口令




[04] 是指最多允许5位用户对设备进行Telnet登陆)

(config)# line vty   0  4                          (进入vty接口)  
(config-line)# password [口令]            (设置口令)
(config-line)#login                                (设置口令生效)
(config-line)# exit                                  (返回到特权模式)
(config)#


给设备定义时间、日期、年份:


(config)# clock timezone [时区名称] [时区范围]         (设置时区)
#clock set [时间] [日期] [月份(英文表示)] [年份]      (设置时间)


例:

(config)# clocktimezone beijing 8
(config)# exit
# clock set19:30:00 24 may 2006
#
#show clock
19:31:17.059beijing Wed May24 2006
#


(config)#banner motd  #   (定义启动显示文本)

例:

(config)# bannermotd  #
Enter TEXTmessage.  End with the character '#'.
********************
*                  *
*       xxxx       *
*                  *
********************
#
(config)#
Router上的指令
#show controller [串行接口编号]

   (查看该接口连接的是DTE线缆还是DCE线缆)

例:

#show controller serial 0/0
...............
......................V.35DTE cable
...............
#show controller serial 0/0
...............
......................V.35DCE cable
...............


如果串行接口连接的是DCE线缆,则需要定义时钟

>enable
#conf t
(config)#interface [串行接口编号]                 (进入串行接口)
(config-if)#clock rate 64000                             (定义时钟频率)
(config-if)#exit                                                   (返回到全局模式)
(config)#


例:

(config)#interface serial 0/0
(config-if)#clock rate 64000
(config-if)#exit
(config)#


#show interface [接口号]
Serial0/0is up, line protocol is up
       (代表该接口可以正常使用)

Serial0/0is up, line protocol is down
       (两端协议不匹配)   HDLC---------- PPP
       (串行DCE接口没有设置时钟)

Serial0/0is down, line protocol is down
       (线缆故障)
       (对端设备接口没有打开,或对端设备关闭电源)
      
Serial0/0 is administratively down, line protocolis down
       (人为将接口关闭,通过指令可以打开)

#show running-config           (查看正在运行的配置文件)
#show startup-config            (查看启动配置文件)


# erase startup-config                   (清空配置文件)
#reload                                          (重新启动)


例:

#erasestartup-config
Erasingthe nvram filesystem will remove all files! Continue? [confirm]
[OK]
Eraseof nvram: complete
#
#reload
(config)#no ip domain-lookup                                        (关闭域名解析)
(config)#ip host [主机名] [主机IP地址]                         (建立静态映射)

例:

Switch#conf t
(config)#ip host pc1 192.168.1.249
(config)#exit


MAC地址表


初始为空,当有数据帧到达时:首先,将数据帧中的源MAC地址与接收该数据帧的端口建立对应的关系,并将这种关系放置的MAC地址表中。其次,判断数据帧中的目标MAC地址在交换机的MAC地址表中是否存在与端口的对应关系,如果存在,则从该端口转发数据帧;如果不存在,将采用泛洪的方式进行转发。(泛洪:除去入端口之外的所有端口转发数据帧的方式。)


交换机对于未知的单播数据帧、广播数据帧、组播数据帧都是以泛洪的方式进行转发。


#show mac-address-table             (查看MAC地址表)

waiting......

android 改交换机 交换机改ip地址命令_配置文件