思科交换机常用的100个命令 在思科交换机上的命令有哪些?哪些命令最实用,你知道吗?下面我为大家分享最常用的思科交换机基本命令,希望能帮助到大家! 1:进入特权模式enable switch》 enable switch 2:进入全局配置模式configure terminal switch》 enable switchc onfigure terminal switch(conf) 3:交换机命名hostname aptech3950 以aptech3950 为例 switch》 enable switchc onfigure terminal switch(conf)hostname aptch-2950 aptech3950(conf) 4:配置使能口令enable password cisco 以cisco 为例 switch》 enable switchc onfigure terminal switch(conf)hostname aptch3950 aptech3950(conf) enable password cisco 5:配置使能密码enable secret ciscolab 以cicsolab 为例 switch》 enable switchc onfigure terminal switch(conf)hostname aptch3950 aptech3950(conf) enable secret ciscolab 6:设置虚拟局域网vlan 1 interface vlan 1 switch》 enable switchc onfigure terminal switch(conf)hostname aptch3950 aptech3950(conf) interface vlan 1 aptech3950(conf-if)ip address 192.168.1.1 255.255.255.0 配置交换机端口ip 和子网掩 码 aptech3950(conf-if)no shut 是配置处于运行中 aptech3950(conf-if)exit aptech3950(conf)ip default-gateway 192.168.254 设置网关地址 7:进入交换机某一端口interface fastehernet 0/17 以17 端口为例 switch》 enable switchc onfigure terminal switch(conf)hostname aptch3950 aptech3950(conf) interface fastehernet 0/17 aptech3950(conf-if) 8:查看命令show switch》 enable switch show version 察看系统中的所有版本信息 show interface vlan 1 查看交换机有关ip 协议的配置信息 show running-configure 查看交换机当前起作用的配置信息 show interface fastethernet 0/1 察看交换机1 接口具体配置和统计信息 show mac-address-table 查看mac 地址表 show mac-address-table aging-time 查看mac 地址表自动老化时间 9:交换机恢复出厂默认恢复命令 switch》 enable switch erase startup-configure switch reload 10:双工模式设置 switch》 enable switchc onfigure terminal switch3950(conf)hostname aptch-2950 aptech3950(conf) interface fastehernet 0/17 以17 端口为例 aptech3950(conf-if)duplex full/half/auto 有full , half, auto 三个可选 项 11:cdp 相关命令 switch》 enable switch show cdp 查看设备的cdp 全局配置信息 show cdp interface fastethernet 0/17 查看17 端口的cdp 配置信息 show cdp traffic 查看有关cdp 包的统计信息 show cdp nerghbors 列出与设备相连的cisco 设备 12:csico2950 的密码恢复 拔下交换机电源线。 用手按着交换机的MODE 键,插上电源线 在switch:后执行flash_ini 命令:switch: flash_ini 查看flash 中的文件: switch: dir flash: 把“config.text”文件改名为“config.old”: switch: rename flash: config.text flash: config.old 执行boot: switch: boot 交换机进入是否进入配置的对话,执行no : 进入特权模式察看flash 里的文件: show flash : 把“config.old”文件改名为“config.text”: switch: rename flash: config.old flash: config.text 把“ config.text ” 拷入系统的“ running-configure ”: copy flash: config.text system : running-configure 把配置模式重新设置密码存盘,密码恢复成功。 13:交换机telnet 远程登录设置: switch》en switchc onfigure terminal switch(conf)hostname aptech-2950 aptech3950(conf)enable password cisco 以cisco 为特权模式密码 aptech3950(conf)interface fastethernet 0/1 以17 端口为telnet 远程登录端口 aptech3950(conf-if)ip address 192.168.1.1 255.255.255.0 aptech3950(conf-if)no shut aptech3950(conf-if)exit aptech3950(conf)line vty 0 4 设置0-4 个用户可以telnet 远程登陆 aptech3950(conf-line)login aptech3950(conf-line)password edge 以edge 为远程登录的用户密码 主机设置: ip 192.168.1.2 主机的ip 必须和交换机端口的地址在同一网络 段 netmask 255.255.255.0 gate-way 192.168.1.1 网关地址是交换机端口地址 运行: telnet 192.168.1.1 进入telnet 远程登录界面 password : edge aptech3950》en password: cisco aptech 14:交换机配置的重新载入和保存 设置完成交换机的配置后: aptech3950(conf)reload 是否保存(y/n) y: 保存设置信息n:不保存设置信息 1.在基于IOS 的.交换机上设置主机名/系统名: switch(config) hostname hostname 在基于CLI 的交换机上设置主机名/系统名: switch(enable) set system name name-string 2.在基于IOS 的交换机上设置登录口令: switch(config) enable password level 1 password 在基于CLI 的交换机上设置登录口令: switch(enable) set password switch(enable) set enalbepass 3.在基于IOS 的交换机上设置远程访问: switch(config) interface vlan 1 switch(config-if) ip address ip-address netmask switch(config-if) ip default-gateway ip-address 在基于CLI 的交换机上设置远程访问: switch(enable) set interface sc0 ip-address netmask broadcast-address switch(enable) set interface sc0 vlan switch(enable) set ip route default gateway 4.在基于IOS 的交换机上启用和浏览CDP 信息: switch(config-if) cdp enable switch(config-if) no cdp enable 为了查看Cisco 邻接设备的CDP 通告信息: switch show cdp interface switch show cdp neighbors 在基于CLI 的交换机上启用和浏览CDP 信息: switch(enable) set cdp {enable|disable} module/port 为了查看Cisco 邻接设备的CDP 通告信息: switch(enable) show cdp neighbors 5.基于IOS 的交换机的端口描述: switch(config-if) description description-string 基于CLI 的交换机的端口描述: switch(enable)set port name module/number description-string 6.在基于IOS 的交换机上设置端口速度:
查看交换机日志文件的步骤; 1、首先你要开启交换机的日志功能,logging on 2、然后用命令查看show logging buffer 查看最近的日志, 3、如果你要所有日志就只有建立日志服务器, 4、如果你网内有linux或者unix服务器就方便了,只需启动一个服务,修改几个参数,
你还在为不知道而烦恼么?接下来是我为大家收集的教程,希望能帮到大家。 一、 基本路由器的检验命令 show version show processes show protocols show mem show ip route show startup-config show running-config show flash 》show interfaces 二、 基本路由配置命令 进入:config terminal/memory/network 配置网路时常采用的命令:copy和load 1.标识:hostname 标识名 2.启动标识:banner 启动标识 3.介面:interface 埠号 4.密码:line 0 6 login passwd 口令 enable password/secret 口令 5.介面: 1配置埠 interface 埠号 clock rate 时钟速率64000/* 在串列埠中配置 */ bandwidth 频宽预设56 /* 在串列埠中配置 */ media-type 介质型别 /* 在乙太网口上 */ early-token release /* 在令牌环网口上 */ ring-speed 16 /* 在令牌环网口上 */ no shutdown write memory 2检验埠 show interfaces show controllers 6. 配置环境 1 引导方式 boot system flash IOS-filename boot system tftp IOS-filename tftp-address boot system rom 2 配置Register值 config-register 0x2102 7. 检视邻居路由 show cdp interface show cdp neighbors show cdp entry routerA 8.IP Address 配置 Ip address 网路地址 掩码 Ip host 主机名 address Ip name-server 伺服器地址1 伺服器地址2 。。。 Ip domain-lookup nsap Show hosts Ping 主机名/IP地址 Trace 主机名/IP地址 三、IP 路由 1.静态路由 ip routing ip route 目标网路号 掩码 埠号 2.预设路由 ip default-network 网路号 3.动态路由 1RIP配置 Router rip Network 网路号 Show ip route Show ip protocol Debug ip 2OSPF 配置 Router ospf 程序号 Redistribute 其它路由协议 Network 埠网路 反掩码 area 区域号 Area 区域号 range 网路号 掩码 Area 区域号 default-cost 花销值 Ip ospf priority number Ip ospf cost 花销值 Show ip ospf database 3BGP 配置 Router bgp 自治域号 Redistribute 其它路由协议 Network 网路号 /* 自治域内 */ Aggregate-address 网路号 掩码 summary-only 汇总网路 Neighbor 相邻网路号 remote-as 自治域号 /* 自治域间的网路 */ 四、流量控制 1被动埠 passive interface 埠号 2预设路由 ip default 网路号/埠网路 3静态路由 ip route 目标网路号 掩码 埠号 4ACL过滤表 全域性上 access-list 访问号1 {permit deny} 反掩码号 access-list 访问号2 {permit deny} IP/TCP协议 源网路 目的网路 操作符 引数 埠上access-group 访问号 in out distribute-list 访问号 in out 埠号 4Null 0 interface Ip route address mask null 0 五、广义网配置 1PPP Ppp pap sent-usename 封装 Ppp chap hostname Ppp chap password 2X.25 encapsulation x25 x25 address x25 map 协议地址 /*SVC */ x25 pvc pvc号 ip地址 x25地址 /*PVC */ ip switching x25 route x.121地址 介面 x.121对映地址 3FrameRelay Frame-relay local-dlci IP网路号 Frame-relay map 协议地址 Frame-relay lmi-type ansi
1、首先我们按着如下图所示搭建一个实验的拓扑图。
2、按着上面的拓扑图我们首先配置接入层交换机的基本配置信息,如下图所示先将接入的PC的接口配置好。
3、将一台接入层 交换机和两台核心交换机的生成树模式都修改为MSTP多实例生成树模式。
4、接着我们就需要配置三台交换机之间的链路模式以及封装了,如下图所示在两两之间相连的线路上都需配置成TRUNK模式。
5、在核心交换机上运行VTP协议,是的三个交换机VLAN 信息可以同步。
6、我们设计将VLAN 10,VLAN 20分到一个实例12中,将VLAN 30,VLAN 40分到另一个实例34中,如下图所示我们开始配置MSTP。
7、现在我们来查看接入层交换机的生成树状态,如下图所示我们可以看在实例12中交换机的E0/1口为AP,在实例34中交换机的E0/0口为AP,实现了互为主备的关系,让交换网络实现的负载均衡。
思科路由器查看配置的命令是routershow run。
路由器显示命令:
routershow interface ;显示接口信息
routershow ip route ;显示路由信息
routershow cdp nei ;显示邻居信息
routerreload ;重新起动
路由器口令设置:
router》enable ;进入特权模式
routerconfig terminal ;进入全局配置模式
router(config)hostname ;设置交换机的主机名
router(config)enable secret xxx ;设置特权加密口令
router(config)enable password xxb ;设置特权非密口令
router(config)line console 0 ;进入控制台口
router(config-line)line vty 0 4 ;进入虚拟终端
router(config-line)login ;要求口令验证
router(config-line)password xx ;设置登录口令xx
router(config)(Ctrl+z) ; 返回特权模式
routerexit ;返回命令
扩展资料:
路由器配置:
router(config)int s0/0 ;进入Serail接口
router(config-if)no shutdown ;激活当前接口
router(config-if)clock rate 64000 ;设置同步时钟
router(config-if)ip address ;设置IP地址
router(config-if)ip address second ;设置第二个IP
router(config-if)int f0/0.1 ;进入子接口
router(config-subif.1)ip address ;设置子接口IP
router(config-subif.1)encapsulation dot1q ;绑定vlan中继协议
router(config)config-register 0x2142 ;跳过配置文件
router(config)config-register 0x2102 ;正常使用配置文件
routerreload ;重新引导
参考资料来源:Cisco-思科路由器
cisco制造的路由器设备、交换机和其他设备承载了全世界80%的互联网通信,成为硅谷中新经济的传奇,那么你了解Cisco常用的路由器交换机配置命令吗?下面是我整理的一些关于Cisco常用的路由器交换机配置命令的相关资料,供你参考。
Cisco常用的路由器支持的命令:
路由器显示命令:
routershow run ;显示配置信息
routershow interface ;显示接口信息
routershow ip route ;显示路由信息
routershow cdp nei ;显示邻居信息
routerreload ;重新起动
路由器口令设置:
router》enable ;进入特权模式
routerconfig terminal ;进入全局配置模式
router(config)hostname ;设置交换机的主机名
router(config)enable secret xxx ;设置特权加密口令
router(config)enable password xxb ;设置特权非密口令
router(config)line console 0 ;进入控制台口
router(config-line)line vty 0 4 ;进入虚拟终端
router(config-line)login ;要求口令验证
router(config-line)password xx ;设置登录口令xx
router(config)(Ctrl+z) ; 返回特权模式
routerexit ;返回命令
路由器配置:
router(config)int s0/0 ;进入Serail接口
router(config-if)no shutdown ;激活当前接口
router(config-if)clock rate 64000 ;设置同步时钟
router(config-if)ip address ;设置IP地址
router(config-if)ip address second ;设置第二个IP
router(config-if)int f0/0.1 ;进入子接口
router(config-subif.1)ip address ;设置子接口IP
router(config-subif.1)encapsulation dot1q ;绑定vlan中继协议
router(config)config-register 0x2142 ;跳过配置文件
router(config)config-register 0x2102 ;正常使用配置文件
routerreload ;重新引导
路由器文件操作:
routercopy running-config startup-config ;保存配置
routercopy running-config tftp ;保存配置到tftp
routercopy startup-config tftp ;开机配置存到tftp
routercopy tftp flash: ;下传文件到flash
routercopy tftp startup-config ;下载配置文件
ROM状态:
Ctrl+Break ;进入ROM监控状态
rommon》confreg 0x2142 ;跳过配置文件
rommon》confreg 0x2102 ;恢复配置文件
rommon》reset ;重新引导
rommon》copy xmodem: flash: ;从console传输文件
rommon》IP_ADDRESS=10.65.1.2 ;设置路由器IP
rommon》IP_SUBNET_MASK=255.255.0.0 ;设置路由器掩码
rommon》TFTP_SERVER=10.65.1.1 ;指定TFTP服务器IP
rommon》TFTP_FILE=c2600.bin ;指定下载的文件
rommon》tftpdnld ;从tftp下载
rommon》dir flash: ;查看闪存内容
rommon》boot ;引导IOS
静态路由:
ip route ;命令格式
router(config)ip route 2.0.0.0 255.0.0.0 1.1.1.2 ;静态路由举例
router(config)ip route 0.0.0.0 0.0.0.0 1.1.1.2 ;默认路由举例
动态路由:
router(config)ip routing ;启动路由转发
router(config)router rip ;启动RIP路由协议。
router(config-router)network ;设置发布路由
router(config-router)negihbor ;点对点帧中继用。
帧中继命令:
router(config)frame-relay switching ;使能帧中继交换
router(config-s0)encapsulation frame-relay ;使能帧中继
router(config-s0)fram-relay lmi-type cisco ;设置管理类型
router(config-s0)frame-relay intf-type DCE ;设置为DCE
router(config-s0)frame-relay dlci 16 ;
router(config-s0)frame-relay local-dlci 20 ;设置虚电路号
router(config-s0)frame-relay interface-dlci 16 ;
router(config)log-adjacency-changes ;记录邻接变化
router(config)int s0/0.1 point-to-point ;设置子接口点对点
routershow frame pvc ;显示永久虚电路
routershow frame map ;显示映射
基本访问控制列表:
router(config)access-list permit|deny
router(config)interface ;default:deny any
router(config-if)ip access-group in|out ;defaultut
例1:
router(config)access-list 4 permit 10.8.1.1
router(config)access-list 4 deny 10.8.1.0 0.0.0.255
router(config)access-list 4 permit 10.8.0.0 0.0.255.255
router(config)access-list 4 deny 10.0.0.0 0.255.255.255
router(config)access-list 4 permit any
router(config)int f0/0
router(config-if)ip access-group 4 in
扩展访问控制列表:
access-list permit|deny icmp
access-list permit|deny tcp
例3:
router(config)access-list 101 deny icmp any 10.64.0.2 0.0.0.0 echo
router(config)access-list 101 permit ip any any
router(config)int s0/0
router(config-if)ip access-group 101 in
例3:
router(config)access-list 102 deny tcp any 10.65.0.2 0.0.0.0 eq 80
router(config)access-list 102 permit ip any any
router(config)interface s0/1
router(config-if)ip access-group 102 out
删除访问控制例表:
router(config)no access-list 102
router(config-if)no ip access-group 101 in
路由器的nat配置
Router(config-if)ip nat inside ;当前接口指定为内部接口
Router(config-if)ip nat outside ;当前接口指定为外部接口
Router(config)ip nat inside source static
Router(config)ip nat inside source static 10.65.1.2 60.1.1.1
Router(config)ip nat inside source static tcp 10.65.1.3 80 60.1.1.1 80
Router(config)ip nat pool p1 60.1.1.1 60.1.1.20 255.255.255.0
Router(config)ip nat inside source list 1 pool p1
Router(config)ip nat inside destination list 2 pool p2
Router(config)ip nat inside source list 2 interface s0/0 overload
Router(config)ip nat pool p2 10.65.1.2 10.65.1.4 255.255.255.0 type rotary
Routershow ip nat translation
rotary 参数是轮流的意思,地址池中的IP轮流与NAT分配的地址匹配。
overload参数用于PAT 将内部IP映射到一个公网IP不同的端口上。
外部网关协议配置
routerA(config)router bgp 100
routerA(config-router)network 19.0.0.0
routerA(config-router)neighbor 8.1.1.2 remote-as 200
配置PPP验证:
RouterA(config)username password
RouterA(config)int s0
RouterA(config-if)ppp authentication {chap|pap}
3.PIX防火墙命令
Pix525(config)nameif ethernet0 outside security0 ;命名接口和级别
Pix525(config)interface ethernet0 auto ;设置接口方式
Pix525(config)interface ethernet1 100full ;设置接口方式
Pix525(config)interface ethernet1 100full shutdown
Pix525(config)ip address inside 192.168.0.1 255.255.255.0
Pix525(config)ip address outside 133.0.0.1 255.255.255.252
Pix525(config)global (if_name) natid ip-ip ;定义公网IP区间
Pix525(config)global (outside) 1 7.0.0.1-7.0.0.15 ;例句
Pix525(config)global (outside) 1 133.0.0.1 ;例句
Pix525(config)no global (outside) 1 133.0.0.1 ;去掉设置
Pix525(config)nat (if_name) nat_id local_ip
Pix525(config)nat (inside) 1 0 0
内网所有主机(0代表0.0.0.0)可以访问global 1指定的外网。
Pix525(config)nat (inside) 1 172.16.5.0 255.255.0.0
内网172.16.5.0/16网段的主机可以访问global 1指定的外网。
Pix525(config)route if_name 0 0 gateway_ip ;命令格式
Pix525(config)route outside 0 0 133.0.0.1 1 ;例句
Pix525(config)route inside 10.1.0.0 255.255.0.0 10.8.0.1 1 ;例句
Pix525(config)static (inside, outside) 133.0.0.1 192.168.0.8
表示内部ip地址192.168.0.8,访问外部时被翻译成133.0.0.1全局地址。
Pix525(config)static (dmz, outside) 133.0.0.1 172.16.0.8
中间区域ip地址172.16.0.8,访问外部时被翻译成133.0.0.1全局地址。
Cisco常用的交换机支持的命令:
交换机基本状态:
switch: ;ROM状态, 路由器是rommon》
hostname》 ;用户模式
hostname ;特权模式
hostname(config) ;全局配置模式
hostname(config-if) ;接口状态
交换机口令设置:
switch》enable ;进入特权模式
switchconfig terminal ;进入全局配置模式
switch(config)hostname ;设置交换机的主机名
switch(config)enable secret xxx ;设置特权加密口令
switch(config)enable password xxa ;设置特权非密口令
switch(config)line console 0 ;进入控制台口
switch(config-line)line vty 0 4 ;进入虚拟终端
switch(config-line)login ;允许登录
switch(config-line)password xx ;设置登录口令xx
switchexit ;返回命令
交换机VLAN设置:
switchvlan database ;进入VLAN设置
switch(vlan)vlan 2 ;建VLAN 2
switch(vlan)no vlan 2 ;删vlan 2
switch(config)int f0/1 ;进入端口1
switch(config-if)switchport access vlan 2 ;当前端口加入vlan 2
switch(config-if)switchport mode trunk ;设置为干线
switch(config-if)switchport trunk allowed vlan 1,2 ;设置允许的vlan
switch(config-if)switchport trunk encap dot1q ;设置vlan 中继
switch(config)vtp domain ;设置发vtp域名
switch(config)vtp password ;设置发vtp密码
switch(config)vtp mode server ;设置发vtp模式
switch(config)vtp mode client ;设置发vtp模式
交换机设置IP地址:
switch(config)interface vlan 1 ;进入vlan 1
switch(config-if)ip address ;设置IP地址
switch(config)ip default-gateway ;设置默认网关
switchdir flash: ;查看闪存
交换机显示命令:
switchwrite ;保存配置信息
switchshow vtp ;查看vtp配置信息
switchshow run ;查看当前配置信息
switchshow vlan ;查看vlan配置信息
switchshow interface ;查看端口信息
switchshow int f0/0 ;查看指定端口信息
1、查看vlan命令:
Switchshow vlan 查看vlan数据库,vlan信息和所属接口
2、配置VLAN命令(交换机配置VLAN,并给将端口加入到该VLAN为例):
cisco-sw1(config)vlan 2
cisco-sw1(config-vlan)name test
cisco-sw1(config-vlan)exit
cisco-sw1(config)interface fastEthernet 0/1
cisco-sw1(config-if)switchport mode access
cisco-sw1(config-if)switchport access vlan 2
3、接口配置命令(进入交换机某一端口)
switch》 enable
switch#configure terminal
switch(conf) interface fastehernet 0/1
switch(conf-if)
扩展资料:
思科交换机其他查看和配置命令:
1、Switchshow running-config查看运行配置,可以通过回车键逐行显示,也可通过空格键逐页显示
2、Switchshow version查看设备软件版本信息
3、Switchshow clock查看系统时钟也可用于查看log日志后对应时钟分析异常log的发起时间
4、Switchshow log查看日志,如接口异常关闭,链路的通断,主备机切换
5、Switchshow interface查看接口详细状态,如IP地址、MAC地址、带宽负载及输入输出速率等
6、Switchshow interface description快速查看接口连接状态与描述
7、Switchshow interface status快速查看接口状态及所属vlan及速率双工
8、Switchshow cdp neighbor查看CDP邻居,CDP协议属于思科私有协议,只能用于查看思科设备,可以查看设备的物理链路状态和连接接口管理地址
9、Switchshow mac-addess-table 查看交换机的MAC地址,括号里面是可选项
思科2960交换机配置命令如下:
1、access: 主要用来接入终端设备,如PC机、服务器、打印服务器等。
2、trunk: 主要用在连接其它交换机,以便在线路上承载多个vlan。
3、multi: 在一个线路中承载多个vlan,但不像trunk,它不对承载的数据打标签。主要用于接入支持多vlan的服务器或者一些网络分析设备。现在基本不使用此类接口,在cisco的网络设备中,也基本不支持此类接口了。
交换机口令设置:
1、switch》enable;进入特权模式、switchconfigterminal;进入全局配置模式、switch(config)hostname;设置交换机的主机名。
2、switch(config)enablesecretxxx;设置特权加密口令、switch(config)enablepasswordxxa;设置特权非密口令。
3、switch(config)lineconsole0;进入控制台口、switch(config-line)linevty04;进入虚拟终端。
4、switch(config-line)login;允许登录、switch(config-line)passwordxx;设置登录口令xx、switchexit;返回命令。
推发布温馨提示: