




已阅读5页,还剩44页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
精选文库 思科交换机基本配置实例讲解思科交换机基本配置实例讲解 精选文库 目目 录录 1、基本概念介绍、基本概念介绍 .2 2、密码、登陆等基本配置、密码、登陆等基本配置 .2 3、CISCO 设备端口配置详解设备端口配置详解.8 4、VLAN 的规划及配置的规划及配置.13 4.1 核心交换机的相关配置核心交换机的相关配置.13 4.2 接入交换机的相关配置接入交换机的相关配置.25 5、配置交换机的路由功能、配置交换机的路由功能 .30 6、配置交换机的、配置交换机的 DHCP 功能功能.31 7、常用排错命令、常用排错命令 .32 精选文库 1、基本概念介绍、基本概念介绍 IOS:互联网操作系统,也就是交换机和路由器中用的操作系统 VLAN:虚拟 lan VTP:VLAN TRUNK PROTOCOL DHCP:动态主机配置协议 ACL:访问控制列表 三层交换机:具有三层路由转发能力的交换机 本教程中“#”后的蓝色文字为注释内容。 2、密码、登陆等基本配置、密码、登陆等基本配置 本节介绍的内容为 cisco 路由器或者交换机的基本配置,在目前版本的 cisco 交换机或 路由器上的这些命令是通用的。本教程用的是 cisco 的模拟器做的介绍,一些具体的端口 显示或许与你们实际的设备不符,但这并不影响基本配置命令的执行。 Cisco 3640 (R4700) processor (revision 0 xFF) with 124928K/6144K bytes of memory. Processor board ID 00000000 R4700 CPU at 100MHz, Implementation 33, Rev 1.2 2 Ethernet interfaces 8 Serial interfaces DRAM 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), Version 12.3(14)T7, RELEASE SOFTWARE (fc2) 精选文库 Technical Support: 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 start Router # 等显示稳定后,出现最初的提示符,注意提示符是“”,目前所处的状态称为用户模式。 Router 用户模式 Router Routeren # 如果在当前状态下没有重复的命令,我们可以用“TAB”键来补齐这条命令,主要目的 是为了便于阅读 Routerenable 进入特权模式 # 从用户模式(user mode)进入到特权模式(exec mode),注意提示符的变化,提示符变为“#” Router#conf t Router#configure terminal 进入全局模式 (说明:#在特权模式下输入 configure terminal 进入全局配置模式(global configuration mode), 在这之下输入的命令叫做全局命令,一旦输入,将对整个 router 产生即时影响。如下,注意提 示符的变化:) Router(config)#exit# 请注意提示符发生了改变,当前的模式据叫做全局配置模式。 Router#conf *Mar 1 00:44:26.491: %SYS-5-CONFIG_I: Configured from console by console t # 在输入命 令的过程中,IOS 会出现一些即时提示。 Enter configuration commands, one per line. End with CNTL/Z. Router(config)#exit# 退出当前的全局配置模式的命令是 exit Router#conf t# 重新进入到全局配置模式 Enter configuration commands, one per line. End with CNTL/Z. Router(config)# *Mar 1 00:44:35.591: %SYS-5-CONFIG_I: Configured from console by consolehos # 这行是路由器(交换机)出现的一些即时提示。 Router(config)# hostname test # 这条命令用来更改当前设备的名字(名字中可包含设备的楼层、用途等信息) ,主要是为 了将来便于区分设备。 test(config)# # 回车后我们就会发现,但前的设备的名字已经发生了改变,变成了 test 了。 test(config)# enable pass # 这条命令用来配置设备的登陆密码,用 tab 键补齐后,再下一行显示完整命令。 test(config)#enable password cisco # 我们输入这台设备的登陆密码为 cisco test(config)#end# 我们退回到全局配置模式,校验一下刚才输入的密 码 test#sh r # 此命令的完整写法是 show running-start,此处的 sh r 用的是省略的写法,因无其他重复 的命令所以可以被执行。 精选文库 Building configuration. Current configuration : 1559 bytes ! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname test# 注意此处显示的是我们配置的设备的名字 ! boot-start-marker boot-end-marker ! enable password cisco # 此处显示的是刚才我们配置的 enable 密码,注意此时是用明文显示的,有点不安全。 ! no aaa new-model ! resource policy ! memory-size iomem 5 ip subnet-zero ! # 到这一行其实并未全部显示完配置的内容,我们可以按键盘上的任意键来终止继续显示。 在显示的过程中通过按回车键可以逐行显示,按空格键可以一页一页的显示。这些操作可 在实际的设备中体会。 test#conf t# 重新进入到全局配置模式 test(config)#service pass test(config)#service password-encryption # 利用这条命令给密码加密显示。 test(config)#end test#sh r# 退出到全局配置模式后,验证刚才的配置。 Building configuration. Current configuration : 1565 bytes ! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec service password-encryption 精选文库 ! hostname test ! boot-start-marker boot-end-marker ! enable password 7 070C285F4D06cisco # 注意此处刚才明文显示的密码已经变成加密显示了,这样从一定程度上保证了密码的安 全。 ! no aaa new-model ! resource policy ! memory-size iomem 5 ip subnet-zero ! # 验证完毕后按任何一个键中断显示,下面的内容说明终端登陆密码的配置。 test#conf t Enter configuration commands, one per line. End with CNTL/Z. test(config)#no service password-encryption # 可利用这条命令(前面加 no)来去掉密码加密功能,cisco 的所有命令都可以通过这种 方式来禁止。 test(config)#line con test(config)#line console 0# 利用这条命令来配置用超级终端登陆时的一些参数。 test(config-line)#pass test(config-line)#password cisco# 添加密码,此处我们配置的密码为 cisco test(config-line)#loggi test(config-line)#logging ? # 在任何情况下如果你忘记了命令的相关参数可以用?来获得提示和帮助 synchronous Synchronized message output test(config-line)#logging sy test(config-line)#logging synchronous # 在我们进行配置时,IOS 会产生一些即时的提示信息,而这些信息会冲乱我们的光标显 示,用这条命令可以将光标规矩在下一行,即使出现了一些即时的提示。 test(config-line)#exit# 退出当前 console 口的参数配置 test(config)#line vt?# telnet 登陆时相关参数的配置,此处用了?来寻求提示。 First Line number aux Auxiliary line console Primary terminal line tty Terminal controller 精选文库 vty Virtual terminal x/y Slot/Port for Modems test(config)#line vty 0 4 # 我们配置虚拟终端的 0 到 4,也就是同时允许 5 个用户可以 telnet 到这台设备上来。 test(config-line)#pass test(config-line)#password cisco # 我们配置 telnet 时的密码为 cisco,如果此处我们不设置密码,那么用 telnet 来登陆的时 候并不会以空密码登陆,而是会给你提示说:相关密码没有设置,禁止登陆。所以我们为 了能远程 telnet 到这台设备,此处的密码一定要设置好。 test(config-line)#login# 这条命令是允许通过 telnet 来登录 test(config-line)#exit# 退出当前配置模式到全局配置模式。 test(config)# test(config)# test#conf s # 我们在做配置的时候,会出现输入错误的情况,在这种情况下 ios 会以为你输入的是一 个域名 Translating s.domain server (55) # 那么 ios 会做长时间的搜寻,试图找到这个域名对应的 ip 地址. Translating s.domain server (55) # 这段时间是比较长的,那么我们如何禁用它的这个功能呢? % Unknown command or computer name, or unable to find computer address test#conf t Enter configuration commands, one per line. End with CNTL/Z. test(config)#no ip domain-lookup # 在全局配置模式下,将 ip 域名的搜寻功能关闭就可以了。 test(config)#end test#conf *Mar 1 01:40:46.895: %SYS-5-CONFIG_I: Configured from console by console test#conf x# 将上述功能关闭以后,再有输入错误的情况会直接提示你输入错误。 % Invalid input detected at marker. test# test(config)#ip domain-name 8 # 如果有必要将设备配置上 DNS 功能的话就用这条命令。 # 基本配置完毕后我们验证一下所有的配置# test#sh run Building configuration. Current configuration : 1693 bytes ! 精选文库 version 12.3 service timestamps debug datetime msec service timestamps log datetime msec service password-encryption# 密码加密显示功能打开 ! hostname test ! boot-start-marker boot-end-marker ! enable password 7 070C285F4D06# 密码被加密显示了 ! no aaa new-model ! resource policy ! memory-size iomem 5 ip subnet-zero ! ! ip cef no ip domain lookup# 关闭了域名查找功能 no ip dhcp use vrf connected ! ! no ip ips deny-action ips-interface ! no ftp-server write-enable ! no crypto isakmp ccm ! (略) ip http server no ip http secure-server ip classless ! control-plane ! line con 0 exec-timeout 0 0 password 7 094F471A1A0A# 用超级终端登陆的密码,也同样被加密显示 精选文库 logging synchronous line aux 0 line vty 0 4 password 7 00071A150754# 用 telnet 登陆的密码,也同样被加密显示 login ! ! end test# 3、cisco 设备端口配置详解设备端口配置详解 User Access Verification # 从 dos 提示符下运行 telnet ip 地址,就会连接到相应的交换机或者路由器 Password:# 输入配置号的 telnet 密码,也就是上节提到的 vtp 中的密码 testen # 进入特权模式 Password: # 输入特权模式密码,也就是上节提到的 enable 密码。注意这些密 码在输入的时候屏幕是不显示的。 test# test# test#sh ip int brief# 查看当前所有端口状态,包括 vlan 和实际的物理接口状态 Interface IP-Address OK? Method Status Protocol 协 议# 这行列示的各种状态的名称 FastEthernet1 unassigned 未分配 YES NVRAM down down Vlan1 54 YES NVRAM up up # vlan1 的状态是 active Vlan2 YES NVRAM up up Vlan10 54 YES NVRAM up up Vlan20 54 YES NVRAM up up Vlan30 54 YES NVRAM up up Vlan40 54 YES NVRAM up up Vlan50 54 YES NVRAM up up Vlan60 54 YES NVRAM up up Vlan70 54 YES NVRAM up up Vlan80 54 YES NVRAM up up Vlan100 54 YES NVRAM up up Vlan110 54 YES NVRAM up up Vlan120 54 YES NVRAM up up 精选文库 Vlan150 54 YES NVRAM up up Vlan160 54 YES NVRAM up up GigabitEthernet1/1 unassigned YES unset up up # 物理接口 gi1/1 也是 active 状态 GigabitEthernet1/2 unassigned YES unset down down GigabitEthernet1/3 unassigned YES unset down down GigabitEthernet1/4 unassigned YES unset down down GigabitEthernet1/5 unassigned YES unset down down GigabitEthernet1/6 unassigned YES unset down down GigabitEthernet1/7 unassigned YES unset down down GigabitEthernet1/8 unassigned YES unset down down GigabitEthernet1/9 unassigned YES unset down down # 说明:通过上述命令即可以查看当前设备所有状态的情况也可以查看端口的表示方式。 在此例中我们登陆的是一台 cisco4503 的三层交换机;其中 GigabitEthernet1/1,表示的是这 台交换机上的第 1 块业务板的第 1 个端口,并且此端口是个千兆端口;而 GigabitEthernet3/19 表示的是这台交换机上的第 3 块业务版的第 19 个端口,并且此端口也 是一个千兆端口,其他的端口以此类推。千兆端口的名称为:GigabitEthernet,百兆端口的 名称为:FastEthernet。 test# conf t # 进入到全局配置模式。要想对端口、vlan、路由等操作一定要到全局配置模式中来。 Enter configuration commands, one per line. End with CNTL/Z. test(config)#inter test(config)#interface gi1/2进入 Gi1/2 端口 # 通过此命令可进去端口配置模式,此处我们进入的是 GigabitEthernet1/2 口,gi1/2 为简写。 test(config-if)#? #回车后进入到端口配置模式,注意提示符的变化,输入?寻求在这个模式着那个的帮助。 Interface configuration commands: access-group Access group configuration arp Set arp type (arpa, probe, snap) or timeout auto Configure Automation backup Modify backup parameters bandwidth Set bandwidth informational parameter bgp-policy Apply policy propogated by bgp community string carrier-delay Specify delay for interface transitions cdp CDP interface subcommands channel-group Etherchannel/port bundling configuration channel-protocol Select the channel protocol (LACP, PAgP) dampening Enable event dampening default Set a command to its defaults 精选文库 delay Specify interface throughput delay description Interface specific description dot1x Interface Config Commands for 802.1x duplex Configure duplex operation. exit Exit from interface configuration mode flow-sampler Attach flow sampler to the interface flowcontrol Configure flow operation. help Description of the interactive help system ip Interface Internet Protocol config commands isis IS-IS commands iso-igrp ISO-IGRP interface subcommands keepalive Enable keepalive l2protocol-tunnel Tunnel Layer2 protocols lacp LACP interface subcommands load-interval Specify interval for load calculation for an interface logging Configure logging for interface loopback Configure internal loopback on an interface mac MAC interface commands macro Command macro max-reserved-bandwidth Maximum Reservable Bandwidth on an Interface mtu Set the interface Maximum Transmission Unit (MTU) no Negate a command or set its defaults pagp PAgP interface subcommands power Power configuration qos QoS configuration rmon Configure Remote Monitoring on an interface service-policy Configure QoS Service Policy shutdown Shutdown the selected interface snmp Modify SNMP interface parameters spanning-tree Spanning Tree Subsystem speed Configure speed operation. storm-control storm configuration switchport Set switching mode characteristics timeout Define timeout values for this interface transmit-interface Assign a transmit interface to a receive-only interface tx-queue Configure interface transmit queue udld Configure UDLD enabled or disabled and ignore global UDLD setting vlan-range config vlan test(config-if)#spe test(config-if)#speed ? # 我们可指定这个端口的速度,比如这个端口接的是一个百兆的收发器,我们就可以强制 将此端口设置成 100M 精选文库 10 Force 10 Mbps operation# 强制此端口为 10M 100 Force 100 Mbps operation# 强制此端口为 100M 1000 Force 1000 Mbps operation# 强制此端口为 1000M auto Enable AUTO speed configuration# 允许速度自动协商 test(config-if)#speed 100 # 通过此命令就可将此端口强制设成 100M,默认的状态下是 auto。 test(config-if)#dup test(config-if)#duplex ? # 用此命令可配置此端口的双工模式,有 3 个选项供选择。 auto Enable AUTO duplex configuration# 自动配置此端口的双工模式 full Force full duplex operation# 强制此端口为全双工模式 half Force half-duplex operation# 强制此端口为半双工模式 test(config-if)#duplex auto test(config-if)#end# 用 end 命令可直接退回到特权模式,用 exit 是一层一层的退出。 test#ter test#terminal moni test#terminal monitor # 打开终端监控。当用 telnet 登陆的时候默认是不显示各端口的实时变化情况的,打开这 个功能就能实时的看到这台交换机上哪个端口 up,哪个端口 down,这对于排错的时候是 很有帮助的。 test#conf t Enter configuration commands, one per line. End with CNTL/Z. test(config)#int gi1/2# 重新回到端口配置模式 test(config-if)#shut# 此命令可手工关闭此端口 test(config-if)#no shut# 此命令为打开此端口 test(config-if)#switchport access vlan ? # 这条命令可配置此端口属于哪个 vlan,当然此 vlan 要事先建好。 VLAN ID of the VLAN when this port is in access mode dynamic When in access mode, this interfaces VLAN is controlled by VMPS test(config-if)#switchport access vlan 100 # 我们配置此端口属于 vlan100,如果此端口事先属于其他 vlan 那么,会从其他 vlan 退出 test(config-if)#exit test(config)#int rang# 亦可成批的配置端口,利用这个命令 test(config)#int range gi 1/1 - 5 # 表示同时对 gi1/1 到 gi1/5 这 5 个端口进行操作,注意命令“1 - 5” ,之间有空格。 test(config-if-range)#switchport access vlan 100# 可同时配置这 5 个端口属于 vlan100 test(config-if-range)#shutdown# 可同时关闭这 5 个端口 test(config-if-range)#no shutdown# 可同时启用这 5 个端口 test(config-if-range)#exit test(config-if)#end 精选文库 test# test#sh int gi1/2# 在特权模式中,可查看单个端口的状 态 GigabitEthernet1/2 is down, line protocol is down (notconnect) # 这行说明此端口当前的状态是 down 的 Hardware is Gigabit Ethernet Port, address is 001a.6db4.a3c1 (bia 001a.6db4.a3c1) # 此端口的 MAC 地址 MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive set (10 sec) Auto-duplex, Auto-speed, link type is auto, media type is 10/100/1000-TX # 此端口的模式为 10/100/1000-TX input flow-control is off, output flow-control is off ARP type: ARPA, ARP Timeout 04:00:00 Last input never, output never, output hang never Last clearing of show interface counters never Input queue: 0/2000/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifo Output queue: 0/40 (size/max) 5 minute input rate 0 bits/sec, 0 packets/sec 5 minute output rate 0 bits/sec, 0 packets/sec 0 packets input, 0 bytes, 0 no buffer Received 0 broadcasts (0 multicast) 0 runts, 0 giants, 0 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored 0 input packets with dribble condition detected 0 packets output, 0 bytes, 0 underruns 0 output errors, 0 collisions, 0 interface resets 0 babbles, 0 late collision, 0 deferred 0 lost carrier, 0 no carrier 0 output buffer failures, 0 output buffers swapped out test#sh int gi1/1 GigabitEthernet1/1 is up, line protocol is up (connected) # 这行表明此端口是 up 的,并且连有网线。 Hardware is Gigabit Ethernet Port, address is 001a.6db4.a3c0 (bia 001a.6db4.a3c0) MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive set (10 sec) Full-duplex, 1000Mb/s, link type is auto, media type is 10/100/1000-TX input flow-control is off, output flow-control is off ARP type: ARPA, ARP Timeout 04:00:00 Last input never, output never, output hang never 精选文库 Last clearing of show interface counters never Input queue: 0/2000/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifo Output queue: 0/40 (size/max) 5 minute input rate 1293000 bits/sec, 426 packets/sec 5 minute output rate 2410000 bits/sec, 528 packets/sec 273591244 packets input, 142285545179 bytes, 0 no buffer Received 0 broadcasts (0 multicast) 0 runts, 0 giants, 0 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored # 没有输入错误,表明链路状态良 好 0 input packets with dribble condition detected 335026620 packets output, 223732323465 bytes, 0 underruns# 输出数据包统计 0 output errors, 0 collisions, 0 interface resets 0 babbles, 0 late collision, 0 deferred 0 lost carrier, 0 no carrier 0 output buffer failures, 0 output buffers swapped out test# test# test# test#wr# 保存刚才的配置结果 4、vlan 的规划及配置的规划及配置 在本节中我们讲解 vlan 的规划及具体的配置命令。在此例中我们用的是 vtp(VLAN Trunking Protocol)server 的模式,在这种模式中我们需要配置核心交换机的 vtp 模式为 server,各接入交换机的 vtp 模式为 cilent,那么配置完成后接入交换机就会通过 trunk 口自 动从核心交换机学习到所有的 vlan 配置信息。在接入交换机中只需要添加相应的端口即可, 这样易于管理与部署。具体的配置命令我们通过两小节来演示: 4.1 核心交换机的相关配置核心交换机的相关配置 (这是一台已经配置好了的交换机,但这并不会影响我们的演示效果。所有我们新作的配 置会在演示结束后清除。 ) TEST#sh vlan# 显示已经有的 vlan 信息,并且同时显示了各端口所属的 vlan VLAN Name Status Ports - - - - 1 default active Gi1/2, Gi
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 环保公司电商客服管理细则
- 中考数学总复习《概率初步》通关题库及参考答案详解(综合卷)
- 智慧校园安全与校园安全风险评估报告
- 环保公司物流管理办法
- 2025年工业互联网平台数字签名技术规范标准解析与应用案例报告
- 情感识别系统构建-洞察及研究
- 自考专业(国贸)自我提分评估带答案详解(达标题)
- 中级银行从业资格之中级银行业法律法规与综合能力能力检测含答案详解【黄金题型】
- 电竞公司税务档案管理细则
- 环保公司企业形象塑造细则
- 2025年9月新版用工合同(合作协议书)范本(可规避风险)
- 人民调解员培训课件
- 血液透析学习汇报
- 2025重庆机场集团有限公司社会招聘202人考前自测高频考点模拟试题及完整答案详解1套
- 安徽省江南十校2025年物理高一下期末检测模拟试题含解析
- 培训钉钉课件
- 新建洞室储气库压缩空气储能系统的经济性及成本分析
- 砖厂职业危害管理制度
- 肝功能障碍患者的麻醉管理要点
- 2025年粮油仓储管理员(高级)职业技能鉴定考试练习题库(含答案)
- 【课件】新高三启动主题班会:启航高三逐梦未来
评论
0/150
提交评论