CCNA命令

2020-03-02 04:51:08 来源:范文大全收藏下载本文

CCNA命令大全

登录网络设备,USB-COM-COM-RJ45,超级终端/SecureCRT Would you like to enter the initial configuration dialog? [yes/no]: //回答no,如果回答了yes,会出现大量对话,Ctrl+C中断对话 % Please answer \'yes\' or \'no\'.Router> //用户模式,只能简单的show及ping/tracer Router>enable //从用户模式进入特权模式

Router# //特权模式,能够进行所有的show及ping/tracer Router#configure terminal//从特权模式进入全局配置模式 Router(config)# //全局配置模式,可以进行相关配置 Router(config)#hostname R1//给设备命名

R1#show version //查看设备软硬件版本信息,开机时间,内存和Flash大小,模块等 R1#show ip interface brief //查看接口信息

R1#show running-config //查看运行在内存中的当前配置 R1#show startup-config //查看开机配置,保存在NVRAM

R1#copy running-config startup-config //将当前运行配置保存到开机配置中 R1#show tech-support //查看设备所有软硬件的详细信息

R1(config)#enable paword xxx//配置enable密码,该密码show run可见

R1(config)#enable secret xxx //配置enable密码,该密码show run不可见,两个同时配置时,secret密码生效

R1(config)#line vty 0 4 //进入telnet配置模式 R1(config-line)#login //telnet登陆需要密码验证 R1(config-line)#paword xxx //配置telnet密码 R1(config-line)#exit R1(config)#line vty 0 4 R1(config-line)#no login //telnet登陆不需要验证 R1(config-line)#exit R1(config)#line vty 0 4 R1(config-line)#login local//telnet登陆需要在本地数据库查找用户名密码进行验证 R1(config-line)#exit R1(config)#username spoto paword xxx //创建本地用户名密码

R1(config)#banner ^!!!!R1!!!!!^ //配置设备登陆提示符,头尾符号需要一致,中间为提示符内容

R1(config)#line vty 0 4 R1(config-line)#privilege level 15//配置telnet用户特权等级为15,即登陆后直接进入enable模式

R1(config-line)#exit R1(config)#interface fastEthernet x/x //进入接口配置模式 R1(config-if)#ip addre x.x.x.x x.x.x.x //配置IP及掩码

R1(config-if)#no shutdown //打开接口,路由器接口默认处于管理性关闭状态 R1(config-if)#exit //退出接口配置模式,返回全局配置模式 R1(config)#no ip routing //关闭路由功能,将路由器模拟成PC R1(config)#ip default-gateway x.x.x.x //配置网关地址 R1#show ip route //查看关闭路由功能后的网关配置 R1#show cdp neighbors //查看思科互连设备信息

R1(config)#interface loopback 0 //创建环回接口0,用于模拟网段和测试

R1(config-if)#ip addre x.x.x.x x.x.x.x//配置环回接口IP及掩码,环回接口不需要no shutdown R1(config-if)#exit R1(config)#ip route x.x.x.x x.x.x.x x.x.x.x //配置使用下一跳地址的静态路由

R1(config)#ip route x.x.x.x x.x.x.x fastEthernet x/x //配置使用本地出接口的静态路由 R1(config)#ip route 0.0.0.0 0.0.0.0 x.x.x.x //配置使用下一跳地址的默认路由

R1(config)#ip route 0.0.0.0 0.0.0.0 fastEthernet x/x //配置使用本地出接口的默认路由 R1#show ip route //查看路由表

R1#ping x.x.x.x //使用出接口作为源IP的普通ping

R1#ping x.x.x.x source x.x.x.x //使用指定源地址的扩展ping R1#debug ip icmp //打开ping的调试过程显示 R1#undebug ip icmp //关闭ping的调试过程显示

R1#traceroute x.x.x.x //路径跟踪,查看到达目的地所经过的IP R1(config)#router rip //运行RIP协议,进入RIP协议配置模式 R1(config-router)#version 2 //配置RIP为版本2

R1(config-router)#no auto-summary//关闭自动汇总功能

R1(config-router)#network x.x.x.x //将相关网段发布到RIP进程中,所有相关子网都会被发布,命令配置不支持带掩码

R1(config-router)#exit //退出RIP协议配置模式

