路由交换命令

switch>                                                                     用户模式

switch>enable                                                    进入特权模式

switch#                                                                      特权模式

switch#config terminal                               进入全局配置模式

switch#conf t                                                      简写

switch(config)#                                           全局配置模式

switch(config)#interface fastethernet 0/1进入接口模式

switch(config)#intf0/1                         简写

switch(config-if)#                                          接口模式

switch(config-if)#exit                          回到上一层模式

switch(config)#end                                      快速退到特权模式

switch#disable                                            从特权模式回到用户模式

switch>

 

switch(config)#hostname ws1                           更改主机名为“sw1

switch(config)#host ws1                             简写

switch# showversion                           显示系统“IOS”名称及版本信息

switch# sh ver                                                            简写

switch# showmac-address-table [dynamic]            查看MAC地址表

dynamic:可选参数,只显示交换机动态学习到的MAC地址

 

switch(config-if)#duplex { full | half | auto }                  指定接口的双工模式

full:全双工

half:半双工

auto:自动协商

 

指定接口的通信速率:

switch(config-if)#speed { 10 | 100 | 1000 | auto }

 

查看接口的双工模式和通信速率

switch #sh int f0/24

 

switch(config)#line con 0                   

switch(config-line)#exec-timeout 0 0               修改会话永不超时,00秒超时

switch(config-line)#logging synchronous   启用显示同步

switch(config)# noip domain-lookup                禁止DNS查找

简写:

en

conf t

no ip domain-lo

line con 0

exec-t 0 0

logg syn

end

 

给路由器配ip地址

router(config)# interface fastethernet 0/1

router(config-if)#ip address ip-address subnet-mask

router(config-if)#no shutdown

 

给交换机配置ip地址

switch(config)# interface vlan 1

switch(config)# ip address ip-address subnet-mask

switch(config-if)# no shutdown

 

switch #show int f0/1                          查看接口状态

 

windows7上的arp命令:

C:\>arp -a                         查看ARP缓存表

C:\>arp -d                         清除ARP缓存表

C:\>arp -s ip-addressmac-address                     ip地址和MAC地址进行绑定

C:\>netshinterface ipv4 show neighbors          查看完网卡接口序号

C:\>netshinterface ipv4 set neighbors 网卡接口序号 ip-address man-address   绑定MAC

C:\>arp -d ip-address              删除特定arp条目

 

Cisco设备ARP命令

router# show arp                           查看arp缓存表

router# cleararp-cache                 清除arp缓存表

router(config) #arp ip-addressmac-addressarpa                 绑定ARP条目

 

windows7上的ping命令:

C:\>ping[-t] [-l 字节数] [-a][-i] ip-address | target-name

-t:默认4ping包,加上-t会一直不停的ping下去

-a:可以返回对方主机的主机名

-l:默认大小为32字节,-l 后可以指定ping包的大小

 

配置静态路由:

router(config) #ip route networkmask { address | interface }

network:目的网络地址

mask:目的网络子网掩码

address:到达目的网络经过的吓一跳路由器的接口地址

interface:到达目的网络的本地接口

 

配置默认路由:

router(config) #ip route 0.0.0.0 0.0.0.0 address

0.0.0.0 0.0.0.0:代表任何网络

address:到达目的网段经过的下一跳路由器的接口地址

 

router # show iproute                         查看路由表

router # show ipint brief                     查看各接口的ip地址

 

router (config) #default int f0/0                        恢复接口默认配置

 

router (config-if)# no ip address                       删除配置的接口ip

 

router #traceroute 3.3.3.3                                 路由追踪,查看中间经历了几跳

router #traceroute 3.3.3.3 source 2.2.2.2         2.2.2.2作为源开始路由追踪

 

router(config) #no ip route networkmask { address | interface }             删除路由条目

 

switch #show running-config                    查看对交换机进行的所有修改和配置

switch #sh run                                      简写

switch #show startup-config                      显示已保存的配置信息

switch #sh star                                     简写

switch #copy running-config startup-config            保存当前配置信息

switch #write                                                      保存当前配置信息

switch #wr                                            简写

switch #erase nvram                                   删除已保存的配置信息

switch #delete nvram: startup-config        删除已保存的配置信息

 

配置console密码:重启验证

switch (config) #line console 0

switch(config-line)# password cisco

switch(config-line)# login

 

配置特权模式密码:

switch(config) #enable password cisco                    密码是明文的

switch(config) #enable secret cisco                   密码是密文的

 

配置加密明文密码:

switch(config) #service password-encryption  将明文密码进行加密

 

路由器密码恢复:

1、重启路由器,同时按下ctrl + breack键中断IOS的加载,路由器进入ROM Monitor模式

2、将配置寄存器的值更改为 0x2142,表示在启动时忽略startup-config 的配置

       rommon > confreg 0x2142

       rommon > reset

3、路由器将再次重启,登录不再需要密码

4、进入配置模式后,将配置文件手动加载进来

       router # copy startup-configrunning-config

5、通过showrun命令查看路由器配置了哪些密码,逐一更改密码

6、修改配置寄存器的值,并保存配置

       router(config) # config-register 0x2102

       router(config) # exit

       router # copy running-configstartup-config

 

交换机的密码恢复:

       交换的的密码被保存在flash中的配置文件config.text里,可以通过命令“dir”查看

       switch # dir

密码恢复过程:

1、拔掉交换机插头

2、重新插好电源后,立刻按住交换机上的“mode”键。当配置界面显示“switch:”命令提示,便可松开“mode”键。表示已经进入到一个专门用来做故障恢复的简单IOS

       switch:

3、根据提示输入“flash_init”初始化flash

       switch: flash_init

       switch:

