如何使用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

相关推荐

  • 奥迪A6L CDN版如何办理上牌手续?需遵循哪些特殊流程?

    奥迪A6L作为一款高端车型,其搭载CDN(Continental Design Network)技术版本的车主在办理上牌手续时,需要遵循一定的流程,以下是一篇关于如何为CDN开头的奥迪A6L上牌的详细指南,了解CDN技术CDN技术是奥迪与德国大陆集团合作开发的一项设计网络技术,旨在提升车辆的操控性能和驾驶体验……

    2025年12月11日
    01540
  • 立思辰GB7531CDN彩色一体机性能如何值得入手吗?

    在当今追求高效与品质的现代化办公环境中,一台性能卓越、功能全面的办公设备是提升团队生产力与塑造企业专业形象的关键,立思辰彩色一体机gb7531cdn正是为此应运而生,它不仅是简单的打印工具,更是集打印、复印、扫描、传真于一体的智能办公中枢,致力于为中小型企业及部门工作组提供稳定、高效且经济可靠的彩色文档输出解决……

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

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

      2026年1月10日
      020
  • HL3150CDN打印机说明书,如何正确安装和操作这款打印机?

    HL3150CDN打印机说明书HL3150CDN打印机是一款高性能、多功能打印机,适用于家庭和办公使用,本说明书将详细介绍该打印机的安装、使用、维护和故障排除等内容,安装与设置安装打印机(1)将打印机放置在平稳的桌面上,确保周围有足够的空间,(2)打开打印机盖,取出打印机和墨盒,(3)按照说明书上的指示,将墨盒……

    2025年12月10日
    0990
  • CDN服务中断后,普通民众日常生活和互联网体验将面临哪些具体影响?

    随着互联网技术的飞速发展,CDN(内容分发网络)已经成为保障网络内容快速传输的重要手段,近期某知名CDN服务商宣布停止服务,这无疑给广大网民带来了诸多不便,本文将从以下几个方面探讨CDN停止服务对老百姓的影响,网络速度变慢CDN的主要作用是加速网络内容的传输速度,降低用户访问延迟,当CDN停止服务后,原本通过C……

    2025年11月13日
    0700

发表回复

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