思科交换机简单配置(通用教程)_第1页
思科交换机简单配置(通用教程)_第2页
思科交换机简单配置(通用教程)_第3页
思科交换机简单配置(通用教程)_第4页
思科交换机简单配置(通用教程)_第5页
已阅读5页,还剩26页未读 继续免费阅读

下载本文档

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

文档简介

1、思科交换机基本配置 研发七部 思科交换机基本介绍思科交换机基本介绍 交换机型号交换机型号Catalyst 2960 系列交换机Catalyst 3560 系列交换机Catalyst 3750 系列交换机Catalyst 4500 系列交换机Catalyst 4948 系列交换机Catalyst 6500 系列交换机3560系列交换机三层交换机三层交换机支持支持PoE(Power over Ethernet)设备)设备支持支持IPv6汇聚层交换机汇聚层交换机中型企业中型企业Catalyst-3560G-24TS 技术参数转发带宽:32Gbps每秒分组数:38.7Mpps支持的mac地址:1200

2、0支持的路由:11000千兆以太网SFP:410/100/1000端口:24不支持PoE思科交换机测试中常用配置交换机配置模式用户模式 Switch特权模式 Switchenable Switch#全局模式 Switch#configure terminal Switch(config)# 每次进入交换机时,首先会进入到用户模式下每次进入交换机时,首先会进入到用户模式下 ,在此模式下不能对交换,在此模式下不能对交换机进行修改、甚至有些信息都无法查看,为了更进一步的对交换机进行操作,机进行修改、甚至有些信息都无法查看,为了更进一步的对交换机进行操作,我们必须进入到特权模式或全局模式,而从用户模式

3、下只能进入特权模式,我们必须进入到特权模式或全局模式,而从用户模式下只能进入特权模式,再从特权模式进入全局模式,也就是说之中不能跨级。再从特权模式进入全局模式,也就是说之中不能跨级。 更改主机名更改主机名SwitchenSwitch#conf tSwitch(config)#hostname 12341234(config)#更改特权密码更改特权密码1234(config)#enable password 1231234(config)#1234(config)#enable secret 2341234(config)#查看全局配置Switch#show running-config保存当前

4、配置Switch#copy running-config startup-config恢复出厂默认Switch#erase startup-configSwitch#reload明文密码和密文密码Password1234#show running-config hostname 1234 enable password 123Secret 1234#show running-confighostname 1234enable secret 5 $1$CCFV$0DTd3rSPZNycrVDjn1rKv/ (MD5 加密的字符串) enable password 123当明文和密文同时存在时,密

5、文优先级高。当明文和密文同时存在时,密文优先级高。端口配置全局模式下进入端口后,可以对端口进行配置。Switch#conf tSwitch(config)#interface gigabitEthernet 0/1Switch(config-if)#批量修改端口 range命令端口速率:Switch(config-if)#speed ? 10 Force 10 Mbps operation 100 Force 100 Mbps operation 1000 Force 1000 Mbps operation auto Enable AUTO speed configurationSwitch(

6、config-if)#speed autoSwitch(config-if)#双工模式:Switch(config-if)#duplex ? auto Enable AUTO duplex configuration full Force full duplex operation half Force half-duplex operationSwitch(config-if)#duplex auto Switch(config-if)#端口描述Switch(config-if)#description vlan 10 trunkSwitch(config-if)#Vlan设置Vlan设置范

7、围:1-4094在全局模式下配置vlanSwitch#conf tSwitch(config)#vlan 10Switch(config-vlan)#name vlan10Switch(config-vlan)#vlan 20Switch(config-vlan)#name vlan20Vlan名称可以自行定义Switch#show vlan 查看vlan配置信息vlan10配置192.168.10.1/24的ip地址Switch#conf tSwitch(config)#vlan 10Switch(config-vlan)#name vlan10Switch(config-vlan)#exi