4、将config.text文件名改成config.old

       switch: rename  flash:config.text  flash:config.old

5、重启交换机

       switch : boot

6、把配置文件的名称改回来

       switch # rename flash:config.old flash:config.text

7、手工加载配置文件

       switch # copy flash:config.textsystem:running-config

8、加载完成后,进入配置模式修改密码,最后保存配置,完成密码的恢复

 

路由器、交换机的远程管理

交换机配置管理IP地址

switch(config)# interface vlan 1

switch(config)# ip address ip-address subnet-mask

switch(config-if)# no shutdown

 

配置VTY密码:(远程登录密码)

switch(config) #line vty 0 4

switch(config-line)# password cisco

switch(config-line)# login

远程访问交换机时,必须给交换机配置特权模式密码

 

配置默认网关:

switch(config) #ip default-gateway 192.168.1.1

 

IOS的备份和升级

 

cisco查询产品的SN

router # showversion

创建VLAN

方法一:

       switch # vlan database

       switch (vlan) # vlan 10 name test10

       switch (vlan) # exit

方法二:

       switch # configure terminal

       switch(config) # vlan 10

       switch (config-vlan) # name test10

       switch (config-vlan) # exit

 

删除VLAN

方法一:

       switch # vlan database

       switch (vlan) # no vlan 10

       switch (vlan) # exit

方法二:

       switch # configure terminal

       switch (config) # no vlan 10

 

将接口加入到相应的VLAN

       switch # configure terminal

       switch (config) # interface fastethernet0/1

       switch (config-if) # switchport modeaccess

       switch(config-if) # switchport accessvlan 10

       switch(config-if) # exit

 

验证VLAN 的配置

       switch # show vlan brief                             查看所有VLAN 的信息

       switch # show vlan id vlan-id                      查看某个VLAN的信息

 

Trunk的配置:

1、进入接口:

switch(config) # interface { fastethernet | gigabitethernet } slot/port           

2、选择封装类型:

switch(config-if)# switchport trunk encapsulation { isl |dot1Q | negotiate }

       negotiate:表示端口与临街端口进行协商

3、将接口配置为trunk

switch(config-if)# switchport mode { dynamic { desirable | auto } | trunk }

4、(可选)指定NativeVLAN

switch(config-if)# switchport trunk native vlan vlan-id

5、如果不需要trunk传送某个VLAN的数据,则可以从trunk中删除这个VLAN

switch(config-if)# switchport trunk allowed vlan remove vlan-id

6、可以在trunk上添加某个VLAN

switch(config-if)# switchport trunk allowed vlan add vlan-id

7、验证接口模式

switch #show interface interface-id switchport

 

EthernetChannel:以外网链路

条件:

       1、参与捆绑的端口必须属于同一个VLAN,或者把他们配置为中继端口

       2、如果为中继模式,那么链路两端将通道中的所有端口配置为相同的中继模式。

              需要所有端口支持相同的VLAN范围许可,如果VLAN 许可范围不一致,则端口不属于以外网通道

       3、所有参与捆绑的端口的物理参数设置必须相同,应该有同样的速度和全/班双工模式设置

 

以太网通道配置:两台交换机相同配置

Switch(config)#interface range f0/1-2            range:范围

Switch(config-if-range)#channel-group1 mode on

 

单臂路由:

1、配置链路类型

Switch(config)#int f0/1

Switch(config-if)#switchportaccess vlan 10

 

Switch(config)#int f0/2

Switch(config-if)#switchportaccess vlan 20

 

Switch(config)#int f0/24

Switch(config-if)#switchportmode trunk

 

2、配置VLAN标签的封装结构

Router(config)#inter f0/0.1

Router(config-subif)#encapsulationdot1Q 10

Router(config)#inter f0/0.2

Router(config-subif)#encapsulationdot1Q 20

3、配置子接口地址

Router(config)#inter f0/0.1

Router(config-subif)#apadd 10.0.0.1 255.0.0.0

Router(config)#inter f0/0.2

Router(config-subif)#ipadd 20.0.0.1 255.0.0.0

 

 

使用路由器配置DHCP服务

1、定义IP地址池

         router(config)# ip dhcp pool pool-name

         pool-name:地址池的名称

2、动态分配IP地址段

         router(dhcp-config)# network network-numbermask

         network-numbermask:可动态分配给客户端知己的IP地址范围

3、设定网关地址

         router(dhcp-config)# default-routergateway-ip

         gateway-ip:为客户端主机指定网关地址

4、为客户端配置DNS地址

         router(dhcp-config)# dns-server dns-ip

         dns-ip:为客户端主机指定的DNS服务器地址,该命令后可跟多个备用的DNS地址

5、设定地址租期

         router(dhcp-config)# lease days

         days:表示地址租期

6、预留静态分配的IP地址

         router(config)# ip dhcp excluded-addresslow-address [high-address]

         命令后面的斜体部分表示预留的地址范围

 

VTP的配置

1、创建VTP

       switch(config) # vtp domain domain-name

2、配置交换机的VTP模式

       VTP的模式有三种,分别为ServerClientTransparent

       switch(config) # vtp mode { server |client | transparent }

3、配置VTP口令

       在交换机上配置VTP口令,用于保证网络内交换机VLAN配置的安全性。

       同一个VTP域内的交换机,口令配置要一致

       switch(config) # vtp password password

4、配置VTP修剪

       switch(config) # vtp pruning

5、配置VTP版本

       默认情况下,VTP运行版本1,若果使用版本2,需要使用命令配置

       switch(config) # vtp version 2

6、查看VTP 的配置信息

       switch # show vtp password                查看配置的VTP口令

       switch # show vtp staus                       查看其它VTP的配置信息

 

 

 

 

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值