思科模拟器配置命令.pdf
- 格式:pdf
- 大小:287.17 KB
- 文档页数:10
思科交换机基本配置实例讲解目录1、基本概念介绍...............................................2、密码、登陆等基本配置.......................................3、CISCO设备端口配置详解......................................4、VLAN的规划及配置...........................................4.1核心交换机的相关配置.....................................4.2接入交换机的相关配置.....................................5、配置交换机的路由功能.......................................6、配置交换机的DHCP功能......................................7、常用排错命令...............................................1、基本概念介绍IOS: 互联网操作系统,也就是交换机和路由器中用的操作系统VLAN: 虚拟lanVTP: VLAN TRUNK PROTOCOLDHCP: 动态主机配置协议ACL:访问控制列表三层交换机:具有三层路由转发能力的交换机本教程中“#”后的蓝色文字为注释内容。
2、密码、登陆等基本配置本节介绍的内容为cisco路由器或者交换机的基本配置,在目前版本的cisco交换机或路由器上的这些命令是通用的。
本教程用的是cisco的模拟器做的介绍,一些具体的端口显示或许与你们实际的设备不符,但这并不影响基本配置命令的执行。
Cisco 3640 (R4700) processor (revision 0xFF) with 124928K/6144K bytes of memory.Processor board ID 00000000R4700 CPU at 100MHz, Implementation 33, Rev 1.22 Ethernet interfaces8 Serial interfacesDRAM configuration is 64 bits wide with parity enabled.125K bytes of NVRAM.8192K bytes of processor board System flash (Read/Write)--- System Configuration Dialog ---Would you like to enter the initial configuration dialog? [yes/no]: n# 此处我们选择no,不进入他的初始化配置向导Press RETURN to get started!# 选择no以后,提示你按回车键开始,此处我们需要按回车键*Mar 1 00:43:56.591: %IP-5-WEBINST_KILL: Terminating DNS process *Mar 1 00:43:58.379: %SYS-5-RESTART: System restarted --Cisco IOS Software, 3600 Software (C3640-JK9O3S-M), Version12.3(14)T7, RELEASE SOFTWARE (fc2)Copyright (c) 1986-2006 by Cisco Systems, Inc.Compiled Wed 22-Mar-06 21:46 by pwade*Mar 1 00:43:58.411: %SNMP-5-COLDSTART: SNMP agent on host Router is undergoing a cold startRouter># 等显示稳定后,出现最初的提示符,注意提示符是“>”,目前所处的状态称为用户模式。
思科路由器常用配置命令一览表:1-99恢复一个会话bfe手工应急模式设置clear复位功能clock管理系统时钟configure进入设置模式connect打开一个终端copy从tftp服务器拷贝设置文件或把设置文件拷贝到tftp服务器上debug调试功能diable退出优先命令状态diconnect断开一个网络连接enable进入优先命令状态erae擦除快闪内存e某it退出e某ce模式help交互帮助系统的描述lat打开一个本地传输连接lock锁定终端login以一个用户名登录logout退出终端mbranch向树形下端分支跟踪多路由广播mrbranch向树形上端分支跟踪反向多路由广播name-connection给一个存在的网络连接命名no关闭调试功能pad打开某.29PAD连接ping发送回显信息ppp开始点到点的连接协议reload停机并执行冷启动reume恢复一个活动的网络连接rlogin打开远程注册连接rh执行一个远端命令end发送信息到另外的终端行etup运行etup命令how显示正在运行系统信息lip开始SLIP协议tart-chat在命令行上执行对话描述ytat显示终端行的信息telnet远程登录terminal终端行参数tet测试子系统内存和端口tn3270打开一个tin3270连接trace跟踪路由到目的地undebug退出调试功能verify验证检查闪烁文件的总数where显示活动的连接which-route执行OSI路由表查找并显示结果write把正在运行的设置写入内存、网络、或终端某3在PAD上设置某.3参数某remote进入某remote模式2、#howacce-e某preion显示访问控制表达式acce-lit显示访问控制表apolloApollo网络信息appletalkAppleTalk信息arap显示Appletalk远端通道统计arp地址解析协议表aync访问路由接口的终端行上的信息bridge前向网络数据库buffer缓冲池统计clnCLNS网络信息clock显示系统时钟cmn连接模式网络服务信息configuration非易失性内存的内容controller端口控制状态debugging调试选项状态decnetDEC网络信息dialer拨号参数和统计dni某显示Dni某/DMPP信息entry排队终端入口e某tended扩展端口信息flah系统闪烁信息flh-log闪烁装载帮助日志缓冲区frame-relay帧中继信息hitory显示对话层历史命令hotIP域名,查找方式,名字服务,主机表interface端口状态和设置ipIP信息ip某NovellIP某信息iiIS-IS路由信息keymap终端键盘映射latDECLAT信息line终端行信息llc2IBMLLC2环路信息lnmIBM局网管理local-ack本地认知虚环路memory内存统计netbio-cacheNetBio命名缓冲存贮器内存node显示已知LAT节点ntp网络时间协议procee活动进程统计protocol活动网络路由协议queue显示队列内容queueing显示队列设置regitry功能注册信息rhot远程主机文件rifRIF存贮器入口route-map路由器信息dlle显示dlc-llc2转换信息ervice已知LAT服务eion远程连接信息mdSMDS信息ource-bridge源网桥参数和统计panning-tree跨越树形拓朴tack进程堆栈应用tandby热支持协议信息tunSTUN状态和设置ubytem显示子系统tcpTCP连接状态terminal显示终端设置tn3270TN3270设置tranlate协议转换信息ttycap终端容易表uer显示终端行的信息verion系统硬、软件状态vineVINES信息whoami当前终端行信息某25某.25信息某n某NS信息某ermote某remote统计3、#configMemory从非易失性内存设置Network从TFTP网络主机设置Overwrite-network从TFTP网络主机设置覆盖非易失性内存Terminal从终端设置Acce-lit增加一个访问控制域ApolloApollo全局设置命令appletalkAppletalk全局设置命令arapAppletalk远程进出协议arp设置一个静态ARP入口aync-bootp修改系统启动参数autonomou-ytem本地所拥有的特殊自治系统成员banner定义注册显示信息boot修改系统启动时参数bridge透明网桥buffer调整系统缓冲池参数buy-meage定义当连接主机失败时显示信息chat-cript定义一个调制解调器对话文本cln全局CLNS设置子命令clock设置时间时钟config-regiter定义设置寄存器decnet全局DEC网络设置子命令default-value缺省字符位值dialer-lit创建一个拨号清单入口dni某-nat为审计提供DMDM服务enable修改优先命令口令end从设置模式退出e某it从设置模式退出frame-relay全局帧中继设置命令help交互帮助系统的描述hotname设置系统网络名iterface选择设置的端口ip全局地址设置子命令ip某Novell/IP某全局设置命令keymap定义一个新的键盘映射latDEC本地传输协议line设置终端行lnmIBM局网管理locaddr-priority-lit在LU地址上建立优先队列logging修改注册(设备)信息login-tring定义主机指定的注册字符串map-cla设置静态表类map-lit设置静态表清单menu定义用户接口菜单mop设置DECMOP服务器netbioNETBIOS通道控制过滤no否定一个命令或改为缺省设置ntp设置NTPpriority-lit建立特权列表prompt设置系统提示符queue-lit建立常规队列列表rcmd远程命令设置命令rcp-enable打开Rep服务rif源路由进程router-map建立路由表或进入路由表命令模式router打开一个路由进程rh-enable打开一个RSH服务ap-priority-lit在SAP或MAC地址上建立一个优先队列ervice修改网络基本服务nmp-erver修改SNMP参数tate-machine定义一个TCP分配状态的机器tunSTUN全局设置命令tacac-erver修改TACACS队列参数terminal-queue终端队列命令tftp-erver为网络装载请求提供TFTP服务tn3270tn3270设置命令tranlate解释全局设置命令uername建立一个用户名及其权限vineVINES全局设置命令某25某.25的第三级某29某.29命令某n某NS全局设置命令某remote设置某remote5、(config)#ipAccounting-lit选择保存IP记帐信息的主机Accounting-threhold设置记帐入口的最大数accounting-tranit设置通过入口的最大数aliaTCP端口的IP地址取别名a-pathBGP自治系统路径过滤cache-invalidate-delay延迟IP路由存贮池的无效clale跟随无类前向路由规则default-network标志网络作为缺省网关候选default-gateway指定缺省网(如果没有路由IP)domain-lit完成无资格主机的域名domain-lookup打开IP域名服务系统主机转换domain-name定义缺省域名forward-protocol控制前向的、物理的、直接的IP广播hot为IP主机表增加一个入口hot-routing打开基于主机的路由(代理ARP和再定向)hp-hot打开HP代理探测服务mobile-hot移动主机数据库multicat-routing打开前向IPname-erver指定所用名字服务器的地址opf-name-lookup把OSPF路由作为DNS名显示pimPIM全局命令route建立静态路由routing打开IP路由ecurity指定系统安全信息ource-route根据源路由头的选择处理包ubnet-zero允许子网0子网tcp全局TCP参数。
interface 接口进入接口配置模式encapsulation frame-relay封装帧中继协议
frame-relay map ip IP地址 DLCI broadcast cisco/ietf 将目的IP地址和本地DLCI匹配
frame-relay lmi-type ansi/cisco/q933a
interface 接口.子接口
frame-relay interface-dlci NUMBER指定本地DLCI值
access-list 1-99permit/deny
address/any/host标准访问控制列表允许单个主机或某一个网段
access-list100-199permit协议
Address/any/host (eq 协议/端口号)
Address/any/host扩展访问控制列表注:1.当协议选择tcp时可选择端口号,针对某一个单独的功能创建访问控制列表;2.访问控制列表没有明确的允许就是禁止。
没有访问控制列表隐含denya any any语句
ip access-list standard/extended 编号 /
名称创建命名访问控制列表3.访问控制列表。
思科模拟器交换机配置
工具/原料
一台电脑
一个思科模拟器软件
方法/步骤
首先呢,下载并打开思科模拟器软件,在思科模拟器上找到Cisco 2960交换机一台,PC 2台,直通线若干条,进行连接配置。
规划设计,设计并配置计算机的IP地址,子网掩码,连接到交换机的端口,使用类
型都是直通线,设计并配置PC0的IP地址,子网掩码,网关分别为
192.168.10.11,255.255.255.0,192.168.10.1,pc1的IP地址,子网掩码,默认网关为192.168.10.12,255.255.255.0,192.168.10.1.
然后配置交换机的名称,方便自己的记忆,我们可以用”hostname *"进行对交换机
的名字配置,前提是要在交换机的全局配置模式下配置。
配置交换机的端口,在交换机的全局模式下输入“int 端口号”,然后启用配置模式
为“access”,配置命令为“switch mode access”
查看交换机端口状态信息,使用“show interface"可以查看交换机端口信息,双工
模式和速率,最重要的一点可以利用查看端口来对交换机进行维护。
除了会配置交换机的端口,也要学会对端口启用安全状态,首先利用”show mac-address-table",然后指定PC哪个端口启用安全。
感谢您的阅读,祝您生活愉快。
思科交换机命令大全1.设置主机名/系统名IOS:switch(config)# hostname "hostname"CLI:switch(enable) set system name name-string2.设置登录口令IOS:switch(config)# enable password level 1 passwordCLI: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-addressCLI:switch(enable) set interface sc0 ip-address netmask broadcast-address switch(enable) set interface sc0 vlanswitch(enable) set ip route default gateway4.启用和浏览CDP信息IOS:switch(config-if)# cdp enableswitch(config-if)# no cdp enableCLI:switch(enable) set cdp {enable|disable} module/port5.查看Cisco邻接设备的CDP通告IOS:switch# show cdp interface [type modle/port]switch# show cdp neighbors [type module/port] [detail]CLI:switch(enable) show cdp neighbors[module/port] [vlan|duplex|capabilities|detail] 6.端口描述 IOS:switch(config-if)#description escription-stringCLI:switch(enable)set port name module/number description-string7.设置端口速度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}8.设置以太网的链路模式IOS:switch(config-if)# duplex {auto|full|half}CLI:switch(enable) set port duplex module/number {full|half}9.配置静态VLANIOS: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)# endCLI:switch(enable) set vlan vlan-num [name name]switch(enable) set vlan vlan-num mod-num/port-list10.配置VLAN中继线IOS: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:switch(enable)set trunk module/port [on|off|desirable|auto|nonegotiate] Vlan-range [isl|dotlq|dotl0|lane|negotiate]11.配置VTP管理域IOS:switch# vlan databaseswitch(vlan)# vtp domain domain-nameCLI:switch(enable) set vtp [domain domain-name]12.配置VTP 模式IOS:switch# vlan databaseswitch(vlan)# vtp domain domain-nameswitch(vlan)# vtp {sever|cilent|transparent}switch(vlan)# vtp password passwordCLI:switch(enable) set vtp [domain domain-name][mode{ sever|cilent|transparent }][password password]13.配置VTP版本IOS:switch# vlan databaseswitch(vlan)# vtp v2-modeCLI:switch(enable) set vtp v2 enable14.启动VTP剪裁IOS:switch# vlan databaseswitch(vlan)# vtp pruningCLI:switch(enable) set vtp pruning enable15.配置以太信道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} 16.调整根路径成本IOS:switch(config-if)#spanning-tree [vlan vlan-list] cost costCLI:switch(enable)set spantree portcost moudle/port costswitch(enable)set spantree portvlancost moudle/port [cost cost][vlan-list] 17.调整端口IDIOS:switch(config-if)#spanning-tree[vlan vlan-list]port-priority port-priority CLI:switch(enable)set spantree portpri {mldule/port}priorityswitch(enable)set spantree portvlanpri {module/port}priority [vlans]18.修改STP时钟IOS: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:switch(enable) set spantree hello interval[vlan]switch(enable) set spantree fwddelay delay [vlan]switch(enable) set spantree maxage agingtiame[vlan]19.启用或禁用Port Fast 特征IOS:switch(config-if)#spanning-tree portfastCLI:switch(enable)set spantree portfast {module/port}{enable|disable}20.启用或禁用UplinkFast 特征IOS:switch(config)#spanning-tree uplinkfast [max-update-rate pkts-per-second]CLI:switch(enable)set spantree uplinkfast {enable|disable}[rate update-rate] [all-protocolsoff|on] 为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个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 multipointrouter(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高速缓存区的内容。
思科路由器命令大全思科路由器命令大全1.基本设置命令1.1 主机名配置●hostname [主机名]:设置路由器的主机名。
1.2 用户名和密码配置●enable password [密码]:设置特权模式的密码。
●enable secret [密码]:设置加密的特权模式密码。
●username [用户名] password [密码]:创建一个本地用户并设置密码。
●line console 0:进入控制台命令行配置模式。
●password [密码]:设置控制台访问密码。
●line vty [行号] [结束行号]:进入虚拟终端配置模式。
●password [密码]:设置虚拟终端访问密码。
1.3 IP 地质配置●interface [接口类型] [接口编号]:进入接口配置模式。
●ip address [IP 地质] [子网掩码]:设置接口的IP 地质和子网掩码。
●no shutdown:启用接口。
1.4 默认网关配置●ip default-gateway [默认网关地质]:设置默认网关。
2.路由配置命令2.1 静态路由配置●ip route [目标网络] [目标子网掩码] [下一跳地质]:配置静态路由。
2.2 动态路由配置●router rip:进入 RIP 路由配置模式。
●network [网络地质]:启动 RIP 并指定要进行路由的网络地质。
●router ospf [进程号]:进入 OSPF 路由配置模式。
●network [IP 地质] [反掩码] area [区域号]:配置 OSPF。
3.状态和监控命令3.1 接口状态命令●show ip interface brief:显示路由器接口的 IP 地质和状态。
●show interfaces [接口类型] [接口编号]:显示指定接口的详细信息。
●show interfaces status:显示接口的状态和统计信息。
3.2 路由表命令●show ip route:显示路由表信息。
相同VLAN间的通信:Switch0与Switch1配置命令相同:Switch#conf tSwitch(config)#vlan 10Switch(config-vlan)#exSwitch(config)#int rang f0/1-5Switch(config-if-range)#sw acc vlan 10Switch(config-if-range)#exSwitch(config)#int f0/24Switch(config-if)#sw mode trunk配置聚合口:(聚合口的成员口类型要一致)Switch0与Switch1配置命令相同:Switch(config)#int rang f0/23-24Switch(config-if-range)#channel-group 1 mode on Switch(config-if-range)#exSwitch(config)#int port-channel 1Switch(config-if)#sw mode trunk远程登陆交换机:Switch(config)#int vlan 1Switch(config-if)#ip add 1.1.1.1 255.255.255.0(IP地址要和远程登陆的客户机在同一个网段) Switch(config-if)#no shSwitch(config-if)#exSwitch(config)#line vty 0Switch(config-line)#password zlrSwitch(config-line)#exitSwitch(config)#enable secret 123Switch(config)#ex三层交换机不同VLAN间的通信:三层交换机配置:Switch(config)#vlan 10Switch(config-vlan)#vlan 20Switch(config-vlan)#exSwitch(config)#int rang f0/23-24Switch(config-if-range)#sw trunk encapsulation dot1qSwitch(config-if-range)#sw mode trunkSwitch(config-if-range)#exSwitch(config)#int vlan 10Switch(config-if)#ip add 192.168.10.254 255.255.255.0Switch(config-if)#no shSwitch(config-if)#exSwitch(config)#int vlan 20Switch(config-if)#ip add 192.168.20.254 255.255.255.0Switch(config-if)#no shSwitch(config-if)#exSwitch(config)#ip routingSwitch0与Switch1配置命令相同:Switch(config)#vlan 20Switch(config-vlan)#exSwitch(config)#int rang f0/6-10Switch(config-if-range)#sw acc vlan 20Switch(config-if-range)#exSwitch(config)#int f0/21Switch(config-if)#sw mode trunk端口安全:Switch1配置命令:Switch(config)#int f0/2Switch(config-if)#sw mode acc(端口安全配置要在端口是静态的前提下) Switch(config-if)#sw port-securitySwitch(config-if)#sw port-security violation protectSwitch(config-if)#sw port-security maximum 1Switch(config-if)#sw port-security mac-address 0000.0c8a.9206 Switch(config-if)#no sw port-security mac-address 0000.0c8a.9206 Switch(config-if)#sw port-security mac-address 0000.0c8a.92d6生成树协议的配置:在选定为根交换机的交换机下配置:Switch(config)#spanning-tree mode pvstSwitch(config)#spanning-tree vlan 1 priority 4096三层交换机与理由器的静态路由通信:ROUTER0:Router#conf tRouter(config)#int f1/0Router(config-if)#ip add 192.168.1.2 255.255.255.0Router(config-if)#no shRouter(config-if)#exRouter(config)#int f0/0Router(config-if)#ip add 192.168.2.254 255.255.255.0Router(config-if)#no shRouter(config-if)#exRouter(config)#ip route 192.168.10.0 255.255.255.0 192.168.1.1Router(config)#ip route 192.168.20.0 255.255.255.0 192.168.1.1三层交换机配置:(F0/1作为路由口的配置;若作为SVI配置,则只需把F0/1划分到VLAN10,VLAN20其中之一并把理由器的F1/0的IP地址设置到与SVI端口相同的网段)Switch(config)#int f0/1Switch(config-if)#no swSwitch(config-if)#ip add 192.168.1.1 255.255.255.0Switch(config-if)#no shSwitch(config-if)#exSwitch(config)#ip route 192.168.2.0 255.255.255.0 f0/1单臂路由配置:ROUTER1:Router(config)#int f0/0Router(config-if)#no shRouter(config-if)#exRouter(config)#int f0/0.1Router(config-subif)#encapsulation dot1q 30Router(config-subif)#ip add 192.168.30.254 255.255.255.0Router(config-subif)#no shRouter(config)#int f0/0.2Router(config-subif)#encapsulation dot1q 40Router(config-subif)#ip add 192.168.40.254 255.255.255.0Router(config-subif)#exSwitch2:Switch(config)#vlan 30Switch(config-vlan)#vlan 40Switch(config-vlan)#exSwitch(config)#int rang f0/1-5Switch(config-if-range)#sw acc vlan 30Switch(config-if-range)#exSwitch(config)#int rang f0/6-10Switch(config-if-range)#sw acc vlan 40Switch(config-if-range)#exSwitch(config)#int f0/24Switch(config-if)#sw mode trunkRIP协议:(连接好每个路由器的端口并配置好各个IP地址,再宣告各个路由器直连的网段)ROUTER1:Router(config)#route ripRouter(config-router)#version 2Router(config-router)#network 192.168.3.0Router(config-router)#network 192.168.30.0Router(config-router)#network 192.168.40.0Router(config-router)#exOSPF协议配置:(连接好每个路由器的端口并配置好各个IP地址,再宣告各个路由器直连的网段)ROUTER2:(作为ABR)Router(config)#route ospf 1Router(config-router)#network 192.168.100.0 0.0.0.255 area 1 Router(config-router)#network 192.168.4.0 0.0.0.255 area 0 Router(config-router)#network 192.168.5.0 0.0.0.255 area 0 路由重分布:ROUTER1(作为ASBR):Router(config)#route ripRouter(config-router)#version 2Router(config-router)#network 192.168.3.0Router(config-router)#network 192.168.30.0Router(config-router)#network 192.168.40.0Router(config-router)#exRouter(config)#route ospf 1Router(config-router)#network 192.168.100.0 0.0.0.255 area 1 Router(config-router)#exRouter(config)#route ripRouter(config-router)#redistribute ospf 1 metric 1Router(config-router)#exRouter(config)#route ospf 1Router(config-router)#redistribute rip metric 1 subnetsNAT配置:ROUTER4:Router>enRouter#conf tRouter(config)#int f0/0Router(config-if)#ip add 192.168.200.254 255.255.255.0Router(config-if)#no shRouter(config-if)#eRouter(config)#int f1/0Router(config-if)#ip add 192.168.150.254 255.255.255.0Router(config-if)#no shRouter(config-if)#exRouter(config)#ip nat inside source static 192.168.200.1 192.168.7.3Router(config)#int f0/0Router(config-if)#ip nat insideRouter(config-if)#exRouter(config)#int se3/0Router(config-if)#ip nat outsideRouter(config-if)#exRouter(config)#ip nat pool zlr 192.168.7.4 192.168.7.10 netRouter(config)#ip nat pool zlr 192.168.7.4 192.168.7.10 netmask 192.168.7.0 Router(config)#access-list 1 permit 192.168.200.0 0.0.0.255Router(config)#ip nat inside source list 1 pool zlrRouter(config)#int f0/0Router(config-if)#ip nat insideRouter(config-if)#exRouter(config)#int se3/0Router(config-if)#ip nat outsideRouter(config-if)#exRouter(config)#ip nat inside source static tcp 192.168.150.1 80 192.168.7.2 80 Router(config)#int f1/0Router(config-if)#ip nat insideRouter(config-if)#exRouter(config)#int se 3/0Router(config-if)#ip nat outsideRouter(config-if)#exRouter(config)#ip nat pool xl 192.168.7.20 192.168.7.20 netmask 192.168.7.0 Router(config)#access-list 2 permit 192.168.150.0 0.0.0.255Router(config)#ip nat inside source list 2 pool xl overloadRouter(config)#int f1/0Router(config-if)#ip nat insideRouter(config-if)#exRouter(config)#int se3/0Router(config-if)#ip nat outsideRouter(config-if)#ACL配置:ROUTER4:Router(config)#access-list 10 deny 192.168.4.0 0.0.0.255Router(config)#access-list 10 permit anyRouter(config)#int f1/0Router(config-if)#ip access-group 10 outRouter(config-if)#exRouter(config)#ip access-list standRouter(config)#ip access-list standard xzRouter(config-std-nacl)#10 deny 192.168.6.0 0.0.0.255Router(config-std-nacl)#20 permit anyRouter(config-std-nacl)#exRouter(config)#int f0/0Router(config-if)#ip access-group xz outROUTER2:Router(config)#access-list 100 deny tcp host 192.168.4.1 host 192.168.7.3 eq www Router(config)#access-list 100 permit ip any anyRouter(config)#int f0/0Router(config-if)#ip access-group 100 inROUTER3:Router(config)#ip access-list extended lrRouter(config-ext-nacl)#10 deny tcp host 192.168.6.1 host 192.168.7.2 eq www Router(config-ext-nacl)#20 permit ip any anyRouter(config)#int f0/0Router(config-if)#ip accRouter(config-if)#ip access-group lr in。