8、tSwitch(config)#interface vlan 10Switch(config-if)#ip address 192.168.10.1 255.255.255.0Switch(config-if)#endSwitch#copy running-config startup-config配置ip地址的命令格式: ip address ip-address netmask测试常用端口类型 Access / trunk将此端口设置为vlan10 的access口Switch(config-if)#switchport mode access Switch(config-if)#swit

9、chport access vlan 10Switch(config-if)#将此端口设置为vlan10 的trunk口Switch(config-if)#switchport trunk encapsulation dot1qSwitch(config-if)#switchport mode trunk Switch(config-if)#switchport trunk allowed vlan 10当一个端口允许多个vlan通过时,trunk allowed vlan中要添加各条vlan信息Switch(config-if)#switchport trunk encapsulation

10、dot1qSwitch(config-if)#switchport mode trunk Switch(config-if)# switchport trunk allowed vlan all Switch(config-if)#switchport trunk allowed vlan 10,50,60Switch(config-if)#switchport trunk allowed vlan add 20 (remove 删除)Switch(config-if)#switchport trunk allowed vlan add 30Switch(config-if)#switchpo

11、rt trunk allowed vlan add 40Switch(config-if)#switchport trunk native vlan 1Switch(config-if)#no shutdownSwitch(config-if)#endSwitch#copy running-config startup-config 此端口为vlan10 vlan20 vlan30 vlan40的trunk口,default vlan 1经过此端口时不会带上标签。光端口配置Switch(config)#interface gigabitEthernet 0/25Switch(config-if

12、)# switchport mode accessSwitch(config-if)#switchport access vlan 10Switch(config-if)#no shutdown Switch(config-if)#endSwitch#copy running-config startup-config注意: 由于思科的交换机只自动识别自己品牌的光模块,所以如果用其他品牌的光模块,需在配置模式下输入一下两条命令,开启兼容性。service unsupported-transceiverno errdisable detect cause gbic-invalid命令输入完成后保

13、存设置重启设备 端口镜像配置Cisco 3560G配置全局配置下:Switch(config)#monitor session 1 destination interface gigabitEthernet 0/1Switch(config)#monitor session 1 source interface gigabitEthernet 0/2 both Switch(config)#monitor session 1 source interface gigabitEthernet 0/3 both monitor session 1 建立一个端口镜像组Destination 监控端口

14、Source 镜像端口DHCP配置配置一个dhcp给vlan10内的主机分配地址Switch(config)#service dhcpSwitch(config)#ip dhcp pool vlan10 Switch(dhcp-config)#network 192.168.10.0 255.255.255.0Switch(dhcp-config)#default-router 192.168.10.1Switch(dhcp-config)#dns-server 192.168.10.2Switch(dhcp-config)#lease 3 20 20 (天/小时/分钟) (缺省为1天)Swi

15、tch(dhcp-config)#exitSwitch(config)#ip dhcp excluded-address 192.168.10.1 192.168.10.19Switch(config)#ip dhcp excluded-address 排除某些地址,禁止被动态分配DHCP设置是针对全局的,不是定义在某个接口上的。DHCP调试命令Switch(config)#no service dhcp 关闭dhcp服务Switch#show ip dhcp binding 查看dhcp分配情况思科作思科作DHCP server给给AP分地址分地址在server中设置Option43、Opt

16、ion60字段信息。Switch(config)#ip dhcp pool vlan20Switch(dhcp-config)#network 192.168.1.0 255.255.255.0Switch(dhcp-config)#default-router 192.168.1.1Switch(dhcp-config)#option 43 hex 0106 0104 c0a8 01e4Switch(dhcp-config)#option 60 hex xxxx xxxx xxxx (AC回的offer包中的信息)Switch(dhcp-config)# lease 1Switch(dhcp

17、-config)#endSwitch#copy running-config startup-configDHCP relay配置DHCP relay功能可以汇聚处于不同广播域的客户端的DHCP请求,转发给DHCP服务器,并发送DHCP服务器的响应给各个客户端,也就是起到了DHCP报文在各个网段的转发功能。Cisco的设备需要启用ip helper-address命令,来实现此功能。配置了ip helper-address命令之后的交换机在中继DHCP请求时的工作过程如下:(1)DHCP客户端发送请求,由于没有IP地址,所以自己的源IP地址为0.0.0.0,而且也不知道目的DHCP服务器的地址

