交换机和路由器常用命令注释
- 格式:doc
- 大小:48.00 KB
- 文档页数:5
交换机与路由器基本命令交换机部分命令一、交换机五种模式Swith> (用户模式)Swith# (特权模式)Swith(config)# (全局配置模式)Swith(config-if)# (接口模式)Swith(config-line)# (线模式)二、交换机模式切换Swith>enable //切换到特权Swith#config t //切换到全局配置模式Swith(config)# interface f0/1 //进入接口f0/0Swith(config)# interface vlan 1 //进入VLAN 1中Swith(config-if)#ip address 192.168.1.1 255.255.255.0 //对VLAN1设置IP地址和子网掩码Swith(config-if)#no shutdown //激活VLAN1三、设置交换机的密码1、用户到特权的密码Swith(config)#enable password 123 (优先级低)Swith(config)#enable secret 456 (优先级高) //如果两个都设置则456生效2、控制台console密码设置Swith(config)# line con 0Swith(config-line)#loginSwith(config-line)#password console123 //设置console密码为telnet1233、启用telnet密码Swith(config)#line vty 0 15 //最多有0~15人可以telnet访问swith,合计16人Swith(config-line)#loginSwith(config-line)#password telnet123 //设置telnet密码为telnet123注:要想真正生效telnet还要设置特权密码三、交换机命名hostname BENETSW01Swith(config)#hostname BENETSW01 //使用hostname命名交换机的名字四、show命令集Swith#show version //显示IOS版本信息Swith#show int vlan 1 brief //简单的显示VLAN1的信息Swith#show running-config //显示正在运行的配置文件Swith#show startup-config //显示己经保存的配置文件Swith#show mac-address-table //显示MAC地址表Swith#show mac-address-table //显示MAC地址表更新的间隔,默认为5分钟Swith#show neighbor detail //显示邻居详细信息Swith#show traffic //显示CDP流量Swith#show五、设置交换机的网关和DNS名称服务器的IP地址Swith(config)# ip default-gateway 192.168.10.8 //交换机的网关设置为192.168.10.8 Swith(config)#ip domain -name server 202.106.0.20 //设置DNS名称服务器地址Swith(config)# no ip domain-lookup //交换机名称服务器的域名查询六、创建、删除、查看VLANSwitch#vlan database //进入vlan数据库配置模式Switch(vlan)#vlan 2 //创建VLAN2命名为vlan0002,也可以使用vlan2 name sales VLAN 2 added:Name: VLAN0002Switch(vlan)#exit //退出时应用生效Swith(vlan)#no vlan 2 //删除vlan2Switch(config)# interface f0/1Switch(config-if)# switchport access vlan 2 //将端口加入vlan 2中Switch(config-if)# no switchport access vlan 2 //将端口从vlan2中删除Switch(config)# interface range f0/1 –10 // 进行F0/1到10端口范围Switch(config-if-range)# switchport access vlan 2 //将f0/1到f0/10之间的所有端口加入vlan 2Switch# show vlan brief //查看所有VLAN的摘要信息Switch# show vlan id vlan-id //查看指定VLAN的信息七、开启并查看trunk端Swith(config)#interface f0/24Swith(config-if)#swith mode trunk //将f0/24端口设置为trunkSwitch#show interface f0/24 switchport //查看f0/24的接口状态八、从Trunk中添加、删除VlanSwitch (config-if )# switchport trunk allowed vlan remove 3 //从trunk端口删除v lan3通过Switch (config-if)# switchport trunk allowed vlan add 3 //从trunk端口添加vlan3通过Switch # show interface interface-id switchport //检查中继端口允许VLAN的列表九、单臂路由配置Router(config)# interface f0/0.1Router(config-subif)# encapsolution dot1q 1 //子接口封装dot1q 针对的是VLAN1Router(config-subif)# ip address 192.168.1.1 255.255.255.0 //设置VLAN的网关地址Router(config)# interface f0/0.2Router(config-subif)# encapsolution dot1q 2 //子接口封装dot1q针对的是vlan2Router(config-subif)# ip address 192.168.2.1 255.255.255.0 //设置vlan2的网关的地址路由命令部分一、路由器的模式v 用户模式:Router> //用户模式v 特权模式:Router# //特权模式v 全局配置模式:Router(config)# //配置模式v 接口配置模式:Router(config-if)# //接口模式v 子接口配置模式:Router(config)#interface fa0/0.1 //进入子接口Router(config-subif)# //子接口状态v Line模式:Router(config-line)# //进行线模式v 路由模式:Router(config-router)# //路由配置模式二、配置静态路由条目Router(config)#ip route 192.168.10.0 255.255.255.0 192.168.9.2 //到达192.168.10.0网段及掩码需要经过相邻路由器的接口的IP地址三、配置默认路由Router B(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.2 //所以外出的数据包如果找不到路由表目均找192.168.2.2接口四、密码配置v 配置控制台密码teacher(config)#line console 0teacher((config_line)#loginteacher((config_line)#password ciscoteacher(config)#enable password cisco //配置特权模式密码teacher(config)#enable secret 1234 //配置加密保存的密码teacher(config)#service password-encryption //对所有密码加密五、配置路由器的banner信息teacher(config)#banner motd $This is Aptech company’s Router! Please don’t change the configuration without permission! $六、配置路由器接口的描述信息teacher(config)#interface fastethernet 0/0teacher(config_if)#description connectin g the company’s intranet!七、配置控制台配置控制台会话时间teacher(config)#line console 0teacher(config_line)#exec-timeout 0 0配置控制台输出日志同步teacher(config)#line console 0teacher(config_line)#logging synchronous八、动态路由相关命令Router(config)# router rip //启动RIP进程Router(config-router#version 2 //指定启动rip v2版本Router(config-router)# network network-number //宣告主网络号Router# show ip route //查看路由表Router#show ip route static //仅显示静态路由信息Router# show ip protocols //查看路由协议配置Rouetr# debug ip rip //打开RIP协议调试命令九、动态路由配置RouterA(config)#interface f0/0RouterA(config-if)#ip address 192.168.1.1 255.255.255.0RouterA(config-if)#no shutdownRouterA(config)#interface f0/1RouterA(config-if)#ip address 10.0.0.2 255.0.0.0RouterA(config-if)#no shutdownRouterA(config)#router ripRouterA(config-router)#network 10.0.0.0RouterA(config-router)#network 192.168.1.0十、路由器密码恢复进入ROM Monitor模式修改配置寄存器的值,启动时绕过startup-config文件:rommon1>confreg 0×2142rommon2>reset用startup-config覆盖running-config:Router#copy startup-config running-config修改密码:Router(config)#enable password cisco修改配置寄存器的值:Router(config)#config-register 0×2102。
华为路由器交换机常用命令一、设备管理命令1.登录管理命令- ssh [ip地质] -p [端口号]:通过SSH协议登录设备。
- telnet [ip地质]:通过Telnet协议登录设备。
- logout:退出设备。
2.用户管理命令- display current-configuration:显示当前设备配置信息。
- save:保存当前配置。
- undo save:取消保存的配置。
- super:切换到超级用户模式。
- user-interface console 0:配置控制台终端的参数。
- user-interface vty 0 4:配置远程登录终端的参数。
3.设备操作命令- reboot:重启设备。
- reset saved-configuration:恢复出厂配置。
- display version:显示设备的硬件和软件版本信息。
- display device:显示设备的基本信息。
- display interface[接口名称]:显示指定接口信息。
- display ip routing-table:显示IP路由表信息。
二、网络配置命令1.IP配置命令- interface [接口名称]:进入指定接口。
- ip address [IP地质] [子网掩码]:配置接口IP地质。
- undo ip address:取消接口IP地质配置。
- ip route-static [目标网络] [子网掩码] [下一跳地质]:配置静态路由。
- undo ip route-static [目标网络] [子网掩码] [下一跳地质]:取消静态路由配置。
2.VLAN配置命令- vlan [VLAN ID]:创建指定VLAN。
- quit:退出VLAN配置模式。
- interface vlan [VLAN ID]:进入指定VLAN接口。
- ip address [IP地质] [子网掩码]:为VLAN接口配置IP地质。
H3C交换机路由器常用命令及注释H3C交换机路由器常用命令及注释2009-10-09 13:04H3C交换机常用命令注释1、system-view 进入系统视图模式2、sysname 为设备命名3、display current-configuration 当前配置情况4、language-mode Chinese|English 中英文切换5、interface Ethernet 1/0/1 进入以太网端口视图6、port link-type Access|Trunk|Hybrid 设置端口访问模式7、undo shutdown 打开以太网端口8、shutdown 关闭以太网端口9、quit 退出当前视图模式10、vlan 10 创建VLAN 10并进入VLAN 10的视图模式11、port access vlan 10 在端口模式下将当前端口加入到vlan 10中12、port E1/0/2 to E1/0/5 在VLAN模式下将指定端口加入到当前vlan中13、port trunk permit vlan all 允许所有的vlan通过H3C路由器############################################################## ########################1、system-view 进入系统视图模式2、sysname R1 为设备命名为R13、display ip routing-table 显示当前路由表4、language-mode Chinese|English 中英文切换5、interface Ethernet 0/0 进入以太网端口视图6、ip address 192.168.1.1 255.255.255.0 配置IP地址和子网掩码7、undo shutdown 打开以太网端口8、shutdown 关闭以太网端口9、quit 退出当前视图模式10、ip route-static 192.168.2.0 255.255.255.0 192.168.12.2 description To.R2 配置静态路由11、ip route-static 0.0.0.0 0.0.0.0 192.168.12.2 description To.R2 配置默认的路由H3C S3100 SwitchH3C S3600 SwitchH3C MSR 20-20 Router############################################################## ############################1、调整超级终端的显示字号;2、捕获超级终端操作命令行,以备日后查对;3、language-mode Chinese|English 中英文切换;4、复制命令到超级终端命令行,粘贴到主机;5、交换机清除配置:<H3C>reset save ;<H3C>reboot ;6、路由器、交换机配置时不能掉电,连通测试前一定要检查网络的连通性,不要犯最低级的错误。
路由器和交换机的基本命令大家知道路由器和交换机的命令有哪一些吗?下面是小编为大家搜集整理出来的有关于路由器和交换机的基本命令,希望通过以下学习能够帮助到大家!路由器和交换机的基本命令en进入特权模式conft全局模式Int接口号进入接口模式exit返回上一个模式End返回特权模式hostname主机名配置主机名Shver查看版本信息Showmac-address-table查看Mac地址表Duplex双工模式配置双工模式(全双工full,半双half,自动协商auto)Speed速率值配置接口速率(auto自动匹配)Ifconfig查看IP地址的配置信息PingIP地址测试连通*Exec-timeout00永远在线,不超时锁定Noipdomain-lookup禁用DNS查找Loggsyn信息同步IPaddIP地址子网掩码配置IP地址(在全局模式下)Ipdefault-gatewaty网关地址配置交换机默认网关Password密码配置console口密码Nosh打开接口Showarp查看ARP缓存表Cleararp-cache清除ARP缓存表Arpip地址Mac地址arpaARP绑定Ping-t+IP地址无限测试下去(连通*)Ping-a+IP地址显示IP地址对应的主机名PingIP地址-l字节大小测试连通*IprouteIP网段子网掩码下一接口IP地址配置静态路由NoIprouteIP网段子网掩码下一接口IP地址删除静态路由Tracertip地址显示路由器经过的路径Wr或者copyrunning-configstarup-config保存当前配置Erasenvram或者erasestarup-config删除已保存的配置Shiproute查看路由表(路由器专用)Shmac-address-table查看Mac地址表(交换机专用)Shrun查看当前配置Shstar查看已保存的配置Linecon0进入console口Password密码配置console口密码Login保存信息Linevty04进入vty0-4这5个虚拟控制台,远程连接Enablepassword密码配置特权模式密码(明文)Enablesecret密码配置密文密码Ipdefault-gatewaty网关地址配置交换机默认网关Copyflashtftp备份IOS系统Copytftpflash升级IOS系统Vlandatabase进入VLAN配置模式Vlan数值配置VLANNovlan数值删除配置VLANShowvlanbr查看VLAN配置SwitchportaccessvlanID分VLAN到接口中Switchportmodeaccess/trunk/dynamic配置端口模式Swtrunkallowedvlanremove/add序号在trunk上删除、添加摸个VLANChannel-group序号modeon配置以太网通道Encapsulation封装类型vlanID号配置VLAN标签的封装结构Ipdhcppool地址池名称定义地址池Network网段子网掩码动态分配IP段Default-router网关地址设定网关地址Dns-server地址配置dns地址Lease租期设定地址的租期Vtpdomain名字创建vtp域Vtpmodeserver/client/transparent配置交换机vtp模式Showvtppassword查看vtp配置口令Showvtpstatus查看其他vtp配置信息。
一. 端口:路由器——ethernet(以太口)、Serial(串口)、loopback(虚拟端口)交换机——ethernet、vlan、loopback注意:交换机默认其24个端口全在vlan 1里面,交换机在给vlan配了ip之后就具有路由器的功能了。
另一个需要注意的是,所用的端口是否被shutdown了,如果被shutdown 了,需要进入相应的端口执行undo shutdown。
二. 配置ip除了交换机的以太口不可以配置ip外,其他端口都可以,配置方法相同。
[Quidway] interface *(所要配置的端口,如vlan 1)[Quidway-*]ip add *.*.*.*(ip)*.*.*.*(掩码)/*(掩码位数,一般只在路由器上适用)—————————————————————————————————————1.在基于IOS的交换机上设置主机名/系统名:switch(config)# hostname hostname在基于CLI的交换机上设置主机名/系统名:switch(enable) set system name name-string2.在基于IOS的交换机上设置登录口令:switch(config)# enable password level 1 password在基于CLI的交换机上设置登录口令:switch(enable) set passwordswitch(enable) set enalbepass3.在基于IOS的交换机上设置远程访问:switch(config)# interface vlan 1switch(config-if)# ip address ip-address netmaskswitch(config-if)# ip default-gateway ip-address在基于CLI的交换机上设置远程访问:switch(enable) set interface sc0 ip-address netmask broadcast-addressswitch(enable) set interface sc0 vlanswitch(enable) set ip route default gateway4.在基于IOS的交换机上启用和浏览CDP信息:switch(config-if)# cdp enableswitch(config-if)# no cdp enable为了查看Cisco邻接设备的CDP通告信息:switch# show cdp interface [type modle/port]switch# show cdp neighbors [type module/port] [detail]在基于CLI的交换机上启用和浏览CDP信息:switch(enable) set cdp {enable|disable} module/port为了查看Cisco邻接设备的CDP通告信息:switch(enable) show cdp neighbors[module/port] [vlan|duplex|capabilities|detail]5.基于IOS的交换机的端口描述:switch(config-if)# description description-string基于CLI的交换机的端口描述:switch(enable)set port name module/number description-string6.在基于IOS的交换机上设置端口速度:switch(config-if)# speed{10|100|auto}在基于CLI的交换机上设置端口速度:switch(enable) set port speed moudle/number {10|100|auto} switch(enable) set port speed moudle/number {4|16|auto}7.在基于IOS的交换机上设置以太网的链路模式:switch(config-if)# duplex {auto|full|half}在基于CLI的交换机上设置以太网的链路模式:switch(enable) set port duplex module/number {full|half}8.在基于IOS的交换机上配置静态VLAN:switch# vlan databaseswitch(vlan)# vlan vlan-num name vlaswitch(vlan)# exitswitch# configure teriminalswitch(config)# interface interface module/numberswitch(config-if)# switchport mode accessswitch(config-if)# switchport access vlan vlan-numswitch(config-if)# end在基于CLI的交换机上配置静态VLAN:switch(enable) set vlan vlan-num [name name]switch(enable) set vlan vlan-num mod-num/port-list9. 在基于IOS的交换机上配置VLAN中继线:switch(config)# interface interface mod/portswitch(config-if)# switchport mode trunkswitch(config-if)# switchport trunk encapsulation {isl|dotlq}switch(config-if)# switchport trunk allowed vlan remove vlan-list switch(config-if)# switchport trunk allowed vlan add vlan-list在基于CLI的交换机上配置VLAN中继线:switch(enable) set trunk module/port [on|off|desirable|auto|nonegotiate] Vlan-range [isl|dotlq|dotl0|lane|negotiate]10.在基于IOS的交换机上配置VTP管理域:switch# vlan databaseswitch(vlan)# vtp domain domain-name在基于CLI的交换机上配置VTP管理域:switch(enable) set vtp [domain domain-name]11.在基于IOS的交换机上配置VTP 模式:switch# vlan databaseswitch(vlan)# vtp domain domain-nameswitch(vlan)# vtp {sever|cilent|transparent}switch(vlan)# vtp password password在基于CLI的交换机上配置VTP 模式:switch(enable) set vtp [domain domain-name] [mode{ sever|cilent|transparent }][password password]12. 在基于IOS的交换机上配置VTP版本:switch# vlan databaseswitch(vlan)# vtp v2-mode在基于CLI的交换机上配置VTP版本:switch(enable) set vtp v2 enable13. 在基于IOS的交换机上启动VTP剪裁:switch# vlan databaseswitch(vlan)# vtp pruning在基于CL I 的交换机上启动VTP剪裁:switch(enable) set vtp pruning enable14.在基于IOS的交换机上配置以太信道:switch(config-if)# port group group-number [distribution {source|destination}] 在基于CLI的交换机上配置以太信道:switch(enable) set port channel moudle/port-range mode{on|off|desirable|auto}15.在基于IOS的交换机上调整根路径成本:switch(config-if)# spanning-tree [vlan vlan-list] cost cost在基于CLI的交换机上调整根路径成本:switch(enable) set spantree portcost moudle/port costswitch(enable) set spantree portvlancost moudle/port [cost cost][vlan-list] 16.在基于IOS的交换机上调整端口ID:switch(config-if)# spanning-tree[vlan vlan-list]port-priority port-priority在基于CLI的交换机上调整端口ID:switch(enable) set spantree portpri {mldule/port}priorityswitch(enable) set spantree portvlanpri {module/port}priority [vlans]17. 在基于IOS的交换机上修改STP时钟:switch(config)# spanning-tree [vlan vlan-list] hello-time secondsswitch(config)# spanning-tree [vlan vlan-list] forward-time seconds` switch(config)# spanning-tree [vlan vlan-list] max-age seconds在基于CLI的交换机上修改STP时钟:switch(enable) set spantree hello interval[vlan]switch(enable) set spantree fwddelay delay [vlan]switch(enable) set spantree maxage agingtiame[vlan]18. 在基于IOS的交换机端口上启用或禁用Port Fast 特征:switch(config-if)#spanning-tree portfast在基于CLI的交换机端口上启用或禁用Port Fast 特征:switch(enable) set spantree portfast {module/port}{enable|disable}19. 在基于IOS的交换机端口上启用或禁用UplinkFast 特征:switch(config)# spanning-tree uplinkfast [max-update-rate pkts-per-second]在基于CLI的交换机端口上启用或禁用UplinkFast 特征:switch(enable) set spantree uplinkfast {enable|disable}[rate update-rate] [all-protocols off|on]20. 为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个IP地址,然后使用下列命令: switch(config)# cluster enable cluster-name21. 为了从一条中继链路上删除VLAN,可使用下列命令:switch(enable) clear trunk module/port vlan-range22. 用show vtp domain 显示管理域的VTP参数.23. 用show vtp statistics显示管理域的VTP参数.24. 在Catalyst交换机上定义TrBRF的命令如下:switch(enable) set vlan vlan-name [name name] type trbrf bridge bridge-num[stp {ieee|ibm}]25. 在Catalyst交换机上定义TrCRF的命令如下:switch (enable) set vlan vlan-num [name name] type trcrf{ring hex-ring-num|decring decimal-ring-num} parent vlan-num26. 在创建好TrBRF VLAN之后,就可以给它分配交换机端口.对于以太网交换,可以采用如下命令给VLAN分配端口:switch(enable) set vlan vlan-num mod-num/port-num27. 命令show spantree显示一个交换机端口的STP状态.28. 配置一个ELAN的LES和BUS,可以使用下列命令:ATM (config)# interface atm number.subint multiointATM(config-subif)# lane serber-bus ethernet elan-name29. 配置LECS:ATM(config)# lane database database-nameATM(lane-config-databade)# name elan1-name server-atm-address les1-nsap-addressATM(lane-config-databade)# name elan2-name server-atm-address les2-nsap-addressATM(lane-config-databade)# name …30. 创建完数据库后,必须在主接口上启动LECS.命令如下:ATM(config)# interface atm numberATM(config-if)# lane config database database-nameATM(config-if)# lane config auto-config-atm-address31. 将每个LEC配置到一个不同的ATM子接口上.命令如下:ATM(config)# interface atm number.subint multipointATM(config)# lane client ethernet vlan-num elan-num32. 用show lane server 显示LES的状态.33. 用show lane bus显示bus的状态.34. 用show lane database显示LECS数据库可容.35. 用show lane client显示LEC的状态.36. 用show module显示已安装的模块列表.37. 用物理接口建立与VLAN的连接:router# configure terminalrouter(config)# interface media module/portrouter(config-if)# description description-stringrouter(config-if)# ip address ip-addr subnet-maskrouter(config-if)# no shutdown38. 用中继链路来建立与VLAN的连接:router(config)# interface module/port.subinterfacerouter(config-ig)# encapsulation[isl|dotlq] vlan-numberrouter(config-if)# ip address ip-address subnet-mask39. 用LANE 来建立与VLAN的连接:router(config)# interface atm module/portrouter(config-if)# no ip addressrouter(config-if)# atm pvc 1 0 5 qsaalrouter(config-if)# atm pvc 2 0 16 ilnirouter(config-if)# interface atm module/port.subinterface multipoint router(config-if)# ip address ip-address subnet-maskrouter(config-if)# lane client ethernet elan-numrouter(config-if)# interface atm module/port.subinterface multipointrouter(config-if)# ip address ip-address subnet-namerouter(config-if)# lane client ethernet elan-namerouter(config-if)# …40. 为了在路由处理器上进行动态路由配置,可以用下列IOS命令来进行: router(config)# ip routingrouter(config)# router ip-routing-protocolrouter(config-router)# network ip-network-numberrouter(config-router)# network ip-network-number41. 配置默认路由:switch(enable) set ip route default gateway42. 为一个路由处理器分配VLANID,可在接口模式下使用下列命令: router(config)# interface interface numberrouter(config-if)# mls rp vlan-id vlan-id-num43. 在路由处理器启用MLSP:router(config)# mls rp ip44. 为了把一个外置的路由处理器接口和交换机安置在同一个VTP域中: router(config)# interface interface numberrouter(config-if)# mls rp vtp-domain domain-name45. 查看指定的VTP域的信息:router# show mls rp vtp-domain vtp domain name46. 要确定RSM或路由器上的管理接口,可以在接口模式下输入下列命令:router(config-if)#mls rp management-interface47. 要检验MLS-RP的配置情况:router# show mls rp48. 检验特定接口上的MLS配置:router# show mls rp interface interface number49. 为了在MLS-SE上设置流掩码而又不想在任一个路由处理器接口上设置访问列表:set mls flow [destination|destination-source|full]50. 为使MLS和输入访问列表可以兼容,可以在全局模式下使用下列命令:router(config)# mls rp ip input-acl51. 当某个交换机的第3层交换失效时,可在交换机的特权模式下输入下列命令:switch(enable) set mls enable52. 若想改变老化时间的值,可在特权模式下输入以下命令:switch(enable) set mls agingtime agingtime53. 设置快速老化:switch(enable) set mls agingtime fast fastagingtime pkt_threshold54. 确定那些MLS-RP和MLS-SE参与了MLS,可先显示交换机引用列表中的容再确定:switch(enable) show mls include55. 显示MLS高速缓存记录:switch(enable) show mls entry56. 用命令show in arp显示ARP高速缓存区的容。
交换机和路由器常用命令大全交换机和路由器配置命令Cisco 交换机的命令行模式:1、用户模式Switch>2、特权模式Switch>enableSwitch#3、全局配置模式Switch#config terminalSwitch(config)#4、接口模式Switch(config)#interface fastethernet 0/1Switch(config-if)#Fastethernet表示百兆位以太网接口。
Ethernet表示十兆位以太网接口。
Gigabitethernet表示千兆位以太网接口。
Tengigabitethernet表示万兆位以太网接口。
如果从特权模式回到用户模式,需要输入disable命令,其他无论在那个模式,只要输入命令exit就能回到前一个模式,在全局模式或是接口模式,只要输入命令end都能回到特权模式,或者按下ctrl+z 组合键等效于命令end。
(命令行帮助机制:1、“?”。
2、Tab键。
)常用快捷组合键:Ctrl+A 光标移动到命令行的开始位置。
Ctrl+E 光标移动到命令行的结束位置。
一、常用命令介绍:1、hostname 用于配置主机名,可简写为host.Switch(config)#host sw1Sw1(config)#2、show version 显示系统IOS名称以及版本信息,可简写为sh ver.3、Show running-config 查看交换机当前配置信息,可简写为shrun.4、Show startup-config 显示已保存的配置信息,可简写为sh star.5、Copy running-config startup-config 保存当前配置信息,可简写为copy run star。
这个命令还等效于write(简写为wr)。
保存当前配置如下:Switch#wr 或者switch#copy run star6、erase nvram 删除已保存的配置信息,这命令等效于erasestartup-config.(擦除)。
交换机路由器命令大全(结合配置实例)交换机路由器命令大全(结合配置实例)交换机和路由器是计算机网络中常用的网络设备,用于实现数据包的转发和路由选择。
在实际应用中,我们需要使用命令来配置交换机和路由器的各项参数。
本文将给出交换机和路由器常用命令的大全,并结合实际配置示例进行说明。
一、交换机命令1. 查看交换机基本信息查看交换机型号、固件版本、序列号等基本信息:show version2. 配置交换机端口设置交换机接口的速率、全双工模式等参数:interface interface_namespeed speed_valueduplex {full | half}3. 查看交换机端口状态查看交换机端口的连接状态、速率、工作模式等信息:show interfaces status4. 配置交换机VLAN创建VLAN和端口关联,实现VLAN的隔离和管理:vlan vlan_idname vlan_nameinterface interface_name5. 查看交换机MAC表显示交换机学习到的MAC地址和对应的端口:show mac-address-table6. 配置交换机链路聚合将多个物理端口绑定为一个逻辑端口,提高带宽和冗余性:interface port-channel channel_numberdescription description_textswitchport mode trunk/access7. 交换机Spanning Tree配置配置交换机的Spanning Tree协议参数,避免网络环路:spanning-tree vlan vlan_idpriority priority_value二、路由器命令1. 查看路由表显示路由器的路由表,包括直连路由、静态路由和动态路由表项:show ip route2. 配置静态路由手动配置路由器的静态路由表,指定目的网络和下一跳信息:ip route destination_network subnet_mask next_hop_ip3. 配置路由器接口配置路由器的接口参数,包括IP地址、子网掩码、描述等:interface interface_nameip address ip_address subnet_maskdescription description_text4. 配置路由器OSPF协议配置路由器之间的OSPF动态路由协议,实现网络的动态路由选择:router ospf process_idnetwork network_address wildcard_mask area area_number5. 配置路由器ACL配置路由器的访问控制列表,用于控制数据包的流量:access-list access_list_number permit/deny source destination6. 配置路由器NAT配置路由器的网络地址转换功能,实现内网与外网的互通:interface interface_nameip nat inside/outside三、配置实例1. 配置交换机端口接口GigabitEthernet0/1配置为100Mbps全双工模式:interface GigabitEthernet0/1speed 100duplex full2. 配置交换机VLAN创建VLAN10,将接口GigabitEthernet0/1划分到VLAN10:vlan 10name VLAN10interface GigabitEthernet0/13. 配置路由器接口将接口GigabitEthernet0/0配置为192.168.1.1/24的IP地址:interface GigabitEthernet0/0ip address 192.168.1.1 255.255.255.0description LAN interface4. 配置静态路由配置路由器的静态路由表,将目的网络192.168.2.0/24指向下一跳192.168.1.2:ip route 192.168.2.0 255.255.255.0 192.168.1.25. 配置路由器ACL设置访问控制列表,允许源IP地址为192.168.1.0/24的流量通过:access-list 1 permit 192.168.1.0 0.0.0.2556. 配置路由器NAT设置路由器的NAT,将内部接口GigabitEthernet0/1地址转换为公网地址:interface GigabitEthernet0/1ip nat inside以上是交换机和路由器常用命令的大全以及配置实例。
使用的是cisco网络设备操作系统命令,其他厂商设备应该相差不远,实验使用的设备时cisco catalyst1912交换机和cisco 2621路由器。
终端的IP配置命令:Ipconfig /ip IP地址子网掩码;Ipconfig /dg 网关IP常用的交换机的配置命令:交换机工作在OSI 模型的第二层(数据链路层), 地址学习, 转发过滤, 消除循环是交换机的三个主要功能。
有三种模式,“>”用户模式,“#”特权模式,“(CONFIG)#”全局模式.从用户模式进入特权模式:enable从特权模式进入全局模式:configure terminal,在特权模式下输入disable或者exit 回到用户模式,其他模式类似。
从全局模式进入端口模式:interface e0/1。
switch: ;ROM状态,路由器是rommon>hostname> ;用户模式hostname# ;特权模式hostname(config)# ;全局配置模式hostname(config-if)# ;接口状态用户模式(>)下:可以查看一些基本的配置信息。
特权模式(#)下:show ip 查看交换机的IP地址。
Show interface 查看所有端口的配置信息show interfaces Ethernet 0/1 查看E0/1口的信息Show interface e0/1 查看e0/1端口的配置信息。
show version 查看系统硬件的配置,软件版本号等。
show port ;(CatOS)显示每个端口的简要信息(号、VLAN、双工、…)show interface ;(IOS)show trunk ;(CatOS)显示中继信息(模式、封装、允许端口、剪裁、…)show interface trunk ;(IOS)show spantree 45 ;(CatOS)显示端口的STP模式、类型、状态、速端口、…) show spanning-tree 45 ;(IOS)Show running-config (show running也可以)查看当前正在运行的配置信息全局模式//配置模式((config)#):设置交换机名:hostname[交换机名]如:hostname switch1设置交换机的IP地址:ip address [ip address ][netmask]如ip address 172.16.0.1 255.255.0.0设置交换机的缺省网关:ip default-gatway [ip address]如:ip default-gatway 172.16.0.1设置密码enable password level [1-15] [passwork]1-15 表示级别,1表示设置登录时的密码,15设置进入全局模式的密码。
一、交换机恢复出厂设置及其基本配置>enable (进入特权模式) #set default Y (重置) #write#reload Y (重启)二、三层交换机telnet 方式管理交换机.A 、(第一种方法命令行)1) //进入全局配置模式2) #enable password 0 [密码] (0表示明文、8表示密文)3) username admin privilege 15 password 7 [密码] (15表示最高级别,7表示密文) 4) Login (表示登入) 5)int vlan 16)ip add 192.168.100.1 255.255.255.0 7) telnet-server enable B 、(第二种方法命令行)1) //进入全局配置模式 2)setup [Y]3) 选择 “1” 表示中文4)在此图中选择1设置IP 地址及掩码。
在选2返回5)在选择2 ,设置TELNET的用户名及密码6)选择6 保存退出三、二层交换机web和telnet方式登入管理交换机(两种方式)A、(第一种方法命令行)# username admin privilege 15 password 7 [密码] (15表示最高级别,7表示密文)#enable password admin (登入特权密码)#web language Chinese (设置配置http 服务器的使用语言为中文)# ip http server# int vlan 1#ip add 192.168.100.1 255.255.255.0#no shutdownB、第二种方法命令行具体步骤与上面三层交换机的TELNET的第二种方法一样。
C、三层交换机的web登入交换机管理:#web-user admin password 7#ip http web (开启web 服务)#int vlan 1#ip add 192.168.10.254 255.255.255.0 (设置登入交换机的ip地址)#no shutdown (激活端口)四、交换机Vlan的划分(注意:针对二层交换机只能有一个ip地址)1) #Vlan x (x范围:1-4094)2) #In vlan x3) #Ip add [IP] [子网掩码]4)#no shutdown五、怎么把二层交换机当PC来用?第一方法①二层交换机设置VLAN 接口IP,它是PCC的IP:192.168.1.3 。
华为路由器交换机常用命令华为路由器交换机常用命令文档1、连接路由器交换机1.1 使用Console端口连接1.2 使用Telnet远程连接1.3 使用SSH远程连接2、系统管理2.1 修改设备名称2.2 设备备份与恢复2.3 设备升级与软件安装2.4 日志管理2.5 用户管理2.6 系统时间配置3、接口配置3.1 查看接口状态3.2 配置接口IP地质3.3 配置接口描述3.4 配置接口MTU3.5 配置接口速率与双工模式3.6 配置接口ACL3.7 配置接口链路聚合(LAG)4、VLAN 配置4.1 创建VLAN4.2 配置接口VLAN成员关系4.3 配置接口访问VLAN4.4 配置接口Trunk模式4.5 配置VLAN间路由4.6 配置VLAN间ACL控制5、路由配置5.1 配置静态路由5.2 配置动态路由(OSPF,BGP,RIP) 5.3 配置路由跟踪5.4 配置路由重分发5.5 配置路由策略5.6 配置路由保护6、安全配置6.1 配置访问控制列表(ACL) 6.2 配置端口安全6.3 配置802.1X认证6.4 配置密钥链(Key Chn)6.5 配置IPsec VPN7、QoS 配置7.1 配置流量分类7.2 配置流量策略7.3 配置队列调度7.4 配置流量控制附件:1、常用命令示例2、路由器交换机配置示例法律名词及注释:1、ACL(访问控制列表)- 一种用于控制网络流量的策略,可以基于源IP地质、目标IP地质、传输层协议和端口号等信息进行匹配。
2、VLAN(虚拟局域网)- 基于交换机端口的逻辑划分,将不同的端口划分到不同的虚拟局域网中,实现隔离和安全性。
3、LAG(链路聚合)- 将多个物理链路合并为一个逻辑链路,提高链路带宽和冗余能力。
4、OSPF(开放最短路径优先)- 一种用于动态路由选择的协议,根据链路状态信息计算最短路径。
5、BGP(边界网关协议)- 一种用于互联网自治系统间的路由选择的协议。
交换机路由器命令1、系统配置命令1.1 基本配置命令- 设定主机名称命令:hostname [名称]- 设定启动文件位置命令:boot system [文件名]1.2 接口配置命令- 进入接口配置模式命令:interface [接口编号]- 设定IP地质命令:ip address [IP地质]1.3 路由配置命令- 设定默认路由命令:ip route 0:0:0:0 0:0:0:0 [下一跳IP地质]- 设置静态路由命令:ip route [目的网络地质] [目的子网掩码] [下一跳IP地质]1.4 网络服务设置命令- 设置DNS服务器命令:ip name-server [DNS服务器IP地质]2、VLAN配置命令2.1 创建VLAN命令- 进入全局配置模式命令:vlan database- 创建VLAN命令:vlan [VLAN编号]2.2 接口VLAN设置命令- 进入接口VLAN模式命令:interface vlan [VLAN编号]- 设定IP地质命令:ip address [IP地质]3、交换机配置命令3.1 端口设置命令- 进入端口配置模式命令:interface [端口编号]- 设置接口类型命令:switchport mode [access/trunk] - 设置接口所属VLAN命令:switchport access vlan [VLAN编号]3.2 链路聚合命令- 创建聚合组命令:interface port-channel [组号]- 将端口加入聚合组命令:channel-group [组号] mode [active/passive]3.3 STP配置命令- 进入全局配置模式命令:spanning-tree mode [STP 模式]- 设定优先级命令:spanning-tree priority [优先级]4、路由器配置命令4.1 接口配置命令- 进入接口配置模式命令:interface [接口编号]- 设定IP地质命令:ip address [IP地质]4.2 OSPF配置命令- 进入全局配置模式命令:router ospf [进程ID]- 添加网络命令:network [网络地质] [反掩码] area [区域ID]附件:1、附件1:交换机路由器配置示例文件法律名词及注释:- IP地质:Internet Protocol Address,互联网协议地质,用于标识网络中的设备的唯一地质。
交换机路由器常用命令交换机和路由器是网络中非常重要的设备,熟练掌握它们的常用命令对于网络管理和故障排除至关重要。
下面为您介绍一些交换机和路由器常用的命令。
一、交换机常用命令1、`enable` 命令这个命令用于进入特权模式。
在特权模式下,可以执行更多高级的配置和管理操作。
2、`configure terminal` 命令输入此命令后,可以进入全局配置模式,对交换机的整体参数进行设置。
3、`interface` 命令通过`interface` 加上接口类型和编号,例如`interface ethernet0/1` ,可以进入特定接口的配置模式,对该接口的参数进行详细配置。
4、`vlan` 命令`vlan` 相关的命令用于创建、删除和配置 VLAN(虚拟局域网)。
比如`vlan 10` 创建 VLAN 10 ,`name VLAN10` 为 VLAN 10 命名。
5、`show vlan` 命令用于查看交换机上已创建的VLAN 信息,包括VLAN 编号、名称、端口成员等。
6、`show interfaces` 命令此命令可以查看交换机各个接口的状态、速率、双工模式等详细信息。
7、`port trunk allowpass vlan` 命令在配置 trunk 链路时,使用该命令允许特定的 VLAN 通过 trunk 链路。
8、`spanningtree` 命令用于配置生成树协议,防止网络环路。
例如`spanningtree moderstp` 可以设置生成树的模式为快速生成树。
二、路由器常用命令1、`enable` 命令同样用于进入特权模式。
2、`configure terminal` 命令进入全局配置模式。
3、`interface` 命令例如`interface fastethernet 0/0` ,进入特定的接口配置模式。
4、`ip address` 命令为接口配置 IP 地址,如`ip address 19216811 2552552550` 。
路由器和交换机命令大全路由器和交换机是计算机网络中常用的设备,它们在数据传输和网络管理中发挥着重要的作用。
掌握路由器和交换机的命令是网络管理和故障排除的基本要求。
本文将为您提供常见的路由器和交换机命令大全,以帮助您更好地理解和应用这些设备。
一、路由器命令1. show ip route:显示路由表中的所有路由信息。
2. show interfaces:显示接口的状态和统计信息。
3. show running-config:显示当前路由器的配置信息。
4. show version:显示路由器的硬件和软件版本信息。
5. configure terminal:进入全局配置模式。
6. interface interface-name:进入指定接口的配置模式。
7. ip address ip-address subnet-mask:为接口配置IP地址和子网掩码。
8. ip route destination-network subnet-mask next-hop:配置静态路由。
9. access-list access-list-number {deny | permit} source destination:配置访问控制列表。
10. clear arp-cache:清除路由器的ARP缓存。
11. debug {protocols | ip | interface}:启用某个调试功能来监控网络流量或接口状态。
二、交换机命令1. show interfaces:显示接口的状态和统计信息。
2. show mac-address-table:显示交换机的MAC地址表。
3. show running-config:显示当前交换机的配置信息。
4. show vlan:显示交换机的VLAN信息。
5. configure terminal:进入全局配置模式。
6. interface interface-name:进入指定接口的配置模式。
华为路由器、交换机配置命令大全华为路由器配置命令大全:一、登录华为路由器控制台1:使用PuTTY或其他SSH客户端登录到华为路由器:```ssh admin<路由器IP地址>```2:输入登录密码进行验证。
二、基本配置命令1:设置主机名:```sysname <主机名>```2:配置管理接口:```interface GigabitEthernet0/0/0ip address <IP地址> <子网掩码>```3:配置VLAN接口:```interface Vlanif <VLAN ID>ip address <IP地址> <子网掩码>```三、路由相关配置命令1:静态路由配置:```ip route-static <目标网络> <子网掩码> <下一跳地址> ```2:动态路由配置:```router ospf <进程ID>router-id <路由器ID>network <网络地址> <子网掩码> area <区域ID>3: BGP路由配置:```bgp <AS号码>router-id <路由器ID>peer <对端IP地址> as-number <对端AS号码>```四、安全配置命令1:配置防火墙规则:```acl number <ACL编号>rule <规则序号> permit source <源地址> destination <目的地址>rule <规则序号> deny source <源地址> destination <目的地址>```2:开启SSH服务:ssh server enable```3:配置AAA认证:```aaalocal-user <用户名> password irreversible-cipher <加密密码>authorization-attribute user-role network-admin```五、NAT配置命令1:配置静态NAT:```interface GigabitEthernet0/0/0nat outbound <内部接口> <外部接口>```2:配置动态NAT:nat address-group <地址组名>address <内部地址> <外部地址>```3:配置PAT:```interface GigabitEthernet0/0/0nat address-group <地址组名>```附件:1:示例配置文件(附件1)2:路由器接口图(附件2)法律名词及注释:1:主机名:路由器的标识名称。
锐捷互换机、路由器常用命令锐捷互换机、路由器常用命令介绍互换机配置命令模式EXEC 模式:用户模式 switch>互换机信息的查察,简单测试命令特权模式 switch#查察、管理互换机配置信息,测试、调试配置模式:全局配置模式 switch(config)#配置互换机的整体参数接口配置模式 switch(config-if)#配置互换机的接口参数进入全局配置模式Switch #c onfigure terminalSwitch(config)#exitSwitch#进入接口配置模式Switch(config)#interface fastethernet 0/1 Switch(config-if)#exit Switch(config)#从子模式下直接返回特权模式Switch(config-if)#endSwitch#命令行其余功能获取帮助switch#?switch#show ?命令简写全写: switch# configure terminal简写: Switch# config使用历史命令Switch# (向上键 )Switch# (向下键 )配置互换机 Telnet 功能配置远程登岸密码Switch(config)#enable secret level 1 0ruijie配置进入特权模式密码Switch (config)#enable secret level 15 0 ruijie 为互换机配置管理 IPSwitch (config)#interface vlan 1Switch (config-if)#no shutdownSwitch(config-if)#ip addressSwitch (config-if)#end配置文件的管理保留配置将目前运转的参数保留到 flash 顶用于系统初始化时初始化参数Switch#copy running-config startup-config Switch#write memorySwitch#write删除配置永远性的删除 flash 中不需要的文件使用命令删除目前的配置:在配置命令前加no例: switch(config-if)# no ipaddress 查察配置文件内容Switch#show configure查察保留在FLASH 里的配置信息Switch#show running-config查察RAM里目前奏效的配置配置 Port VLAN创立 VLAN10 ,将它命名为 test 的例子Switch# configure terminalSwitch(config)# vlan 10 Switch(config-vlan)# name test Switch(config-vlan)#end把接口 0/10 加入 VLAN10 Switch#configure terminal Switch(config)# interface fastethernet 0/10 Switch(config-if)#switchport mode access Switch(config-if)# switchport access vlan 10 Switch(config-if)# end将一组接口加入某一个VLANSwitch(config)#interface range fastethernet 0/1-8,0/15,0/20Switch(config-if-range)# switchport access vlan 20注:连续接口 0/1-8,不连续接口用逗号分开,但必定要写明模块编号配置 Tag VLAN-Trunk把 Fa0/1 配成 Trunk 口Switch# configure terminalSwitch(config)# interface fastethernet0/1Switch(config-if)# switchport mode trunk把端口 Fa0/20 配置为 Trunk 端口,可是不包括VLAN 2 :Switch(config)# interface fastethernet 0/20 Switch(config-if)# switchport trunk allowed vlan remove 2Switch(config-if)# endNative VLAN配置命令:Switch(config-if)# switchport trunk native vlan 20Switch(config-if)# end注意:每个 Trunk 口的缺省 native VLAN 是 VLAN 1 在配置 Trunk 链路时,请保证连结链路两头的Trunk 口属于同样的 native VLAN保留 /消除 VLAN 信息将 VLAN 信息保留到 flash 中Switch#write memory从 flash 中只消除 VLAN 信息从 RAM 中删除 VLANSwitch(config)#no vlan VLAN-id生成树协议的配置开启生成树协议Switch(config)#Spanning-tree封闭生成树协议Switch(config)#no Spanning-tree配置生成树协议的种类Switch(config)#Spanning-tree mode stp/rstp锐捷全系列互换机默认使用 MSTP 协议配置互换机优先级Switch(config)#spanning-tree priority <0-61440>(“0”或“ 4096”的倍数、共 16 个、缺省32768)恢复到缺省值Switch(config)# no spanning-tree priority配置互换机端口的优先级Switch(config)#interface interface-typeinterface-numberSwitch(config-if)#spanning-tree port-priority number配置 STP、RSTPSpanning Tree 的缺省配置:封闭 STPSTP Priority是32768STP port Priority是128STP port cost 依据端口速率自动判断Hello Time 2 秒Forward-delay Time 15秒Max-age Time 20 秒可经过 spanning-tree reset 命令让 spanning tree 参数恢复到缺省配置查察生成树协议配置显示生成树状态Switch#show spanning-tree显示端口生成树协议的状态Switch#show spanning-tree interface fastethernet <0-2/1-24>配置 aggregate port将该接口加入一个APSwitch #c onfigure terminalSwitch(config)#interface interface-type interface-idSwitch(config-if-range)#port-groupport-group-number假如这个 AP 不存在,可自动创立AG 端口查察聚合端口的汇总信息Switch#show aggregateport summary查察聚合端口的流量均衡方式Switch#show aggregateport load-balance路由器上配置 telnet第一步 : 配置端口地点RouterA# configure terminal!进入全局配置模式RouterA(config)# interface fastethernet1/0!进入路由器接口配置模式!配置路由器管理接口IP 地点RouterA(config-if)# no shutdown!开启路由器 f 1/0 接口第二步:配置远程登录密码RouterA(config)#line vty0 4!进入路由器线路配置模式RouterA(config-line)#login!配置远程登录RouterA(config-line)# password star!设置路由器远程登录密码为“star”RouterA(config-line)#end第三步:配置路由器特权模式密码RouterA(config)# enable secret star!设置路由器特权模式密码为“star”或许RouterA(config)# enable password star查察配置文件show version!查看版本及指引信息show running-config!查察运行配置show startup-config!查察用户保留在 NVRAM 中的配置文件保留配置文件Router#copy running-config startup-config Router#write memoryRouter#write删除配置文件!删除初始配置文件查察路由信息router#show ip routeCodes: C - connected, S – static , R – RIP ,O- OSPFIA - OSPF inter area ,E1-OSPF external type 1 E2 - OSPF external type 2 ,172.16.0.0/24 is subnetted, 1 subnetsC172.16.11.0 is directly connected, serial1/2O E2 172.22.0.0/16 [110/20] via 10.3.3.3,01:03:01, Serial1/2静态路由配置命令配置静态路由用命令ip routerouter(config)#ip route [ 网络编号 ] [子网掩码 ] [转发路由器的 IP 地点 /当地接口 ]例: ip route 192.168.10.0 255.255.255.0 serial 1/2例:静态路由描绘转发路径的方式有两种指向当地接口(即从当地某接口发出)指向下一跳路由器直连结口的 IP 地点(马上数据包交给 X.X.X.X )配置默认路由:router(config)#ip route 0.0.0.0 0.0.0.0 [ 转发路由器的 IP 地点 /当地接口 ]RIP 路由协议的版本RIPv1有类路由协议,不支持 VLSM以广播的形式发送更新报文不支持认证RIPv2无类路由协议,支持VLSM以组播的形式发送更新报文支持明文和 MD5 的认证配置 RIP 协议配置步骤1、开启 RIP 路由协议进度Router(config)#router rip2、申请本路由器参加RIP 协议的直连网段信息3、指定 RIP 协议的版本 2(默认是 version1) Router(config-router)#version24、在 RIPv2 版本中封闭自动汇总Router(config-router)#no auto-summary查察 RIP 配置信息考证 RIP 的配置Router#show ip protocols显示路由表的信息Router#show ip route消除 IP 路由表的信息Router#clear ip route在控制台显示RIP 的工作状态Router#debug ip ripOSPF 协议OSPF 配置以下:1、创立 loopback 接口,定义 ROUTE ID routerA(config)#interface loopback 10 routerA(config)#ip address2、开启 OSPF 进度routerA(config)#router ospf 1010代表进度编号,只拥有当地意义3、申请直连网段routerA(config-router)#network 0.0.0.255 area 0注意反掩码和地区号查察 OSPF 配置信息考证 OSPF 的配置Router#show ip ospf显示路由表的信息Router#show ip route消除 IP 路由表的信息Router#clear ip route在控制台显示 OSPF 的工作状态Router#debug ip ospf三层互换的路由功能三层互换机默认开启路由功能Switch(config)#ip routing(开启三层互换机路由功能 )三层互换机配置路由接口的两种方法开启三层互换机物理接口的路由功能Switch(config)#interface fastethernet 0/5 Switch(config-if)#no switchportSwitch(config-if)#no shutdown封闭物理接口路由功能Switch(config-if)# switchport采纳 SVI 方式( switch virtual interface)Switch(config)#interface vlan 10Switch(config-if)#ipSwitch(config-if)#no shutdown三层互换机和路由器相连的网络方法一 (SVI) :Switch(config)#interface f0/10Switch(config-if)#switchport access vlan 10 Switch(config-if)#exitSwitch(config)#interface vlan10 switch(config-if)#ip addressSwitch(config-if)#no shutdown方法二 (路由接口 ):Switch(config)#interface f0/10Switch(config-if)#no switchportSwitch(config-if)#ip addressSwitch(config-if)#no shutdown三层互换机路由协议的配置静态路由Switch(config)#ip route[x.x.x.x/interface]RIPSwitch(config)#router ripSwitch(config-router)#network X.X.X.X Switch(config-router)#version 2注:三层互换机不支持no auto-summary OSPFSwitch(config)#router ospfareax查察三层互换机路由配置查察路由接口信息Switch#show ip interface查察路由表。
H3C交换机和路由器常用命令注释原文地址:H3C交换机和路由器常用命令注释作者:济南百谷信息、system-view 进入系统视图模式2、sysname 为设备命名3、display current-configuration 当前配置情况4、language-mode Chinese|English 中英文切换5、interface Ethernet 1/0/1 进入以太网端口视图6、port link-type Access|Trunk|Hybrid 设置端口访问模式7、undo shutdown 打开以太网端口8、shutdown 关闭以太网端口9、quit 退出当前视图模式10、vlan 10 创建VLAN 10并进入VLAN 10的视图模式11、port access vlan 10 在端口模式下将当前端口加入到vlan 10中12、port E1/0/2 to E1/0/5 在VLAN模式下将指定端口加入到当前vlan中13、port trunk permit vlan all 允许所有的vlan通过H 3C路由器常用命令注释1、system-view 进入系统视图模式2、sysname R1 为设备命名为R13、display ip routing-table 显示当前路由表4、language-mode Chinese|English 中英文切换5、interface Ethernet 0/0 进入以太网端口视图6、ip address 192.168.1.1 255.255.255.0 配置IP地址和子网掩码7、undo shutdown 打开以太网端口8、shutdown 关闭以太网端口9、quit 退出当前视图模式10、ip route-static 192.168.2.0 255.255.255.0 192.168.12.2 description To.R2 配置静态路由11、ip route-static 0.0.0.0 0.0.0.0 192.168.12.2 description To.R2 配置默认的路由H3C S3100 SwitchH3C S3600 SwitchH3C MSR 20-20 Router小技巧1、调整超级终端的显示字号;2、捕获超级终端操作命令行,以备日后查对;3、language-mode Chinese|English 中英文切换;4、复制命令到超级终端命令行,粘贴到主机;5、交换机清除配置:<H3C>reset save ;<H3C>reboot ;6、路由器、交换机配置时不能掉电,连通测试前一定要检查网络的连通性,不要犯最低级的错误。
7、192.168.1.1/24 等同192.168.1.1 255.255.255.0;在配置交换机和路由器时,192.168.1.1 255.255.255.0 可以写成:192.168.1.1 248、设备命名规则:地名-设备名-系列号例:PingGu-R-S3600一、交换机简单管理协议增加指令----以便接入华为的管理软件中snmp-agentsnmp-agent community read publicsnmp-agent community write privatesnmp-agent sys-info version v1 v3snmp-agent trap enable备注:每台新增的交换机均需加入上述指令集合,否则不能为管理软件所管理二、将新增交换机的VLAN1段设置IP地址interface vlan 1ip address 10.63.0.1 255.255.254.0三、华为交换机指令的相关案例Quidway]super password 修改特权用户密码[Quidway]sysname 交换机命名[Quidway]interface ethernet 0/1 进入接口视图[Quidway]interface vlan x 进入X段VLAN接口视图[Quidway-Vlan-interfacex]ip address 10.65.1.1 255.255.0.0 为VLAN段设置地址[Quidway]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 静态路由=网关[Quidway]user-interface vty 0 4[S3026-ui-vty0-4]authentication-mode password[S3026-ui-vty0-4]set authentication-mode password simple 222[S3026-ui-vty0-4]user privilege level 3[Quidway-Ethernet0/1]duplex {half|full|auto} 配置端口双工工作状态[Quidway-Ethernet0/1]speed {10|100|auto} 配置端口工作速率[Quidway-Ethernet0/1]flow-control 配置端口流控[Quidway-Ethernet0/1]mdi {across|auto|normal} 配置端口MDI/MDIX状态平接或扭接[Quidway-Ethernet0/1]port link-type {trunk|access|hybrid} 设置接口工作模式[Quidway-Ethernet0/1]shutdown 关闭/重起接口[Quidway-Ethernet0/2]quit 退出系统视图[Quidway]vlan 3 创建/删除一个VLAN/进入VLAN模式[Quidway-vlan3]port ethernet 0/1 to ethernet 0/4 在当前VLAN增加/删除以太网接口[Quidway-Ethernet0/2]port access vlan 3 将当前接口加入到指定VLAN [Quidway-Ethernet0/2]port trunk permit vlan {ID|All} 设trunk允许的VLAN [Quidway-Ethernet0/2]port trunk pvid vlan 3 设置trunk端口的PVID[Quidway]monitor-port <interface_type interface_num> 指定和清除镜像端口[Quidway]port mirror <interface_type interface_num> 指定和清除被镜像端口[Quidway]port mirror int_list observing-port int_type int_num 指定镜像和被镜像[Quidway]description string 指定VLAN描述字符[Quidway]description 删除VLAN描述字符[Quidway]display vlan [vlan_id] 查看VLAN设置[Quidway]stp {enable|disable} 开启/关闭生成树,默认关闭[Quidway]stp priority 4096 设置交换机的优先级[Quidway]stp root {primary|secondary} 设置交换机为根或根的备份[Quidway-Ethernet0/1]stp cost 200 设置交换机端口的花费[SwitchA-vlanx]isolate-user-vlan enable 设置主vlan[SwitchA]Isolate-user-vlan <x> secondary <list> 设置主vlan包括的子vlan[Quidway-Ethernet0/2]port hybrid pvid vlan <id> 设置vlan的pvid [Quidway-Ethernet0/2]port hybrid pvid 删除vlan的pvid[Quidway-Ethernet0/2]port hybrid vlan vlan_id_list untagged 设置无标识的vlan如果包的vlan id与PVId一致,则去掉vlan信息. 默认PVID=1。
所以设置PVID为所属vlan id, 设置可以互通的vlan为untagged.----------------------------------------、system-view 进入系统视图模式2、sysname 为设备命名3、display current-configuration 当前配置情况4、language-mode Chinese|English 中英文切换5、interface Ethernet 1/0/1 进入以太网端口视图6、port link-type Access|Trunk|Hybrid 设置端口访问模式7、undo shutdown 打开以太网端口8、shutdown 关闭以太网端口9、quit 退出当前视图模式10、vlan 10 创建VLAN 10并进入VLAN 10的视图模式11、port access vlan 10 在端口模式下将当前端口加入到vlan 10中12、port E1/0/2 to E1/0/5 在VLAN模式下将指定端口加入到当前vlan中13、port trunk permit vlan all 允许所有的vlan通过H3C路由器常用命令注释1、system-view 进入系统视图模式2、sysname R1 为设备命名为R13、display ip routing-table 显示当前路由表4、language-mode Chinese|English 中英文切换5、interface Ethernet 0/0 进入以太网端口视图6、ip address 192.168.1.1 255.255.255.0 配置IP地址和子网掩码7、undo shutdown 打开以太网端口8、shutdown 关闭以太网端口9、quit 退出当前视图模式10、ip route-static 192.168.2.0 255.255.255.0 192.168.12.2 description To.R2 配置静态路由11、ip route-static 0.0.0.0 0.0.0.0 192.168.12.2 description To.R2 配置默认的路由H3C S3100 SwitchH3C S3600 SwitchH3C MSR 20-20 Router小技巧1、调整超级终端的显示字号;2、捕获超级终端操作命令行,以备日后查对;3、language-mode Chinese|English 中英文切换;4、复制命令到超级终端命令行,粘贴到主机;5、交换机清除配置:<H3C>reset save ;<H3C>reboot ;6、路由器、交换机配置时不能掉电,连通测试前一定要检查网络的连通性,不要犯最低级的错误。