路由器和交换机命令大全_第1页
路由器和交换机命令大全_第2页
路由器和交换机命令大全_第3页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、资料来源:来自本人网络整理!祝您工作顺利!路由器和交换机命令大全 不管是路由器也好,还是交换机也好,终归都是要依靠指令进展设备掌握,因此你是否知道全部的指令呢?何不抓紧时间补全自己所缺失的指令,以便更好的进展工作开展。 根底配置 进入console口进展本地配置用户形式 xxenable n特权形式 xx#configure terminal全局配置形式 xx(config)#interface f|s n/m进入接口配置形式xx(config-if)# 进入(子)接口形式后配置ip(config-if)#ip addr a.b.c.d 子网掩码激活接口(config-if)#no shutd

2、own配置速度(config-if)#speed auto|10|100配置接口工作形式(config-if)#duplex auto|half|full配置时钟(串行口dce端) (config-if)#clock rate n反向操作(删除配置) no + 指令在换回接口上配多个ip(config-if)#ip addr a.b.c.d 子网掩码(config-if)#ip addr a.b.c.d 子网掩码 secondary查看全部配置#show running-config 路由器关闭路由功能充当主机(config)#no ip routing为路由器设置网关(config)#ip

3、default-gateway ip地址 改机器名字(config)#hostname yy掌握线路超时(config)#line n(config-line)#exec-timeout 0 0关闭域名解析功能(config)#no ip domain-lookup开启路由器 功能(config)#ip server(config)#username xxx password yyy(config)#username xxx secret yyy(config)#enable secret yyy启用密码加密效劳(config)#service password-encryption yyy开

4、启路由器 s功能(config)#ip secure-server开启路由器远程登录功能(config)#line vty 0 4(config)#login local或者(config)#no login(config)#enable n登录时用法指令 telnet a.b.c.d 交换机 查看mac地址表#show mac-address-table绑定静态mac地址(config)#mac-address-table static h.h.h vlan n interface fx/x #show arp在主机上用法arp -a查看arp信息开启交换机端口平安(防止连接主机恶意发送随机

5、mac填满mac地址表) (conifg)#switchport port-security(conifg)#switchport ? #show port-security int fx/x复原(config)#errdisable recovery 为交换机vlan1配置管理ip(conifg)#int vlan 1(config-if)#ip addr a.b.c.d 子网掩码(config-if)#no shut 交换机vlan 查看vlan #show vlan-switch或是#show vlan创立vlan #vlan database(vlan)#vlan n将端口参加到vla

6、n中(config-if)#switchport access vlan n给允很多个vlan的接口打trunk(config-if)#switchport mode trunk 单臂路由vlan 路由器上配置子接口实现不同vlan之间通信,先必需激活其父接口,另外ip不允许重复(config)#interface fx/x.x(config-subif)#encapsulation dot1q vlan-id(config-subif)#ip addr a.c.d.e 子网掩码(config-subif)#no shut 用法三层交换机交换虚拟接口 交换机上配置虚拟交换接口实现不同vlan之

7、间通信,先必需在交换机上添加对应vlan(config)#int vlan n(config-if)#ip addr a.b.c.d 子网掩码(config-if)#no shut在删除时,务必先删除交换虚拟接口,再删对应vlan vtp 配置vtp形式#vlan database(vlan)#vtp server|client|transparent只有域名和密码完全一样的路由器之间才能同步vlan信息(vlan)#vtp domain 域名(vlan)#vtp password 密码翻开vtp裁剪(vlan)#vtp pruning退出激活(vlan)#exit 端口聚合 创立r1(con

8、fig)#interface port-channel 1(config-if)#switchport trunk encapsulation dot1q(config-if)#switchport mode trunk将指定接口参加聚合组内#int range f x/x-x #channel-group 1 mode on查看聚合接口#show etherchannel summary 生成树协议 基于vlan的生成树可防止环路开启生成树协议(stp默认是开启的,可省略) (config)#spanning-tree vlan n修改生成树协议优先级(根网桥:mac最小、优先级最小) (c

9、onfig)#spanning-tree vlan n priority m交换机和主机之间连接的端口开启portfast,可防止主机发送bpdu伪造数据(config-if)#spanning-tree portfast查看生成树#show spanning-tree vlan n 静态路由 查看协议#show ip protocols查看路由表#show ip route添加静态路由(以默认路由举例) (config)#ip route 0.0.0.0 0.0.0.0 出接口|下一跳ip浮动静态路由(备份链路,在原链路失效后起作用) (config)#ip route 0.0.0.0 0.

10、0.0.0 出接口 ad管理间隔 静态黑洞路由(config)#ip route 192.168.0.0 255.255.0.0 null 0 rip间隔 矢量路由,动态路由 配置rip宣告直连网段(config)#router rip(config-router)#network 网段更改为版本2(config-router)#version 2|1关闭自动汇总(假如被其他网路隔开时,最好关闭自动汇总) (config-router)#no auto-summary设置被动接口(只承受更新,不宣告自己) (config-router)#passive-interface 接口单播更新(只和指

