如何使用cisco常用命令

今天给小伙伴们介绍一下如何使用cisco常用命令:

 

如何使用cisco常用命令

进入特权模式

Router>enable

进入配置模式

Router#configure terminal

特权模式下查看全局配置

Router#show running-config

非特权模式下查看全局配置(+do 在非特权模式下使用do show查看配置)

Router(config)#do show running-config

重启

Router#reload

保存配置

Router#write

清空配置

Router#write erase

删除命令

Router(config-if)#no ip address

修改主机名

Router(config)#hostname R1

设置进入特权模式的密码

Router(config)#enable password

设置远程登录

line vty 0 4
password cisco@123
login //允许登录
transport input telnet //允许协议

远程登录时查看日志信息

Router#terminal monitor

路由功能

Switch(config)#ip routing //开启路由功能
Switch(config)#no ip routing //关闭路由功能
Switch(config)#ip default-gateway 192.168.1.254 //设置默认网关

查看MAC地址表

Switch#show mac address-table

设置全/半双工

Router(config-if)#duplex full/half

路由管理距离(类似Huawei 优先级)

Router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.1 ?
Protocol Distance
Direct 0
Static 1
Rip 120
OSPF 110
Eigrp 90(170)
CDP协议(思科私有,与LLDP相同)
Router#show cdp neighbors
VLAN,接口
Switch(config)#vlan 10,20,30 //同时创建多个vlan
interface Ethernet0/1
switchport access vlan 10
switchport mode access
interface Ethernet0/2
switchport trunk encapsulation dot1q //配置封装模式(Cisco默认私有模式ISL)
switchport trunk native vlan 10 //本征vlan(类似华为pvid)
switchport mode trunk
switchport trunk allowed vlan all
switchport trunk allowed vlan 10
switchport trunk allowed vlan remove 10//不允许某个vlan通过
子接口
interface Ethernet0/1.10 //创建子接口
encapsulation dot1Q 10 //封装vlan10
ip address 192.168.10.1 255.255.255.0

DHCP

ip dhcp excluded-address 192.168.10.250 192.168.10.254
ip dhcp pool dhcp-pool
network 192.168.10.0 255.255.255.0
default-router 192.168.10.254
dns-server 114.114.114.114
Switch(config-if)#ip helper-address 192.168.20.254 //dhcp中继
Router#show ip dhcp conflict //查看地址冲突
Router#clear ip dhcp conflict * //清除dhcp冲突地址
Router#show dhcp server

ACL

Router(config)#access-list 1 permit 192.168.10.1 0.0.0.0 //基本acl
Router(config)#access-list 100 permit tcp 192.168.10.1 0.0.0.0 eq 80 1.1.1.1 0.0.0.0 eq 8000 //扩展acl
//基于名称的acl(可以设置规则序号)
Router(config)#ip access-list standard ciaco-acl
Router(config-std-nacl)#11 permit 192.168.1.1 0.0.0.0
Router(config-if)#ip access-group 1 in/out //在接口上应用acl

NAT

interface Ethernet0/0
ip address 192.168.10.1 255.255.255.0
ip nat inside //内网人口
interface Ethernet0/1
ip address 200.1.1.1 255.255.255.0
ip nat outside //外网出口
access-list 10 permit 192.168.10.0 0.0.0.255
ip nat inside source list 10 interface Ethernet0/1 //nat转换
ip nat inside source static tcp 192.168.10.23 23 200.1.1.1 23 //端口映射

链路聚合

Switch(config)#interface range ethernet 0/2 - 3 //创建接口组(类似port-group)
Switch(config-if-range)#channel-group 12 mode active //创建channel id(两端id不需要相同),设置模式
// shutdown状态下配置,如果不成功更换channel id
Switch#show etherchannel summary //查看命令

 

VTP(私有用于vlan同步,只用于交换机间的接口是trunk口)

{vtp是危险协议,推荐修改为透明模式}
Switch(config)#vtp mode ?
client Set the device to client mode. //客户端模式(用于同步配置,不能创建修改删除vlan)
off Set the device to off mode. //关闭
server Set the device to server mode. //服务器模式(同步配置,可以创建修改删除vlan)
transparent Set the device to transparent mode. //透明模式(推荐配置,不会被同步)
vtp domain cisco //创建vtp域名
vtp version 2 //修改版本(v1,v2,v3存在版本兼容问题)
vtp password cisco@123 //设置认证密码

HSRP(类似vrrp)

interface Ethernet0/1
ip address 192.168.1.2 255.255.255.0
standby 12 ip 192.168.1.254 //设置虚拟IP(standby id 两端必须一致)
standby 12 priority 110 //设置优先级(默认100,越大越优)
standby 12 preempt //开启抢占

PPP

