Router and switch 配置命令
- 格式:doc
- 大小:185.50 KB
- 文档页数:11
Router&Switch练习路由器的访问控制列表(ACL)实验一:HDLC和PPP封装1、实验目的:通过实验掌握访问控制列表(ACL)应用配置2、设备需求:Cisco 2514路由器三台,PC机3 台3、实验拓扑:试验目的:Pc1 所在网络不能访问R==2回环接口20.0.0.1 ,其余均可以出pc3所在网络的主机可以telnet路由器R==2 。
其余均不能4、配置步骤配置router1Router>Router>enableRouter#CON TRouter(config)#hostname r==1r==1(config)#interface serial 0r==1(config-if)#ip address 10.0.0.1 255.0.0.0r==1(config-if)#clock rate 9600r==1(config-if)#no shutdownr==1(config-if)#EXITr==1(config)#interface ethernet 0r==1(config-if)#ip address 192.168.1.1 255.255.255.0 r==1(config-if)#no shutdownr==1(config-if)#EXITr==1(config)#interface ethernet 1r==1(config-if)#ip address 192.168.2.1 255.255.255.0 r==1(config-if)#no shutdownr==1(config-if)#EXITr==1(config)#router eigrp 1r==1(config-router)#network 192.168.1.0r==1(config-router)#network 192.168.2.0r==1(config-router)#network 10.0.0.0r==1(config-router)#EXITr==1(config)#end配置router2Router>enableRouter#CON TRouter(config)#hostname r==2r==2(config)#interface serial 0r==2(config-if)#ip address 10.0.0.2 255.0.0.0 r==2(config-if)#no shutdownr==2(config-if)#EXITr==2(config)#interface loopback 0r==2(config-if)#ip address 20.0.0.1 255.0.0.0 r==2(config-if)#no shutdownr==2(config-if)#EXITr==2(config)#interface serial 1r==2(config-if)#ip address 30.0.0.1 255.0.0.0 r==2(config-if)#clock rate 64000r==2(config-if)#no shutdownr==2(config-if)#EXITr==2(config)#ROUr==2(config)#router eigrp 1r==2(config-router)#network 10.0.0.0r==2(config-router)#network 20.0.0.0r==2(config-router)#network 30.0.0.0r==2(config-router)#EXITr==2(config)#line vty 0 4r==2(config-line)#password yemar==2(config-line)#loginr==2(config)#access-list 1 deny 192.168.1.0 0.0.0.255r==2(config)#access-list 1 permit anyr==2(config)#interface serial 0r==2(config-if)#ip ar==2(config-if)#ip access-group 1 inr==2(config-if)#exitr==2(config)#access-list 2 permit 192.168.3.0 0.0.0.255 r==2(config)#line vty 0 4r==2(config-line)#access-class 2 inRouter3配置Router>enableRouter#CON TRouter(config)#hostname r==3r==3(config)#interface serial 1r==3(config-if)#ip address 30.0.0.2 255.0.0.0r==3(config-if)#no shutdownr==3(config-if)#EXITr==3(config)#interface ethernet 0r==3(config-if)#ip address 192.168.3.1 255.255.255.0r==3(config-if)#no shutdownr==3(config-if)#EXITr==3(config)#router eigrp 1r==3(config-router)#network 30.0.0.0r==3(config-router)#network 192.168.3.0r==3(config-router)#EXITr==3(config)#END5.分别各两台pc设IP与网关(略)6.根据实验目的测试(略)Pc1 所在网络不能访问R==2回环接口20.0.0.1 ,其余均可以出pc3所在网络的主机可以telnet路由器R==2 。
1、switch>:用户模式——能查看版本信息2、在用户模式下输入enable会进特权模式——它能保存、修改、删除这一系列的配置switch>enable→switch#:特权模式,下面有一些命令就在此命令下完成:①、删除vlan的文件配置:delete flash:vlan.dat②、删除vlan中的配置文件:erase startup-config③、查看vlan配置文件是否被删除及vlan的是否创建:show vlan④、重新启动交换机:reload⑤、查看当前交换机的配置:show running-config⑥、保存对交换机所配置的内容,即是保存在Nvram:copy running-configstartup-config⑦、检查Nvram的内容:show startup-config⑧、检查虚拟接口 vlan的特征:show interface vlan 1⑨、查看接口IP的属性:show ip interface vlan 1⑩、查看cisco的信息:show version⑪、查看交换机所用快速以太网接口的默认属性:show interface fastethernet 0/18⑫、查看闪存目录中的内容:show flash 或dir flash3、在特权模式下输入configure terninal后会进入全局模式,一切的配置必须在此模式中进行配置Switch#configure terninal→switchp(config)#:全局模式①、配置路由器设备的名字:switch(config)#hostname + 交换机的名字②、配置进入特权模式的密码,即使能密码:switch(config)#enable password +密码③、配置非明文密码:switch(config)#enable secret + 密码4、为交换机配置console口①、进入现成配置模式,即进入console口:switch(config)# line console 0②、设置密码(重新启动时需要此密码):switch(config-line)#password + 密码③、允许登录:switch(config-line)#login5、配置远程登录的密码:①、首先要配置使能密码②、允许让几个人登录:switch(config)#line vty 0 4(即允许五个登录)③、设置密码:switch(config-line)#password + 密码④、允许远程登录:switchp(config-line)#login6、在全局模式下的有关命令①对所有密码进行加密:switch(config)#service password-encryption②、不解析错误的命令:switch(config)#no ip domain-lookup7、创建vlan(2—1001,注vlan 1既不可以创建,也不可以删除)①、创建vlan :vlan + 要创建vlan的值②、给vlan取名:switch(config-vlan)#name + 名字(此步可以不要)③、把PC与交换机相连的端口添加到相应的vlan中:a、Switch(config)#interface + 端口b、Switch(config-if)#switchport access vlan + 相应vlan的值④、需要传递多个vlan信息就要打中继口,即trunka、switch(config)#interface + 交换机另一端口b、switch(config-if)#switchport mode trunk8、传统vlan 的通信(1)、router的配置①、为接口配置IP地址(该IP是相应vlan的PC网关)②、激活端口:no shutdown(2)、switch的配置①、创建vlan,将PC端口划入相应vlan②、将switch与router相连的端口划入相应的vlan(3) 、PC的配置:就是给PC配置IP,注PC的默认网关与router的IP相同,网关相同9、单臂路由实现vlan的通信(1)router配置①、添加子接口:interface f0/0.1(此处有多少个vlan就添加多少个子接口)②、将子接口封装到相应的vlan:encapsulation dot + 相应vlan的值③、将子接口配置IP:ip add +ip地址 + 子网掩码④、激活物理接口:no shutdown(2)、switch的配置①、创建 vlan,交PC的端口划入到相应vlan②、与router相连的端口打trunk(3)、配置PC的IP9、三层交换(1)、配置三层交换①、启用三层交换:(config)#ip routing②、创建vlan:(config)# vlan + 要创建vlan的值③、把相应的vlan配置IPa、指定一个vlan:(config)#interface vlan + vlan相应的值c、配置IP:(config-if)#ip add + ip + 子网掩码(2)、配置switch①、每个交换机创建vlan②、把端口划分到相应的vlan中③、打中继口(trunk)Show命令1、show version 这个命令可以查看IOS版本号,已启动时间,Flash中的IOS 的文件名,router里面共有什么端口,寄存器的值等等。
Router and switch 配置命令精华压缩版72010-03-22 18:1115.在基于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 secondsswitch(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 enablecluster-name cv21. 为了从一条中继链路上删除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-address ATM(lane-config-databade)# name elan2-name server-atm-address les2-nsap-address ATM(lane-config-databade)# name …。
Cisco路由与交换配置命令汇总一、Cisco2950交换机的基本配置:Switch> //用户模式Switch>enable //进入特权模式Switch# //特权模式Switch#configure terminal //进入全局模式Switch(config)# //全局模式Switch(config)#host C2950 //配置主机名C2950(config)#C2950(config)#enable password cisco //设置进入特权模式的普通口令C2950(config)#enable secret class //设置进入特权模式的加密口令C2950(config)#line console 0 //设置进入控制台0的口令C2950(config-line)#password S1C2950(config-line)#loginC2950(config-line)#exitC2950(config)#line vty 0 4 //设置远程登陆口令C2950(config-line)#password S2C2950(config-line)#loginC2950(config-line)#exitC2950(config)#二、交换机端口的设置C2950#config terminalC2950(config)#interface fa0/1 //进入接口fa0/1配置模式C2950(config-if)#description SalesPrinter //配置描述信息C2950(config-if)#duplex full //配置全双工C2950(config-if)#speed 100 //配置接口带宽C2950(config-if)#endC2950#show interface //查看验证接口配置C2950#show running-config //查看验证全部配置C2950#copy running startup //将运行配置复制到启动配置三、交换机的远程配置C2950(config)#interface vlan 1 //进入VLAN 1接口配置模式C2950(config-if)#ip address 192.168.1.10 255.255.255.0//配置交换机的管理IP地址C2950(config-if)#exitC2950(config)#C2950(config)#line vty 0 4 //配置交换机远程登录口令C2950(config-line)#password classC2950(config-line)#loginC2950(config-line)#exitC2950(config)#enable password cisco //设置进入特权模式的口令C2950(config)#在PC机命令行中利用Telnet来登录连接交换机,也可在登录一台交换机后,再利用Telnet命令,登录连接另一台交换机。
Switch命令大全!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-listswitch(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 secondsswitch(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-address ATM(lane-config-databade)# name elan2-name server-atm-address les2-nsap-address ATM(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 multipoint router(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高速缓存区的内容。
交换机基本状态:switch: ROM状态,switch> 用户模式(输入enable进入特权配置模式)switch# 特权配置模式(输入config terminal进入全局配置)switch(config)# 全局配置模式(输入interface fastEthernet端口号进入接口模式) switch(config-if)# 接口状态交换机的特权配置模式Switch#show version 基本配置的查看switch#show vlan ;查看vlan配置信息switch#show interface ;查看端口信息switch#dir flash: ;查看闪存switch#show interfaces vlan 1 查看有关IP协议信息和相关命令的设置是否己生效switch#show running-config 查看当前配置清单switch#show interface fastEthernet0/1 查看指定端口的具体配置和统计信息switch#erase startup-config 将交换机恢复为出厂黙认状态switch#sho run interface fastEthernet0/17 查看关于0/17端口的配置信息switch#sho mac-address-table aging-time 设置MAC地址表超时时间switch#show mac-address-table 查看整个MAC地址表使用CDP协议switch#show cdp 显示了设备的CDP全局配置信息switch#show cdp interface f0/17 显示了fo/17接口的CDP配置信息switch#show cdp traffic 显示有关CDP包的统计信息(CDP conters信息)switch#show cdp neighbors 列出与本设备相邻的设备在switch#sshow cdp entry 后面键入“*”号即可显示所有入项的细节设置端口双工模式switch(config)#duplex ? { autu full half }全局配置模式switch>enable;进入特权模式switch#config terminal 进入全局配置模式switch(config)#hostname xxx;设置交换机的主机名switch(config)#enable password xx ;设置使能口令switch(config)#enable secret xxx ;设置使能密码设置交换机的管理IP地址:switch(config)#interface vlan 1 ;(进入vlan 1)switch(config-if)#ip address 192.168.1.1 255.255.255.0 (设置IP地址和子网掩码)switch(config-if)#no shut (开启端口)switch(config-if)#exit (退出)switch(config)#ip default-gatew.02.1.1.1 202.1.1.2 (设置所使用的域名服务哭地址) switch(config)#line console 0 ;进入控制台口switch(config-line)#line vty 0 4 ;进入虚拟终端switch(config-line)#login ;允许登录switch(config-line)#password xx ;设置登录口令xx创建与删除VLAN方法(选删除端口后删除VLAN)方法一(enable模式下创建vlan)switch#vlan database 进入vlan数据库模式switch(vlan)#vlan 2 name test20 新建vlan 2及vlan 名为test20switch(vlan)#end 退出即生效switch#show vlan brief 查看vlan配置switch#copy running-config startup config 保存配置删除VLAN方法switch#vlan database 进入vlanswitch(vlan)#no vlan 2 删vlan 2方法二(conf t模式下创建vlan)Switch#conf t 进入全局配置模式Swintch(config)#vlan 2 新建vlan号为2Swintch(config-vlan)#name test20 名字命名为test20(可选)Swintch(config-vlan)#end 退出switch#copy running-config startup config 保存配置删除VLAN方法Switch#conf t 进入全局配置模式Swintch(config)#no vlan 2 删除vlan2在VLAN中添加端口switch#conf t 进行全局配置模式switch(config)#interface fastEthernet0/1 ;进入端口0/1switch(config-if)#switchport mode access 定义二层接入端口switch(config-if)#switchport access vlan 2 把端口分配给vlan 2在VLAN中删除端口switch#conf t 进行全局配置模式switch(config)#interface fastEthernet0/1 ;进入端口1switch(config-if)#no switchport access vlan 10 将端口0/1从vlan10中删除switch(config-if)#end 退出switch#show vlan brief 查看vlan配置交换机端口上配置Trunk中继switch#conf t 进行全局配置模式switch(config)#interface fastEthernet0/1 ;进入端口1switch(config-if)#switchport mode access ;设置端口为接入模式switch(config-if)#switchport mode trunk ;设置端口为中继模式switch(config-if)#switchport mode dynamic auto 自动协商是否成为中继端口switch(config-if)#switchport mode dynamic desirable 设置接口为主动尝试转换中继链路switch(config-if)#switchport mode nonegotiate 将接口设定为永久中继模式,但禁止接口产生DTP帧,要建立部继链路,就必须手工将邻接接口配置为中继接口switch(config-if)#end 退出switch#show interfaces 0/1 switchport 显示有关switchport的配置从Trunk中添加、删除vlanswitch#conf t 进行全局配置模式switch(config)#int f0/1 ;进入端口1switch(config-if)#switchport mode trunk ;设置为中继switch(config-if)#switchport trunk allowed vlan 1,2 ;设置允许的vlan switch(config-if)#switchport trunk encap dot1q ;设置vlan 中继Switch#write 保存配置信息路由器支持的命令:路由器显示命令:router#show run ;显示配置信息router#show interface ;显示接口信息router#show ip route ;显示路由信息router#show cdp nei ;显示邻居信息router#reload ;重新起动路由器口令设置:router>enable ;进入特权模式router#config terminal ;进入全局配置模式router(config)#hostname ;设置交路由器的主机名router(config)#enable secret xxx ;设置特权加密口令router(config)#enable password xxb ;设置特权非密口令router(config)#line console 0 ;进入控制台口router(config-line)#line vty 0 4 ;进入虚拟终端router(config-line)#password xx ;设置登录口令xxrouter(config-line)#login ;要求口令验证router(config)#(Ctrl+z) ;返回特权模式router#exit ;返回命令路由器配置:router(config)#int s0/0 ;进入Serail接口router(config-if)#no shutdown ;激活当前接口router(config-if)#clock rate 64000 ;设置同步时钟router(config-if)#ip address ;设置IP地址router(config-if)#ip address second ;设置第二个IProuter(config-if)#int f0/0.1 ;进入子接口router(config-subif.1)#ip address ;设置子接口IProuter(config-subif.1)#encapsulation dot1q ;绑定vlan中继协议router(config)#config-register 0x2142 ;跳过配置文件router(config)#config-register 0x2102 ;正常使用配置文件router#reload ;重新引导路由器文件操作:router#copy running-config startup-config ;保存配置router#copy running-config tftp ;保存配置到tftprouter#copy startup-config tftp ;开机配置存到tftprouter#copy tftp flash: ;下传文件到flashrouter#copy tftp startup-config;下载配置文件ROM状态:Ctrl+Break ;进入ROM监控状态rommon>confreg 0x2142 ;跳过配置文件rommon>confreg 0x2102 ;恢复配置文件rommon>reset ;重新引导rommon>copy xmodem: flash: ;从console传输文件rommon>IP_ADDRESS=10.65.1.2 ;设置路由器IPrommon>IP_SUBNET_MASK=255.255.0.0 ;设置路由器掩码rommon>TFTP_SERVER=10.65.1.1 ;指定TFTP服务器IP rommon>TFTP_FILE=c2600.bin ;指定下载的文件rommon>tftpdnld ;从tftp下载rommon>dir flash: ;查看闪存内容rommon>boot ;引导IOS静态路由:ip route ;命令格式router(config)#ip route 2.0.0.0 255.0.0.0 1.1.1.2 ;静态路由举例router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2 ;默认路由举例动态路由:router(config)#ip routing ;启动路由转发router(config)#router rip ;启动RIP路由协议。
1.在基于IOS的交换机上设置主机名/系统名: switch(config)# hostname hostname 在基于CLI的交换机上设置主机名/系统名: switch(enable) set system name name-string 2.在基于IOS的交换机上设置登录⼝令: switch(config)# enable password level 1 password 在基于CLI的交换机上设置登录⼝令: switch(enable) set password switch(enable) set enalbepass 3.在基于IOS的交换机上设置远程访问: switch(config)# interface vlan 1 switch(config-if)# ip address ip-address netmask switch(config-if)# ip default-gateway ip-address 在基于CLI的交换机上设置远程访问: switch(enable) set interface sc0 ip-address netmask broadcast-address switch(enable) set interface sc0 vlan switch(enable) set ip route default gateway 4.在基于IOS的交换机上启⽤和浏览CDP信息: switch(config-if)# cdp enable switch(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]。
Router和Switch的最基本配置Router基本配置:Router> \\路由器的启动时所进入的用户模式Router>enable \\键入该命令以进入特许模式Router# \\此显示模式表示已经进入了特许模式Router#configure terminal \\键入该命令以进入全局配置模式Router(config)# \\显示模式表示已经进入全局配置模式Router(config)#hostname SNXL01 \\名称改为“SNXL01”配置控制台密码SNXL01(config)#line console 0 file://0.0.0.0/表示第0 con 口SNXL01(config_line)#loginSNXL01(config_line)#password cisco配置控制台其他参数SNXL01(config)#line console 0SNXL01(config_line)#exec-timeout 0 0 \\配置console口超时时间SNXL01(config_line)#logging synchronous \\配置显示同步R1(config)# line vty 0 4 file://0-4/个telnet 用户线程可同时登陆R1(config-line)# exec-timeout 5 2配置欢迎信息SNXL01(config)#banner motd # (回车)输入一段欢迎信息并以“#”结束。
(回车)配置路由器密码SNXL01(config)#enable password cisco \\为路由器设置使能口令为ciscoSNXL01(config)#enable secret ciscolab \\为路由器设置使能密码为ciscolab配置路由器端口IP地址SNXL01(config)#interface fastethernet 0/0SNXL01(config-if)#ip add 192.168.1.1 255.255.255.0 SNXL01(config-if)#no shutdownSNXL01(config-if)#exitSNXL01(config)#exit配置路由器f0/0端口描述信息SNXL01(config)interface fastethernet 0/0SNXL01(config-if)#description “要描述的信息”进入路由器的串口配置模式SNXL01 (config)#interface serial 0/0SNXL01 (config_if)#设置串口的时钟频率SNXL01 (config)#interface serial 0/0SNXL01 (config_if)#clock rate 64000设置串口的带宽SNXL01 (config)#interface serial 0/0SNXL01 (config_if)#bandwidth 64配置静态路由SNXL01(config) #ip route 目标网络目标网络子网掩码下一跳地址配置缺省路由SNXL01(config) #ip route 0.0.0.0 0.0.0.0 下一跳地址SNXL01#copy running-config startup-config \\将配置信息存盘(存入NVRAM)SNXL01#show running-config \\查看当前的配置信息(RAM中的信息)SNXL01#show startup-config \\查看已存盘的信息(NVRAM中的信息)SNXL01#show ip route \\查看路由表信息SNXL01#show cdp neighbors \\查看此路由器还连有哪些cisco的设备SNXL01#erase startup-config \\将路由器恢复到出厂配置SNXL01#reload \\重新启动路由器路由器密码恢复1开机按住Ctrl+Break2执行confreg 0x21423执行reset4执行copy startup-config running-config 将路由器配置拷贝到running-config中5在全局配置模式下修改密码,并执行config-register 0x21026 copy running-config startup-config 保存信息7 reload 重新启动路由器Switch基本配置:Switch> \\交换机的启动时所进入的用户模式Switch>enable \\键入该命令以进入特许模式Switch# \\此显示模式表示已经进入了特许模式Switch#configure terminal \\键入该命令以进入全局配置模式Switch(config)# \\此显示模式表示已经进入了全局配置模式Switch(config)#hostname SNXL01 \\键入该命令把交换机的名称改为“SNXL01”SNXL01(config)#enable password cisco \\为交换机设置使能口令为ciscoSNXL01(config)#enable secret cisco \\为交换机设置使能密码为ciscoSNXL01(config)#interface FastEthernet 0/10 \\进入交换机的快速以太网端口f0/10SNXL01(config-if)#description link to Server A \\配置f0/10的描述信息,描述此端口和服务器Server A相连SNXL01(config-if)#duplex full \\配置f0/10端口为全双工SNXL01(config-if)#speed 10 \\配置f0/10端口速率为10Mb/sSNXL01(config-if)#exit \\退出端口模式到全局配置模式SNXL01(config)#exit \\退出全局模式到特许模式SNXL01#copy running-config startup-config \\将配置信息存盘(存入NVRAM)SNXL01#show version \\查看交换机的版本信息SNXL01#show running-config \\查看当前的配置信息(RAM中的信息)SNXL01#show startup-config \\查看已存盘的信息(NVRAM中的信息)SNXL01#show mac-address-table \\查看交换机的MAC地址表内容SNXL01#show cdp neighbors \\查看此交换机还连有哪些cisco的设备SNXL01#erase startup-config \\将交换机恢复到出厂配置SNXL01#reload \\重新启动交换机Cisco Catalyst2950交换机的密码恢复1.关机2.按住“MODE”键开机3.等到超级终端显示已开机,松开“MODE”键4.执行flash_init命令,可以查看flash的内容,dir flash:5.把flash里的“config.text”文件改名字为“config.old”rename flash:config.text flash:config.old6.执行boot启动交换机7.把flash里的“config.old”文件改名字为“config.text” rename flash:config. old flash:config. text8.把“config.text”考入系统的“running-config”copy flash:config.text running-config9.修改密码并且存盘保存信息。
思科交换机路由基本配置命令常用命令1.配置接口:interface {interface_type} {interface_number}2.配置IP地址:ip address {IP_address} {subnet_mask}3.配置默认网关:ip default-gateway {default_gateway_IP}4.开启接口:no shutdown5.配置路由协议:router {routing_protocol}6.配置路由器ID:router-id {router_ID}7.配置路由信息:network {network_address} {subnet_mask}8.配置静态路由:ip route {destination_network} {subnet_mask}{next-hop_IP}9.配置动态路由:router {routing_protocol} {network_address}10.保存配置:copy running-config startup-config注意:上述命令仅作为参考,具体配置应根据实际环境和设备型号进行调整。
下面是一些基本的 Cisco 交换机路由配置命令:1.配置 hostname: hostname <name>2.配置 IP 地址: interface <interface> 后进入接口模式,再输入 ipaddress <ip address> <subnet mask>3.配置默认路由: ip route 0.0.0.0 0.0.0.0 <next hop IP>4.启用路由协议: router <protocol> (例如: router rip)5.配置路由连接: network <network address> (例如: network192.168.1.0)6.查看路由表: show ip routeCisco 交换机路由配置步骤1.进入配置模式:configure terminal2.配置 IP 地址和子网掩码:interface [interface-name] ; ip address[ip-address] [subnet-mask]3.配置默认路由:ip route 0.0.0.0 0.0.0.0 [next-hop-IP-address]4.启用路由协议:router [protocol-name] (如:router ospf)5.配置路由协议参数: [protocol-name] [process-id] (如:ospf 1)6.配置路由连接:network [network-address] [wildcard-mask] area[area-id] (如:network 192.168.1.0 0.0.0.255 area 0)7.保存配置:copy running-config startup-config8.退出配置模式:exit。
VLAN间的路由:基于锐捷S3550三层交换机1.1 实验目的掌握基于三层交换机进行VLAN间路由的配置方法。
1.2 实验环境1.3 实验的内容和要求(1)设置端口为T ag模式(2)同一VLAN里的计算机系统能跨交换机相互通信.(3)不同VLAN里的计算机系统也可以相互通信.1.4 实验说明第一步:在交换机SwitchA(S3550)上创建VLAN 10,并将0/5端口划分到VLAN 10中SwitchA # config !进入全局配置模式SwitchA (config)# vlan 10 !创建VLAN 10SwitchA(config-vlan) # name sylSwitchA(config-vlan) # exitSwitchA(config) # interface fastethernet 0/5SwitchA(config-if) # switchport access vlan 10SwitchA(config-if) # exit第二步:在交换机SwitchA(S3550)上创建Vlan 20,并将0/15端口划分到Vlan 20中SwitchA(config) # vlan 20SwitchA(config-vlan) # name bglSwitchA(config-vlan) # exitSwitchA(config) # interface fastethernet 0/15SwitchA(config-if) # switchport access vlan 20SwitchA(config-if) # exit第三步:把交换机SwitchA与SwitchB相连端口(假设为0/24)定义为tag vlan模式SwitchA(config)# interface fastethernet 0/24 !进入接口配置模式SwitchA(config-if)# switchport mode trunk !将fastethernet 0/24端口设为tag vl an模式验证测试:验证fastethernet 0/24端口已被设置为tag vlan模式SwitchA# show interface fastethernet 0/24 switchportInterface Switchport Mode Access Native Protected Vlan lists--------------------------------------------------------------------------------------Fa0/24 Enabled T runk 1 1 Disabled All第四步:在交换机SwitchB(S2126G-down)上创建Vlan10,并将0/5端口划分到Vlan10中(参照步骤一)第五步:把交换机SwitchB与SwitchA相连端口(假设为0/24)定义为tag vlan模式(参照步骤三)第六步:验证PC1与PC3能互相通信,但PC2与PC3不能互相通信第七步:创建网关,使三层交换机SwitchA (S3550)各VLAN间通信SwitchA(config)# interface vlan 10 !创建虚拟接口vlan 10SwitchA(config-if)# ip address 192.168.10.254 255.255.255.0!配置虚拟接口vlan 10的地址为192.168.10.254 SwitchA(config-if)# no shutdown !开启端口SwitchA(config-if)# exitSwitchA(config)# int vlan 20 !创建虚拟接口vlan 20SwitchA(config-if)# ip address 192.168.20.254 255.255.255.0!配置虚拟接口vlan 20的地址为192.168.20.254SwitchA(config-if)# no shutdown !开启端口验证测试:查看三层交换机SwitchA(S3550)路由接口的状态switchA# show ip interface !查看IP接口的状态Interface : VL10Description : Vlan 10OperStatus : UPManagementS tatus : EnabledPrimary Internet address: 192.168.10.254/24Broadcast address : 255.255.255.255PhysAddress : 00d0.f8ff.8ab5Interface : VL20Description : Vlan 20OperStatus : UPManagementS tatus : EnabledPrimary Internet address: 192.168.20.254/24Broadcast address : 255.255.255.255PhysAddress : 00d0.f8ff.8ab6第八步:为PC1,PC2,PC3添加网关测试结果:不同Vlan内的主机可以相互ping通注意事项:1. 两台交换机之间相连的端口应该设置为tag vlan模式。
2. 必需设置PC机的网关。
参考配置:SwitchA# show running-config !显示交换机SwitchA的全部配置Building configuration…Current configuration : 349 bytes!V ersion 1.0!Hostname SwitchAInterface FastEthernet 0/5Switchport access vlan 10!Interface FastEthernet 0/15Switchport access vlan 20!Interface FastEthernet 0/24Switchport mode trunk!Interface Vlan 10Ip address 192.168.10.254 255.255.255.0!Interface Vlan 20Ip address 192.168.20.254 255.255.255.0!EndSwitchB# show running-config !显示交换机SwitchB的全部配置Building configuration…Current configuration : 284 bytes!V ersion 1.0!Hostname SwitchBVlan 10name syl!Interface FastEthernet 0/5Switchport access vlan 10!Interface FastEthernet 0/24Switchport mode trunk!EndRouter and switch 配置命令更新时间:2009-05-31 作者:编辑整理来源: 点击:325 推荐挑错收藏打印关闭1、进入SETUP模式Router#setup2、时间设置router#clock set hh:mm:ss date moth year3、 router>show historyRouter>terminal history size lines4、 router#show version5、 router#show running-config6、 router#show starup-config7、 router(config)#hostname name 主机命名8、 router(config)#banner motd # message # 开机时的固定显示信息9、 router(config)#enable password password 特权模式明文密码10、 router(config)#no enable password11、 router(config)#enable secret password 特权模式加密密码12、 router(config)#no enable secret13、 router(config)#service password-encryption特权模式把明文密码加密密码,但没enable secret安全可以反解14、 router(config)#line console控制台密码15、 router(config-line)#login16、 router(config-line)#password password17、 router(config-line)#exec-timeout mm ss 禁止控制台会话自动退出18、 router(config-line)#logging synchronous重显被打乱的控制台输入router(config)#no ip domain-lookup 禁止域名解析19、 router(config)#line vty 0 4虚拟终端密码20、 router(config-line)#login21、 router(config-line)#password password22、 router(config)#interface type number(slot/port)端口设置23、 router(config-if)#ip address ip summast24、 router(config-if)#clock rate 64000(时钟频率单位为bps,只在DCE 端设置)25、 router(config-if)#bandwith 64(带宽设置,单位为KB)26、 router(config-if)#no shutdown(shutdown)27、 router(config-if )#media-type type(10base) 为以太网端口选择适当的介质类型28、 router(config-if )#ctrl+z保存退出到特权模式29、 router#30、 router>用户模式enable进入router#特权模式config terminal进入router(config)#全局配置模式31、Interface Router(config-if)#端口设置Subinterface Router(config-subif)# 子端口设置Controller Router(config-controller)# 控制口设置Line Router(config-line)# 虚拟口设置Router Router(config-router)# 路由设置IPX router Router(config-ipx-router)#IPX路由设置32、 router#show interface33、 router#show interface Ethernet 034、 router#show interface serial 035、 router#show running-config36、 router#show starup-config37、 router#show flash38、 router#show controller39、 router#show controller interface type40、 router#show running-configrouter#copy running-config starup-configrouter#copy running-config tftprouter#copy starup-config tftprouter#copy flash tftprouter#copy tftp star-configrouter#copy tftp flash端口状态Serial1 is up, line protocol is up正常工作Serial1 is up, line protocol is down连接问题Serial1 is down, line protocol is down端口问题Serial1 is administratively down, line protocol is down人为关闭配置寄存器的值1、关闭路由器的电源重新启动按住ctrl+break键入进2、>3、>o/r 0x2142(跳过nvarm启动恢复密码)4、>I5、当系统提示是否进入setup模式时,按N6、 router>7、 router>enable8、 router#9、进入修改后(包括密码、寄存器的值:0x2100为rom monitor启动、0x2101为setup模式启动、0x2102为10、 router#copy running-config starup-config11、 router#reload12、也可以在router#setup进入setup模式静态路由协议设置router(config)#ip route network submask(要到达的网络号掩码)ipaddress(下一跳或出口ip地址)router(config)#ip route 0.0.0.0 s0(出口端口或下一跳IP地址)rip设置router(config)#router riprouter(config-router)#network network-numberrouter#show ip protocol查看RIP信息router#show ip route 查看路由表router#debug ip rip查看RIP更新信息router(config-router)#passive-interface e0(阻止发出作息)router(config-router)#ip rip receive version 1 2接收1、2RIP版本信息igrp设置router(config)#router igrp as numberrouter(config-router)#network network numberrouter#show ip route 查看路由表router#debug ip igrp events 查看IGRP路由更新大概信息router#debug ip igrp transaction 查看IGRP路由更新详细信息Router(config-router)#variance multiplier 控制 IGRP load balancingRouter(config-router)#traffic-share {balanced | min}控制load-balanced traffic 的分布eigrp设置router(config)#router eigrp as numberrouter(config-router)#network network numberrouter(config)#no auto-summry 关闭自动汇总router(config)# auto-summry 打开自动汇总(默认是打开的)router#show ip route eigrp 显示当前的路由表里的EIGRP条目router#show ip protocol 显示活动的路由协议进程的参数和当前的状态router#show ip eigrp neighbors 显示被EIGRP发现的邻居router#show ip eigrp traffic 显示发出和收到的IP EIGRP 包的数量router#show ip eigrp topology 显示IP EIGRP的拓扑表Router#debug ip eigrpospf设置1. Router(config)#router ospf process-idRouter(config-router)#network address(可以是网络号也可以是Ip地址 mask (通配掩码)area area-idRouter(config-if)# ip ospf priority numbe 配置OSPF的优先级Router#show ip protocols 验证OSPF的配置Router#show ip route 显示路由器学到的所有路由Router#show ip ospf interface type number 显示 area-ID 和邻接信息Router#show ip ospf neighbor 基于每接口显示OSPF邻居信息Router#debug ip ospf eventsRouter#debug ip ospf packet2. Router(config)# interface loopback number(lookback回路配置)Router(config-if)# ip address ip-address subnet-maskRouter(config-if)# ip ospf cost cost-numbe 修改OSPF 的Cost数值Router(config-if)# ip ospf authentication-key key 配置明文口令Router(config-if)# ip ospf messge-digest-key keyid md5 key 配置MD5口令(keyid和key必须配对一致,两邻居才可以通信)Router(config-route)# area area-id authentication [message-digest]message-digest为可选项,使用后路由器只传送口令消息的摘要(或散列)配置OSPF区域的验证:3. Router(config-if)# ip ospf hello-interval seconds 配置hello间隔:Router(config-if)# ip ospf dead-interval seconds配置down机判断间隔访问列表1.标准访问列表(standard access lists):只使用源IP地址来做过滤决定Router(config)#access-list 10 deny 172.16.40.0 0.0.0.255 Router(config)#access-list 10 permit anyRouter(config)#int e1Router(config-if)#ip access-group 10 out使用IP标准ACL来控制VTY线路的访问.Router(config)#access-list 50 permit 172.16.10.3Router(config)#line vty 0 4Router(config-line)#access-class 50 in删除IP标准ACLRouter(config-line)#no ip access-class 50 inRouter(config)#no access-list 502.扩展访问列表(extended access lists):它比较源IP地址和目标IP地址,层3的协议字段,层4端口号来做过滤决定Router(config)#access-list 110 deny tcp any host 172.16.30.5 eq 21 Router(config)#access-list 110 deny tcp any host 172.16.30.5 eq 23 Router(config)#access-list 110 permit ip any anyRouter(config)#int e1Router(config-if)#ip access-group 110 out。