设为首页 收藏本站
查看: 809|回复: 0

[经验分享] CISCO路由与交换笔记

[复制链接]

尚未签到

发表于 2018-7-17 12:56:16 | 显示全部楼层 |阅读模式
  用户模式   Router>
  特权模式   Router#
  全局模式   Router(config)#
  接口模式   Router(config-if)#
  子接口模式 Router(config-subif)#
  行模式     Router(config-line)#
  进入特权模式:enable
  进入全局模式:config terminal
  进入接口模式:interface serial 0/0
  进入子接口模式:interface serial 0/0.1
  进入虚拟接口模式:line vty 0 4
  进入console模式:line console 0
  退出模式:End , Exit
  帮助:?
  打开数据包显示:debug ip packet
  关闭数据包显示:no debug ip packet
  重新启动路由器:reload
  检查路由器平台信息:show version
  检查系统版本:show protocols
  查看flash文件:show flash
  备份flash系统:copy flash: tftp:  (1.输入文件名称,2.输入tftp主机IP,3.输入备份到主机的文件名,如c2600.bin)
  删除flash文件:delete flash:c2600.bin
  升级还原flash系统:copy tftp: flash:  (1.tftp主机IP  2.主机文件  3.主机文件名到flash的名称  4.清空flash  5.确定清空)
  备份startup-config:copy startup-config tftp
  NAT端口映射,如:做FTP映射:↓(20,21端口一个是数据一个是指令)
  ip nat inside source static tcp 192.168.1.1 20 interface s0/0 20
  ip nat inside source static tcp 192.168.1.1 21 interface s0/0 21
  然后在外网的接口上配置:ip nat outside (只能有一个出接口)
  然后在内网的接口上配置:ip nat inside (可以有多个进接口)
  PAT单个外网地址共内网上网:
  首先定义允许内网出去的网段: access-list 1 permit 192.168.1.0 0.0.0.255
  再定义内网允许访问的控制列表到外网接口:ip nat inside source list 1 interface serial0/0 overload
  最后指定出去的接口和进来的接口:
  进入外网接口输入:ip nat outside
  进入内网接口输入:ip nat inside
  PAT多个外网地址共内网上网:
  首先定义允许内网出去的网段: access-list 1 permit 192.168.1.0 0.0.0.255
  再定义公网地址池: ip nat pool www 123.123.123.123 123.123.123.125 netmask 255.255.255.0  (这里指定了3个外网地址)
  绑定内网允许访问的控制列表到外网地址池:ip nat inside source list 1 pool www overload
  最后指定出去的接口和进来的接口:
  进入外网接口输入:ip nat outside
  进入内网接口输入:ip nat inside
  telnet方式访问设备:(配完之后ping,然后再telnet到ip)
  Router(config)#line vty 0 4
  Router(config-line)#password 123456
  Router(config-line)#login
  Router(config-line)#exit
  路由和路由之间用serial口连接,S口DCE方一定要设置速率进入S口:clock rate 128000
  查看路由表:show ip route
  关闭自动汇总:no auto-summary
  查看路由用的协议:show ip protocol
  添加静态路由表:ip route 192.168.1.0 255.255.255.0 192.168.10.1   (192.168.10.1 是下一跳)
  添加静态路由表:ip route 0.0.0.0 0.0.0.0 192.168.10.1  (0.0.0.0表示所有)
  配置RIP路由协议:
  开启RIP路由协议:route rip
  把本地的网段发出去:network 192.168.1.0
  删除RIP:no router rip
  配置IGRP路由协议:
  自制系统编号:router igrp 100  "后面的100是自制系统编号,自制系统编号要一样才能通讯"
  网络号:network 192.168.1.0
  删除IGRP:no router igrp
  配置EIGRP路由协议:
  启用EIGRP:router eigrp 1  "后面的1是自制系统编号,号码不一致会导致不能正常通讯"
  加入EIGRP的网段:network 192.168.1.0 0.0.0.255
  删除EIGRP:no router EIGRP
  no auto-summary关闭自动汇总
  查看加入eigrp的接口:show ip eigrp interfaces
  查看eigrp邻居关系:show ip eigrp neighbors
  查看eigrp拓扑表:show ip eigrp topology
  variance 9  (最佳路径=9倍的都可以放进路由表)
  实现链路负载均衡:
  interface f0/1  (进入接口)
  bandwidth 10000 (10000=10M 修改链路度量值)
  配置OSPF路由:
  启用OSPF路由:router ospf 100   "后面是本地进程号,不一样也可以通讯"参与OSPF的网络段:network 192.168.1.0 0.0.0.255 area 0
  翻译:network    网段    通配符  area  区域0
  开启所有的接口并且加入区域0:network 0.0.0.0 0.0.0.0 aera 0
  查看邻居信息:show ip ospf neighbor
  查看区域ID和链接信息:show ip ospf interface
  监控ospf信息:debug ip ospf events , debug ip ospf packet
  更改OSPF开销:ip ospf cost 5  (进入接口之后)
  修改router-id : router ospf 1
  router-id 1.1.1.1
  清除重启ospf表:clear ip ospf process
  配置ACL访问控制列表:
  让192.168.1.0的网段不能访问到我当前的路由器:
  R1(config)#access-list 1 deny 192.168.1.0 0.0.0.255   (创建访问控制列表)
  R1(config)#access-list 1 permit any    (除了192.168.1.0网段deny,其他全部permit)
  R1(config)#interface fastethernet 0/1   (进入接口)
  R1(config-if)#ip access-group 1 in    (绑定进来的控制列表)
  常用端口:
  http: tcp 80
  https: tcp 443
  pop3: tcp 110
  smtp: tcp 25
  dns: udp 53
  ftp: tcp 21 20
  telnet: tcp 23
  ssh: tcp 22
  ping icmp echo
  删除ACL访问控制列表: R1(config)#:no access-list 1
  查看访问控制列表:R1#:show access-list
  查看协议版本:show ip protocols
  查看路由表信息:show ip route
  查看OSPF接口信息:show ip ospf interface
  查看OSPF邻居信息:show ip ospf neighbor
  show interface 查看双工模式和其他功能
  show running-config 查看当前配置
  show spanning-tree 查看vlan端口当前配置
  show interface sataus 查看所有端口状态和所属Vlan和双工速率
  show ip interface bruief 查看端口当前状态
  清除命令:erase ?
  查看当前路由器配置:show running-config
  保存当前配置:copy running-config startup-config , write

  删除配置及重新加载路由器:erase startup-config 。>  使用do命令:do 可以在任何模式下使用命令 “do ping 192.168.1.1”
  更改名字:hostname “R1”
  取消更改名字:no hostname
  给console加密码:password 123456 。 login
  给vty加密码:password 123456 。 login
  给特权模式加明文密码:enable pssword 123456
  给特权模式加密文密码:enable secret 123456
  取消密码:no enable pssword 。 no enable secret
  超时时间设置:exec-timeout 0 0
  防止域名解析:no ip domain-lookup
  查看路由表:show ip route
  查看接口汇总信息:show ip interface brief
  查看接口一层二层的状态:show interface
  查看接口三层的信息:show ip interface
  查看接口协议信息:show protocols
  查看物理接口自身的信息:show controllers
  查看单个端口信息:show interfaces s0/0
  设置端口IP并激活端口:ip address 192.168.1.1 255.255.255.0 no shutdown
  创建 vlan
  switch# vlan database
  switch(vlan)# vlan 2 name zjh
  switch(vlan)# exit
  真实交换机上直接在全局配置模式下直接打vlan后面跟上名字
  多个端口删除
  switch(config)# interface range f1/0 -5
  switch(config-if)# no switchport access vlan 2
  删除 vlan   “删除vlan首先要把vlan2里的端口全部NO掉 到vlan1里” ↑
  switch# vlan database
  switch(vlan)# no vlan 2
  switch(vlan)# exit
  将端口加入到 vlan 中
  switch(config)# interface  f1/1
  switch(config-if)# switchport access vlan 2
  将多个端口加入到 vlan 中
  switch(config)# interface range f1/0 -5
  switch(config-if)# switchport access vlan 2
  Vlan-Trunk交换机与交换机互联协议:
  先查看交换机用什么中继协议然后封装协议:
  SW1(config-if)# switchport trunk encapsulation dot1q
  然后把端口改成trunk:
  SW1(config-if)# switchport mode trunk
  查看端口状态:show ip interface f0/0 swichprot
  查看接口trunk:show interface trunk
  然后再查看一下vlan中是否存在该端口:
  SW1# show vlan
  不在就表示该端口已变为trunk模式了
  VTP配置:
  创建VTP:Switch(config)# vtp domain a
  修改VTP权限:Switch(config)# vtp mode server
  设置VTP密码:Switch(config)# vtp password 123
  切换vtp版本:Switch(config)# vtp version 2
  设置带宽半双工或全双工或自动协商:
  必须要先配置接口速率再配置接口模式
  PC1(config)#interface f0/1
  PC1(config-if)#speed ?
  10(10兆)
  100(100兆)
  auto(自动协商)
  PC1(config-if)#speed 100
  PC1(config-if)#duplex ?
  auto(自动协商)
  full(全双工)
  half(半双工)
  PC1(config)#duplex full
  远程连接交换机进行配置:
  创建Vlan并设置Vlan IP
  SW(config)#interface vlan 1
  SW(config-if)#ip add 192.168.1.88 255.255.255.0
  SW(config-if)#no shutdown
  SW#show ip interface brief
  必须设置VTY密码之后才能远程连接
  SW(config)#line vty 0 4
  SW(config-line)#password 123456       设置远程链接密码
  SW(config-line)#login                 设置退出后生效
  SW(config-line)#exit                  退出
  设置网关:
  SW(config)#ip default-gateway 192.168.1.1
  SW(config)#end
  设置快速端口:
  SW(config-if)#spanning-tree portfast
  查看MAC地址表:
  SW#show mac-address-table
  清除MAC地址表:
  SW#clear mac-address-table
  加密验证
  conf t
  key chain 名字
  key
  key - string 密码
  exit
  int
  ip rip authenticatiok key - chain 名字
  ip rip aut mode
  clear ip route
  路由协议EIGRP
  EIGRP是思科的私有协议
  一种增强型距离矢量路由协议
  思科的组播地地:224.0.0.10
  自制系统和进程ID

  router eigrp (autonomous - system)>  全局模式下:router eigrp 进程ID (全网ID相同)
  network 地址
  show ip eigrp neighbors 检验EIGRP
  show ip protcols
  metric weights 命令更改"K"值
  show inter aces 接口 检查度量值

  band>  EIGRP子网分割
  DHCP配置
  service dhcp
  network 地址
  default - router 默认网关
  domain - name 域名
  ipdhcp ex
  中继配制
  ip helper - add 目标地址,中继地址,端口
  service DHCP
  ippool
  network 192.168.3.0 255.255.255.0
  default - router 192.168.2.2
  domain name jxxh.com
  dhcp eocludoa - address 192.168.3.1 255.255.255.0
  OSPF
  192.168.2.11              192.168.2.12  192.168.2.13
  ①②③
  R1conf t
  enrouter ospf 100
  conf tnet work 192.168.2.0
  no ip domain-lookup0.0.0.255 area 0
  host R1``````
  (tne cons)end
  exel-time out 0show ip inter brief
  logg s
  exit
  intfolo
  ip add 192.168.2.11 255.255.255.0
  no shut
  inter lo 0
  ip add `````
  no shut
  ospf验证
  conf t
  router ospf lo 0
  area authentication Imessage - digest 密文
  ip ospf message - digest - key mds 12355 密码
  明文加密
  conf t
  router ospf 100
  area authentication 启用明文验证
  inter s'10 进入接口  (区域号)
  ip ospf authentiation-key 1 123456
  级别  密码
  密文加密
  conf t
  router ospf 100area 1 authentication nlessage-digest 启用区域密文验证
  inter 1 进入接口 (加密验证接口)
  ip ospf message - digest - key , md5 , 12345
  三层交换drlcp
  service dhcp
  ip dhcp pool 名称
  net work +网段
  default - router +dns地地
  lease infinint 植的 domain-name
  ip dhcp cluded
  开启vlan ,再开IP,vlan地址作为网关

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-538066-1-1.html 上篇帖子: Cisco设备AAA认证配置 下篇帖子: cisco配置ssh登陆
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表