username admin password 0 cisco@123 //设置用户,密码
interface Serial1/0
ip address 192.168.10.1 255.255.255.0
encapsulation ppp //封装为PPP
ppp authentication chap/pap //认证模式为chap或pap
interface Serial1/0
ip address 192.168.10.2 255.255.255.0
encapsulation ppp
ppp chap hostname admin
ppp chap password ciaco@123
ppp pap sent-username admin password ciaco@123

PPPoE

Server:bba-group pppoe Cisco
virtual-template 1
interface Ethernet0/1
no ip address
pppoe enable group Cisco
username admin password 0 cisco@123
ip local pool pppoe-pool 200.1.1.2 200.1.1.10 //创建可分配的地址池
interface Virtual-Template1
ip address 200.1.1.1 255.255.255.0
peer default ip address pool pppoe-pool
ppp authentication chap

Client:

interface Ethernet0/1
no ip address
pppoe enable
pppoe-client dial-pool-number 1
interface Dialer1
ip address negotiated
ip mtu 1492 //1500-ppp头部
encapsulation ppp
ip tcp adjust-mss 1452 //1500-(ppp头部+ip头部+tcp头部)
dialer pool 1
ppp authentication chap callin //启用chap验证
ppp chap hostname admin
ppp chap password 0 cisco@123

GRE

interface Tunnel10
ip address 10.1.1.1 255.255.255.0
tunnel source 1.1.1.1 //本端公网IP
tunnel destination 2.2.2.2 //对端公网IP

以上就是关于“如何使用cisco常用命令”的相关解答,若有不清楚的可以咨询酷番云酷番云作为云南为数不错持有ICP/ISP/IDC等资质专业云计算提供商之一,成本控制良好,性价比高!提供各类云服务器产品及ICP备案一站式服务,操作简单快捷,7*24小时不间断售后运维技术支持,专业备案团队全力支持。

产品选购地址:

https://www.kufanyun.com/server/

图片来源于AI模型,如侵权请联系管理员。作者:路飞,如若转载,请注明出处:https://www.kufanyun.com/ask/1166.html

(0)
上一篇 2021年10月27日 16:06
下一篇 2021年10月29日 14:47

相关推荐

  • 电路板上的cdn代表什么,它在电子设备中扮演什么角色?

    电路板上的CDN是什么意思:什么是CDN?CDN,全称为内容分发网络(Content Delivery Network),是一种通过在全球范围内部署多个节点,将互联网内容缓存到这些节点上,以实现快速、高效地向用户分发内容的技术,CDN的核心思想是将用户请求的内容从源服务器转移到离用户最近的节点上,从而减少数据传……

    2025年12月11日
    02800
  • 光电通3104cdn连接电脑打印不正常怎么办?

    在日常办公环境中,打印机作为不可或缺的输出设备,其稳定性至关重要,即便是像光电通3104cdn这样性能可靠的机型,用户也时常会遇到连接电脑后打印不正常的困扰,这种问题可能表现为无法打印、打印乱码、打印任务卡住或打印机显示为离线状态等多种形式,面对这些情况,无需过于焦虑,通过系统性的排查,绝大多数问题都可以得到有……

    2025年10月25日
    05180
  • 晶晨A311D如何刷机升级系统以优化CDN运行效果?

    晶晨A311D刷系统跑CDN教程晶晨A311D是一款性能优异的芯片,广泛应用于智能家居、车载娱乐等领域,为了充分发挥其性能,许多用户选择刷机以实现更高的系统流畅度和更好的功能体验,本文将详细介绍如何刷机并使晶晨A311D跑CDN,以提升网络速度和播放体验,准备工作下载刷机工具:您需要在官方网站或第三方论坛下载适……

    2025年11月20日
    09930
    • 服务器间歇性无响应是什么原因?如何排查解决?

      根源分析、排查逻辑与解决方案服务器间歇性无响应是IT运维中常见的复杂问题,指服务器在特定场景下(如高并发时段、特定操作触发时)出现短暂无响应、延迟或服务中断,而非持续性的宕机,这类问题对业务连续性、用户体验和系统稳定性构成直接威胁,需结合多维度因素深入排查与解决,常见原因分析:从硬件到软件的多维溯源服务器间歇性……

      2026年1月10日
      020
  • ASP.NET中DES加密解密的具体实现步骤及示例代码详解?

    ASP.NET实现的DES加密解密操作示例在ASP.NET Web开发中,数据安全是保障系统稳定性和用户隐私的核心环节,对称加密算法如DES(Data Encryption Standard)因其在性能与密钥管理上的优势,常被用于对敏感信息的加密存储或传输,本文将详细阐述如何在ASP.NET环境中实现DES加密……

    2026年1月2日
    03550

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注