思科命令详解及总结_思科命令大全
思科命令详解及总结由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“思科命令大全”。
查看当前运行配置(密码)保存配置
Switch# show running-config Switch# write 对路由设置密码(明文)
sw1(config)#line console 0 sw1(config-line)#paword 密码
sw1(config-line)#login 配置明文特权模式密码
配置密文特权模式密码
加密明文密码
sw1(config)# enable paword 密码 sw1(config)# enable secret 密码
sw1(config)# service paword-encryption 路由器密码恢复的思路
路由器启动过程中不加载配置文件
修改配置寄存器的值为0x2142,启动不加载配置文件 路由器密码恢复步骤
启动过程中按Ctrl+Breack中断IOS加载 修改配置寄存器的值
rommon1>confreg 0x2142 rommon2>reset 正常启动后,startup-config覆盖running-config Router#copy startup-config running-config 修改密码,并修改配置寄存器的值
Router(config)#enable secret cisco Router(config)#config-register 0x2102 交换机密码恢复步骤
1.拔掉交换机的插头,插上电源同时按住MODE键 2.出现“switch:” 初始化Flash 3.config.text改成config.old 4.重启交换机
switch:flash_init
switch:rename flash:config.text flash:config.old switch:boot
switch# rename flash:config.old flash:config.text
5.把配置文件的名字改回来
配置管理IP地址
sw1(config)# interface vlan 1
sw1(config-if)# ip addre 192.168.1.10 255.255.255.0 sw1(config-if)# no shutdown 配置VTY密码
sw1(config)# line vty 0 4 sw1(config-line)# paword 密码
sw1(config-line)# login 默认网关的配置命令
Switch(config)# ip default-gateway ip-addre 路由器上配置登录FTP用户名、密码
Router(config)# ip ftp username benet Router(config)# ip ftp paword cisco 备份路由器IOS 重启交换机
主机绑定ARP
C:>arp-s 10.0.0.200 00-1a-64-a1-52-f0 C:>arp-a 交换机绑定ARP
Switch(conf ig)#arp 10.0.0.6 0019.2101.9211 arpa f0/2 Switch(conf ig)#arp 10.0.0.200 001a.64a1.52f0 arpa f0/1 Switch(conf ig)#arp 10.0.0.7 0013.240a.b219 arpa f0/3 Switch#show ip arp
VLAN配置 Switch#vlan database
全局模式
Switch(vlan)#vlan 名称
Switch(vlan)#exit
Router# copy ftp flash Router# Boot
Switch(config)#vlan 编号 Switch(config-vlan)#name 名称
Switch(vlan)#vlan 编号 name 名字 Switch(vlan)# no vlan 编号
Switch(config)# no vlan 编号 VLAN配置 Switch#vlan database 删除VLAN Switch# vlan database 全局模式下删除VLAN 将端口加入VLAN
Switch(config)# interface 配置端口
Switch# configure terminal
Switch(config-if)# switchport mode acce
Switch(config-if)# switchport acce vlan 编号(加入命令)Switch(config-if)# no switchport acce vlan 编号(删除命令)还原接口为默认配置状态 Switch(config)# default interface 端口 所有VLAN的摘要信息 Trunk的配置 进入接口配置
选择封装类型
Switch# show vlan brief Switch(config)#interface 端口
Switch(config-if)#switchport trunk encapsulation {isl|dot1q| negotiate } 接口配置Trunk
Switch(config-if)#switchport mode {dynamic {desirable | auto} | trunk | acce} 禁止Trunk传送某个VLAN的数据,删除这个VLAN Switch(config-if)#switchport trunk allowed vlan remove 编号 允许Trunk传送某个VLAN的数据,添加这个VLAN Switch(config-if)#switchport trunk allowed vlan add 编号(默认允许全部VLAN的数据通过)配置接口为以太通道模式
Switch(config)# interface range f0/1 – 2(0/1-2捆绑的范围端口)Switch(config-if-range)#channel-group 1 mode on(1以太网通道组号)
查看以太通道的配置 Switch# show etherchannel 1 summary(1是以太网通道组号)
单臂路由的配置 配置链路类型
SW1(config)#inter f0/1 SW1(config-if)#switchport acce vlan 10 SW1(config)#inter f0/2 SW1(config-if)#switchport acce vlan 20 SW1(config)#inter f0/24 SW1(config-if)#switchport mode trunk
子接口对应的VLAN 路由器配置
R1(config)#inter f0/0.1 R1(config-subif)#encapsulation dot1Q 10 R1(config)#inter f0/0.2 R1(config-subif)#encapsulation dot1Q 20 配置子接口地址
R1(config)#inter f0/0.1 R1(config-subif)#ip add 10.0.0.1 255.255.255.0 R1(config)#inter f0/0.2 R1(config-subif)#ip add 20.0.0.1 255.255.255.0
子接口对应VLAN的网关地址 子接口对应VLAN的网关地址
定义IP地址池 Router(config)#ip dhcp pool 地址池名称
Router(dhcp-config)#network 网段 子网掩码192.168.0.0 24 Router(dhcp-config)#default-router 网关 Router(dhcp-config)#dns-server DNS Router(dhcp-config)#lease days
Router(config)#ip dhcp excluded-addre 预留ip 动态分配IP地址段 设定网关地址
为客户端配置DNS地址 设定地址的租期
预留静态分配的IP地址
服务器模式(Server)
可以创建、删除和修改VLAN 学习、转发相同域名的VTP通告
客户机模式(Client)
学习、转发相同域名的VTP通告 不可以创建、删除和修改VLAN 透明模式(Transparent)
可以创建、删除和修改VLAN,但只在本地有效 转发但不学习VTP通告
三台交换机做VTP服务,交换机A做发布端。交换机B/C 接受学习。配置如下(SWA2 3——23SWB22——22SWC)SWA配置:
SwA(config)# vtp domain test SwA(config)#vtp mode server
vtp域名称test
vtp运行模式服务器模式
SwA(config)#interface fastEthernet 0/23 SwA(config-if)#switchport mode trunk
链接口做Trunk SWB配置:
SwB(config)#vtp domain test SwB(config)#vtp mode client
vtp域名称相同test vtp运行模式学习模式
SwB(config)#interface fastEthernet 0/22
SwB(config-if)#switchport mode trunk SwB(config)#interface fastEthernet 0/23 SwB(config-if)#switchport mode trunk SWC配置:
SwC(config)#vtp domain test.SwC(config)#vtp mode client SwC(config)#interface fastEthernet 0/22 SwC(config-if)#switchport mode trunk Vtp域配置完成,对SWA进行配置SWB/C将同步配置
SwA(config)#vlan 2 SwA(config-vlan)#name sales SwA(config)#vlan 3 SwA(config-vlan)#name develop SwA(config)#interface range fastEthernet 0/215 SW-2L(config-if-range)#switchport acce vlan 2 SW-2L(config-if-range)#switchport mode acce SW-2L(config)#interface range f0/16-23 SW-2L(config-if-range)#switchport acce vlan 3 SW-2L(config-if-range)#switchport mode acce SW-2L(config)#interface f0/24
SW-2L(config-if)#switchport mode trunk 配置3层交换机 SW-3L(config)#vlan 2 SW-3L(config-vlan)#exit SW-3L(config)#vlan 3 SW-3L(config-vlan)#exit
SW-3L(config)#interface fastEthernet 0/24
SW-3L(config-if)#switchport trunk encapsulation dot1q SW-3L(config-if)#switchport mode trunk
SW-3L(config)#ip routing SW-3L(config)#interface vlan 1
SW-3L(config-if)#ip addre 192.168.1.1 255.255.255.0 SW-3L(config-if)#no shut SW-3L(config)#interface vlan 2
SW-3L(config-if)#ip addre 192.168.2.1 255.255.255.0 SW-3L(config-if)#no shut SW-3L(config)#interface vlan 3
SW-3L(config-if)#ip addre 192.168.3.1 255.255.255.0 SW-3L(config-if)#no shut DHCP中继配置
Switch(config-if)# ip helper-addre DHCP—ip地址 SW-3L(config)#interface vlan 2
SW-3L(config-if)#ip addre 192.168.2.1 255.255.255.0 SW-3L(config-if)#ip helper-addre 192.168.100.100 SW-3L(config-if)#no shutdown
SW-3L(config)#interface vlan 3 SW-3L(config-if)#ip addre 192.168.3.1 255.255.255.0 SW-3L(config-if)#ip helper-addre 192.168.100.100 SW-3L(config-if)#no shutdown
SW-3L(config)#interface vlan 100 SW-3L(config-if)#ip addre 192.168.100.1 255.255.255.0
SW-3L(config-if)#no shutdown