11、定的ip交换路由信息) (config-router)#neighbor ip地址去除路由表内容#clear ip route * ospf链路状态路由,动态路由 配置ospf宣告直连网路(config)#router ospf 进程号(config-router)#router-id 任意ip地址(config-router)#network 反掩码 area n重启ospf进程#clear ip ospf process查看接口的ospf信息#show ip ospf interface查看邻居表#show ip ospf neighbor查看链路数据表#show ip ospf data

12、base eigrp链路状态路由,动态路由 配置eigrp宣告直连网路(config)#router eigrp 系统编号(config-router)#network 查看邻居表#show ip eigrp neighbors查看拓扑表#show ip eigrp topology vrrp虚拟路由器路由协议 供应网关冗余查看vrrp信息#show vrrp vrrp配置(在供应备份的两台路由器上做以下配置) 端口跟踪(监视某个接口的状态) (config)#track 1 interface 接口 line-protocol(config-if)#vrrp 1254 ip 额外配置优先级(

13、ip和优先级越大master)和抢占(config-if)#vrrp 1254 priority 1254(config-if)#vrrp 1254 preempt(config-if)#vrrp 1 track 1 decrement 1255 访问掌握列表acl acl无法掌握自身发起的流量,对于已经建立的流量不起作用标准acl(不能单独删除、添加一条访问列表) (config)#access-list 199|13001999 permit|deny ip地址 反掩码扩展acl(config)#access-list 100-199 permit|deny 协议 源ip 反掩码 源端口

14、目的ip 反掩码 目的端口应用到指定acl到某个接口(config)#int 接口(config-if)#ip access-group 199|100-199|13001999 in|out 命名acl(config)#ip access-list standard 标准acl名字(config-std-nacl)#permit|deny ip地址 反掩码(config)#ip access-list extended 扩展acl名字(config-ext-nacl)#permit|deny 协议 源ip 反掩码 源端口 目的ip 反掩码 目的端口应用到指定acl到某个接口(config)#

15、int 接口(config-if)#ip access-group 标准acl名字|扩展acl名字 in|out 自反acl(racl,可以只允许内网主动发起的流量通过) (config)#ip access-list extended outb(config-ext-nacl)#permit tcp any any reflect racl(config)#ip access-list extended inb(config-ext-nacl)#evaluate racl(config-ext-nacl)#deny ip any any应用到指定acl到某个接口(config-if)#ip

16、access-group outb out(config-if)#ip access-group inb in 基于时间的acl设置时区时间(config)#clock timezone gmt +8 #clock set hh:mm:ss 日 月 年定义时间(config)#time-range 时间名(config-time-range)#periodic hh:mm to hh:mm(config-time-range)#absolute start hh:mm:ss 日 月 年 end hh:mm:ss 日 月 年结合acl(config)#ip access-list extende

17、d 扩展acl名字(config-ext-nacl)#deny tcp any any time-range 时间名 nat和pat 定义内外网接口(config)#int 接口(config-if)#ip nat inside|outside静态nat(config)#ip nat inside source static ip地址 静态pat(config)#ip nat inside source static 协议 ip地址 端口号 用法acl捕获流量(config)#access-list n permit ip地址 反掩码(config)#ip nat pool 地址池名 起始ip

18、地址 终止ip地址 netmask 掩码tcp负载平衡(轮询转换) (config)#ip nat pool 地址池名 起始ip地址 终止ip地址 netmask 掩码 type rotary动态nat(config)#ip nat inside source list n pool 地址池名动态pat(config)#ip nat inside source list n pool 地址池名 overload 查看转换项#show ip nat translations 广域网ppp协议 在串行口上的两台路由器都封装ppp协议(config)#int sx/x(config-if)#enca

19、psulation ppp(config-if)#no shut 启用pap认证,未加密认证方(config)#username 用户名 password 密码(config-if)#ppp authentication pap恳求认证方(config-if)#ppp pap sent-username 用户名 password 密码 启用chap认证,平安加密认证方(config)#username 恳求认证方名 password 恳求认证方密码(config-if)#ppp authentication chap恳求认证方(config)#username 认证方名 password 认证

20、方密码(config-if)#ppp authentication chap 帧中继 无播送的多路访问网络(nbma) 配置帧中继交换机关闭路由器路由功能(config)#no ip routing启用帧中继(config)#frame-relay switching进入串行接口r8(config)#int sx/x封装frame-relay协议r8(config-if)#encapsulation frame-relay指定lmi-type类型(config-if)#frame-relay lmi-type cisco指定intf-type接口类型为dce(config-if)#frame-relay intf-type dce配置时钟频率(config-if)#clock rate n配置dlci(config-if)#frame-relay route 进dlci号 int 出接口 出dlci号 配置路由器,封装frame-relay协议(co

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论