R1(config)#router eigrp x //运行EIGRP,配置EIGRP AS号码,相邻设备的AS号码要求一致

R1(config-router)#no auto-summary//关闭自动汇总功能

R1(config-router)#network x.x.x.x //将相关网段发布到EIGRP进程中,所有相关子网都会被发布

R1(config-router)#network x.x.x.x x.x.x.x //将相关网段精确发布到EIGRP进程中,命令配置支持带反掩码

R1(config-router)#exit //退出EIGRP协议配置模式 R1#show ip eigrp neighbors//查看EIGRP邻居表 R1#show ip eigrp topology //查看EIGRP拓扑表

R1(config)#router ospf x //运行OSPF,配置OSPF本地进程号,该号码仅有本地意义 R1(config-router)#network x.x.x.x x.x.x.x area x //相关网段精确发布到OSPF区域中,命令配置要求带反掩码,相邻设备区域号要相同

R1(config-router)#auto-cost reference-bandwidth x //修改参考带宽,单位是兆 R1(config-router)#exit //退出OSPF协议配置模式 R1#show ip ospf neighbor //查看OSPF邻居表 R1#show ip ospf database //查看OSPF拓扑表

R1#show ip ospf interface //查看OSPF接口状态信息,包括RID、网络类型、hello时间等

在C3640上加载NM-16ESW模块来模拟交换机。如果是模拟2层交换机,需要关闭路由功能。

Switch#vlan database //进入VLAN数据库模式 Switch(vlan)#vlan x //创建VLAN,删除时前面加no Switch(vlan)#exit Switch#show vlan-switch //查看VLAN表及所属端口,真实设备或IOU模拟器上的命令为show vlan

Switch#show vtp status //查看VTP信息,包括域名、版本、模式等 Switch(config)#int fastEthernet x/x Switch(config-if)#switchport mode acce //配置端口模式为acce

Switch(config-if)#switchport acce vlan 10 //将该端口划入VLAN10,默认所有端口属于VLAN1

Switch(config-if)#exit Switch(config)#int fastEthernet x/x //进入单臂路由主接口

Switch(config-if)#switchport trunk encapsulation dot1q //指定trunk封装使用802.1Q,当交换机支持802.1Q和ISL时使用

Switch(config-if)#switchport mode trunk //配置端口模式为trunk Switch(config-if)#exit Switch#show interfaces trunk //查看交换机trunk接口信息及状态 Switch(config)#interface vlan x //进入管理IP所在的接口 Switch(config-if)#ip addre x.x.x.x x.x.x.x //配置交换机的管理IP Switch(config-if)#exit Switch(config)#ip default-gateway x.x.x.x //配置交换机的网关地址,实现跨网段远程管理

R1(config)#interface fastEthernet x/x R1(config-if)#no shutdown //单臂路由配置,只需要主接口开启,子接口会自动继承开启 R1(config-if)#exit R1(config)#interface fastEthernet x/x.x //进入子接口配置模式

R1(config-subif)#encapsulation dot1Q x //配置封装为802.1Q,并指定该子接口所对应的VLAN

R1(config-subif)#ip addre x.x.x.x x.x.x.x //配置该VLAN的网关地址 R1(config-subif)#exit R1(config)#acce-list x permit x.x.x.x //允许来自某台主机的流量 R1(config)#acce-list x permit x.x.x.x x.x.x.x //允许来自某个网段的流量 R1(config)#acce-list x deny any //标准ACL的默认操作是拒绝所有流量 R1(config)#interface fastEthernet x/x R1(config-if)#ip acce-group x in //将CAL应用在接口的入方向 R1(config-if)#ip acce-group x out //将ACL应用在接口的出方向 R1(config-if)#exit R1(config)#line vty 0 4 R1(config-line)#acce-cla 1 in //telnet远程控制,有在ACL中被允许的主机能远程telnet到本机。 R1(config-line)#exit R1(config)#acce-list 100 permit ip x.x.x.x x.x.x.x x.x.x.x x.x.x.x //允许某个网段到某个网段的流量通过

R1(config)#acce-list 100 permit ip host x.x.x.x host x.x.x.x //允许某台主机到某台主机的流量通过

