大数跨境

路由器和交换机基本配置命令(一)

路由器和交换机基本配置命令(一) 云探索网络
2018-03-08
3
导读:大家好,我是Alex。近期几篇文章分享大家一些有关CISCO的基本配置命令...Hostname姓名

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

Hostname姓名            改系统名

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

帮助

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

例:

帮助

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

Router设置IP地址

帮助

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

例:

帮助

1
2
3
4
5
(config)#interface f0/0
(config-if)# ipaddress 192.168.1.254 255.255.255.0
(config-if)# noshutdown
(config-if)#exit
(config)#

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

帮助

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

例:

帮助

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

定义Console接口的口令

帮助

1
2
3
4
5
(config)#line con 0                                      (进入控制接口)
(config-line)#password [口令]                            (设置口令)
(config-line)#login                                      (设置口令生效)
(config-line)#exit                                       (返回到特权模式)
(config)#

例:

帮助

1
2
3
4
5
User AccessVerification
Password:___________  (Console接口的口令)
s1>enable
Password:___________  (从用户模式进入特权模式的口令)
s1#

定义Telnet用户接口的口令

帮助

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

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

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

帮助

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

例:

帮助

1
2
3
4
5
6
(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  #   (定义启动显示文本)

例:

帮助

1
2
3
4
5
6
7
8
9
(config)# bannermotd  #
Enter TEXTmessage.  End with the character '#'.
********************
*                  *
*       xxxx       *
*                  *
********************
#
(config)#

Router上的指令

#show controller [串行接口编号]

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

例:

帮助

1
2
3
4
5
6
7
8
#show controller serial 0/0
...............
......................V.35DTE cable
...............
#show controller serial 0/0
...............
......................V.35DCE cable
...............

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

帮助

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

例:

帮助

1
2
3
4
(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                                            (重新启动)

例:

帮助

1
2
3
4
5
6
#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地址]                              (建立静态映射)

帮助

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

MAC地址表

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

 

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

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

 

 

waiting......

*本文为华盟网原创文章,作者:Alex,如需转载请保证文章未删减并注明出处:华盟网*


【声明】内容源于网络
0
0
云探索网络
网络技术探索研究
内容 1075
粉丝 0
云探索网络 网络技术探索研究
总阅读14
粉丝0
内容1.1k