18、,所以广播255.255.255.255。该数据报文中还包括源mac地址和目的mac地址(全F)。(2)当交换机接收到该数据包的时候,它就用自己的接口地址来取代源地址0.0.0.0,并且用ip helper-address命令置顶的地址来取代目的地址255.255.255.255。(3)当DHCP服务器接收到交换机转发过来的DHCP请求包时,它会做出响应,并且由交换机把数据包转发回客户端。 DHCP relay 配置Switch(config)#vlan 100Switch(config-vlan)#name vlan100Switch(config-vlan)#int vlan 100Swi

19、tch(config-if)#ip helper-address 192.168.1.228Switch(config-if)#exitSwitch(config)#service dhcp Switch(config)#ip dhcp relay information trust-all Switch(config)#endSwitch#copy running-config startup-configDHCP relay功能测试实例:AC lan端口开启dhcp serverdhcp server1:192.168.20.10-192.168.20.100/24的地址,网关为192.1

20、68.20.1。dhcp server2:192.168.30.10-192.168.30.100/24的地址,网关为192.168.30.1。AC lan端口地址为192.168.1.228正确配置交换机和AC使AP获得相应地址并上线。AC lan3560GAP1AP2Vlan30Vlan20Vlan10Cisco 3560G配置interface GigabitEthernet0/1 interface Vlan10switchport access vlan 10 ip address 192.168.1.1 255.255.255.0switchport mode access!int

21、erface GigabitEthernet0/2 interface Vlan20 switchport access vlan 20 ip address 192.168.20.1 255.255.255.0 switchport mode access ip helper-address 192.168.1.228!interface GigabitEthernet0/3 interface Vlan30 switchport access vlan 30 ip address 192.168.30.1 255.255.255.0 switchport mode access ip he

22、lper-address 192.168.1.228ip routing service dhcp ip dhcp relay information trust-all AC配置瘦AP端口地址:192.168.1.228 255.255.255.0瘦AP端口DHCP: dhcp server1:192.168.20.10-192.168.20.100/24的地址,网关为192.168.20.1。dhcp server2:192.168.30.10-192.168.30.100/24的地址,网关为192.168.30.1。静态路由:目的地址 0.0.0.0 子网掩码 0.0.0.0 下一跳 1

23、92.168.1.1静态路由设置Switch(config)#ip routing (全局路由)思科默认不开启Switch(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.1 (静态路由格式: 目的地址 子网掩码 下一跳)静态路由测试实例 3560GPC ACStaAPVlan2Vlan1Vlan3Vlan2AP通过dhcp方式上线,集中转发正常广播SSIDAC开启2个虚接口,STA连接vif1,Vif1属于vlan1 地址192.168.10.1/24 ,vif2属于vlan2 地址192.168.20.1/243560G 1端口与A

24、C的vif2相连,地址为192.168.20.2/243560G 2端口与PC相连,地址为192.168.30.1/24PC的地址为192.168.30.1/24 网关为192.168.30.1测试要求:STA正常获得地址并且与PC通信。Cisco 3560G配置interface Vlan20ip address 192.168.20.2 255.255.255.0 interface Vlan30ip address 192.168.30.1 255.255.255.0ip route 192.168.10.0 255.255.255.0 192.168.20.1ip routingint

25、erface GigabitEthernet0/1 switchport access vlan 20 switchport mode accessinterface GigabitEthernet0/2 switchport access vlan 30 switchport mode accessAC开启2个虚接口vif1、vif2,vif1开启dhcp server功能,给STA分配地址,同时将vif1的地址设置为网关。同时配置静态路由目的地址 192.168.30.0子网掩码 255.255.255.0下一跳: 192.168.20.2测试实例三层漫游 在三层交换机上划分三个VLAN,VLAN10 VLAN20 VLAN30,其管理地址分别为192.168.1

温馨提示

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

评论

0/150

提交评论