R1(config)#acce-list 100 permit ip any any //允许任何IP流量通过 R1(config)#acce-list 100 permit tcp any any eq x //允许某种TCP流量通过 R1(config)#acce-list 100 permit udp any any eq x //允许某种UDP流量通过 R1(config)#acce-list 100 permit icmp any any //允许ping包通过

R1(config)#acce-list 100 deny ip any any //扩展ACL的默认操作是拒绝所有流量 R1#show acce-lists //查看ACL内容及匹配情况 R1(config)#interface fastEthernet x/x R1(config-if)#ip nat inside //指定接口为NAT的inside端 R1(config)#interface fastEthernet x/x R1(config-if)#ip nat outside //指定接口为NAT的outside端

R1(config)#ip nat inside source list 1 interface fastEthernet x/x overload//配置基于出接口的PAT

R1(config)#acce-list 1 permit any //允许任何IP作为NAT的源地址 R1(config)#ip nat inside source static x.x.x.x x.x.x.x //配置静态NAT

R1(config)#ip nat pool spoto x.x.x.x x.x.x.x netmask 255.255.255.0 //配置NAT的地址池

R1(config)#ip nat inside source list 1 pool spoto overload //配置基于地址池的PAT R1(config)#ip nat inside source static tcp x.x.x.x x interface FastEthernetx/x x //配置静态端口映射

R1#show ip nat translations //查看NAT转换表

R1#clear ip nat translation * //清除NAT转换表,静态条目不会被删除 R1-S/C(config)#int serial x/x R1-S/C(config-if)#clock rate 64000 R1-S/C(config-if)#encapsulation ppp //将接口封装从默认的HDLC改为PPP封装 PAP认证配置,认证服务器端:

R1-S(config)#username xxx paword xxx //在认证服务器端配置本地用户名密码 R1-S(config-if)#ppp authentication pap //在认证服务器端开启pap认证要求 PAP认证配置,认证客户端:

R1-C(config-if)#ppp pap sent-username xxx paword xxx //在认证客户端配置pap发送的用户名和密码

CHAP认证配置,认证服务器端:

R1-S(config)#username xxx paword xxx //在认证服务器端配置本地用户名密码 R1-S(config-if)#ppp authentication chap //在认证服务器端开启chap认证要求 CHAP认证配置,认证客户端:

R1-C(config-if)#ppp chap hostname xxx //在认证客户端配置chap发送的用户名 R1-C(config-if)#ppp chap paword xxx //在认证客户端配置chap发送的密码 FRSW(config)#frame-relay switching //将路由器模拟成帧中继交换机 FRSW(config)#int serial x/x FRSW(config-if)#clock rate 64000 FRSW(config-if)#encapsulation frame-relay //将接口封装从默认的HDLC改为帧中继封装

FRSW(config-if)#frame-relay intf-type dce //指定帧中继交换机接口类型为DCE FRSW(config-if)#frame-relay route xxx interface serial x/x xxx //配置帧中继交换路径 FRSW(config-if)#exit FRR(config)#int serial x/x FRR(config-if)#encapsulation frame-relay //配置帧中继路由器接口封装从默认的HDLC改为FR

FRR(config-if)#ip addre x.x.x.x x.x.x.x FRR(config-if)#frame-relay map ip x.x.x.x x broadcast//静态配置IP到DLCI的映射关系,指定对端IP及本端使用的DLCI值 FRR(config-if)#exit FRR#show frame-relay map //查看帧中继映射表 FRR(config)#int serial x/x FRR(config-if)#ip ospf network point-to-multipoint //帧中继下OSPF默认模式是NBMA,无法自动建立邻居。手动修改网络类型为PTMP或PTP FRR(config-if)#exit CCNA关键知识: 网络模型、IP&VLSM 静态路由&默认路由

动态路由RIPv

2、EIGRP、OSPF VLAN、Acce、Trunk、VTP、STP、单臂路由、2层交换机远程管理 ACL、NAT WAN、PPP、IPv

6、WLAN

希望以上的分享能给正在学习CCNA的童鞋们,有所帮助哈~~~~

命令

CCNA实验总结

CCNA中文版题库

CCNA实验心得

CCNA学习大纲

CCNA考试心得

CCNA培训心得

CCNA考试心得

CCNA学习日记

CCNA题库6

《CCNA命令.doc》
CCNA命令
将本文的Word文档下载到电脑,方便收藏和打印
推荐度:
点击下载文档
下载全文