设为首页 收藏本站
查看: 596|回复: 0

[经验分享] cisco交换机 配置一组端口,interface range-fljcn

[复制链接]

尚未签到

发表于 2018-7-12 06:49:23 | 显示全部楼层 |阅读模式
  重点:
  1、连续端口。端口号之间需要加入空格,如:interface range fastethernet 0/1 – 5 ;
  2、不连续端口。interface range fastethernet0/1 - 3, gigabitethernet0/1 - 2
  配置一组端口
  命令  目的
  Step 1   configure terminal                    进入配置状态
  Step 2   interface range {port-range}  进入组配置状态
  Step 3                                                   可以使用平时的端口配置命令进行配置
  Step 4  end                                           退回
  Step 5   show interfaces [interface-id] 验证配置
  Step 6   copy running-config startup-config 保存
  当使用interface range命令时有如下的规则:
  有效的组范围:
  vlan从1 到4094
  fastethernet 槽位/{first port} - {last port}, 槽位为0
  gigabitethernet槽位/{first port} - {last port},槽位为0
  port-channel port-channel-number - port-channel-number, port-channel号从1到64
  端口号之间需要加入空格,如:interface range fastethernet 0/1 – 5 是有效的,而interface range fastethernet 0/1-5 是无效的.
  interface range 命令只能配置已经存在的interface vlan
  所有在同一组的端口必须是相同类别的。
  见以下例子:
  Switch# configure terminal
  Switch(config)# interface range fastethernet0/1 - 5
  Switch(config-if-range)# no shutdown
  Switch(config-if-range)#
  *Oct  6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
  *Oct  6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/2, changed state to up
  *Oct  6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to up
  *Oct  6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/4, changed state to up
  *Oct  6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/5, changed state to up
  *Oct  6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/05,
  changed state to up
  *Oct  6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed
  state to up
  *Oct  6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed
  state to up
  以下的例子显示使用句号来配置不同类型端口的组:
  Switch# configure terminal
  Switch(config)# interface range fastethernet0/1 - 3, gigabitethernet0/1 - 2
  Switch(config-if-range)# no shutdown
  Switch(config-if-range)#
  *Oct  6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
  *Oct  6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet0/2, changed state to up
  *Oct  6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to up
  *Oct  6 08:29:28: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to up
  *Oct  6 08:29:28: %LINK-3-UPDOWN: Interface GigabitEthernet0/2, changed state to up
  *Oct  6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/ 1,
  changed state to up
  *Oct  6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/ 2,
  changed state to up
  *Oct  6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/ 3,
  changed state to up
  1.        设置VTP DAMAIN (核心、分支交换机上设置)
  2.        配置中继(核心、分支交换机上设置;
  3.        创建VLAN (在 SERVER 上设置);
  4.        建交换机端口划入()VLAN ;
  5.        配置三层交换;
  6.        设置VTP DAMAIN,VTP DAMAIN 称为管理域。
  交换VTP 更新信息的所以交换机必须配置为相同的管理域。如果所以的交换机都以中继线相连,那么只要在核心交换机上设置一个管理域,网络上所以的交换机都加入该域,这样管理域里所以的交换机都能够了解彼此的VLAN列表。
  核心交换机型号为 4506 三层交换机
  接入层为 2950G 二层交换机;  
  1) 配置VTP damain
  在核心交换机上的配置过程如下;先用 configure terminal 命令进入
  !进入VLAN 的配置模式;
  Core# vlan database
  ! 设置VTP管理域名称 test ;
  Core # vtp domain test
  ! 设置交换机为服务器(server )模式;
  Core # vtp server
  在楼层交换机上的配置过程如下:
  !进入VLAN 模式;
  F11# vlan database
  ! 设置VTP 管理域名称 test
  F11# vtp domain test
  ! 设置交换机客户端(client)模式;
  F11# vtp client
  ! 进入VLAN 配置模式
  F12# vlan database
  ! 设置VTP 管理域名称 test
  F12# vtp domain test
  ! 设置交换机客户端(client)模式;
  F12# vtp client
  !进入VLAN 模式;
  F13# vlan database
  ! 设置VTP 管理域名称 test
  F13# vtp domain test
  ! 设置交换机客户端(client)模式;
  F13# vtp client
  2)配置中继
  在核心交换机上配置如下:
  ! 进入下联端口 (g2/1)
  Core(config)#interface gigabitethernet 2/1
  ! 配置端口描述(连接F11 的 g0/1)
  Core(config)#description link to fll go/1
  ! 指定本端口为二层(交换)端口
  Core(config-if)# switchport
  ! 配置中继协议为dot1q
  Core(config-if)# switchport trunk encapsulation dot1q
  ! 指定端口的模式为中继 (trunk)端口;
  Core(config-if)# switchport mode trunk
  ! 进入下联端口(g2/2)
  Core(config)#interface gigabitethernet 2/2
  ! 配置端口描述(连接F12 的 g0/1)
  Core(config-if)#description link to fl2 g0/1
  ! 指定本端口为二层(交换)端口
  Core(config-if)# switchport
  ! 配置中继协议为dot1q
  Core(config-if)# switchport trunk encapsulation dot1q
  ! 指定端口的模式为中继 (trunk)端口;
  Core(config-if)# switchport mode trunk
  ! 进入下联端口(g2/3)
  Core(config)#interface gigabitethernet 2/3
  ! 配置端口描述(连接F13 的 g0/1)
  Core(config-if)#description link to fl3 g0/1
  ! 指定本端口为二层(交换)端口
  Core(config-if)# switchport
  ! 配置中继协议为dot1q
  Core(config-if)# switchport trunk encapsulation dot1q
  ! 指定端口的模式为中继 (trunk)端口;
  Core(config-if)# switchport mode trunk
  在楼层交换机上配置如下:
  !进入上联端口(g0/1)
  F11(config)# interface gigabitetEthernet 0/1
  ! 配置中继协议 dot1q
  F11(config-if)#switchport trunk encapsulation dot1q
  ! 指定端口的模式为中继(trunk) 端口;
  F11(conifg-if)#switchport mode trunk
  !进入上联端口(g0/1)
  F12(config)# interface gigabitetEthernet 0/1
  ! 配置中继协议 dot1q
  F12(config-if)#switchport trunk encapsulation dot1q
  ! 指定端口的模式为中继(trunk) 端口;
  F12(conifg-if)#switchport mode trunk
  !进入上联端口(g0/1)
  F13(config)# interface gigabitetEthernet 0/1
  ! 配置中继协议 dot1q
  F13(config-if)#switchport trunk encapsulation dot1q
  ! 指定端口的模式为中继(trunk) 端口;
  F13(conifg-if)#switchport mode trunk
  此时,管理域就设置完毕了。
  3) 创建 VLAN ,一但创建了VLAN了;
  !进入VLAN模式
  Core# vlan database
  ! 创建一个编号为10名字为engineering 的VLAN
  Core# vlan 10 name engineering
  ! 创建一个编号为20名字为techniqy 的VLAN
  Core# vlan 20 name techniqy
  !创建一个编号为30名字为marketing 的VLAN
  Core# vlan 30 name marketing
  另外,还有一种简单的创建VLAN方式,如下所示:
  Core# conf t
  Core#(config)vlan 10,20,30
  注意,这里的VLAN是在核心交换机上建立的。其实,只要是在管理域中的任何一台VTP属性为SERVER 的交换机上建立VLAN,它就会通过VTP通告整个管理域中的所以的交换机。但如果要将具体的交换机端口划入某个VLAN,就必须在该端口所属的交换机上进行设置。
  3)将交换机端口划入VLAN
  例如,要将F11,F12,F13接入交换机的端口Fa0/1划入engineering VLAN,端口Fa0/2划入techniqy VLAN ,端口Fa0/3 划入marketing VLAN.
  ! 划入端口Fa0/1
  F11(config)#interface fasterthernet 0/1
  ! 设置端口模式(access)
  F11(config-if)#switchport mode access
  ! 配置本端口属于 VLAN10
  F11(config-if)switchport access vlan 10
  ! 划入端口Fa0/2
  F11(config)#interface fasterthernet 0/2
  ! 设置端口模式(access)
  F11(config-if)#switchport mode access
  ! 配置本端口属于 VLAN 20
  F11(config-if)switchport access vlan 20
  ! 划入端口Fa0/3
  F11(config)#interface fasterthernet 0/3
  ! 设置端口模式(access)
  F11(config-if)#switchport mode access
  ! 配置本端口属于 VLAN 30
  F11(config-if)switchport access vlan 30
  ! 划入端口Fa0/1
  F12(config)#interface fasterthernet 0/1
  ! 设置端口模式(access)
  F12(config-if)#switchport mode access
  ! 配置本端口属于 VLAN10
  F12(config-if)switchport access vlan 10
  ! 划入端口Fa0/2
  F12(config)#interface fasterthernet 0/2
  ! 设置端口模式(access)
  F12(config-if)#switchport mode access
  ! 配置本端口属于 VLAN20
  F12(config-if)switchport access vlan 20
  ! 划入端口Fa0/3
  F12(config)#interface fasterthernet 0/3
  ! 设置端口模式(access)
  F12(config-if)#switchport mode access
  ! 配置本端口属于 VLAN30
  F12(config-if)switchport access vlan 30
  ! 划入端口Fa0/1
  F13(config)#interface fasterthernet 0/1
  ! 设置端口模式(access)
  F13(config-if)#switchport mode access
  ! 配置本端口属于 VLAN10
  F13(config-if)switchport access vlan 10
  ! 划入端口Fa0/2
  F13(config)#interface fasterthernet 0/2
  ! 设置端口模式(access)
  F13(config-if)#switchport mode access
  ! 配置本端口属于 VLAN20
  F13(config-if)switchport access vlan 20
  ! 划入端口Fa0/3
  F13(config)#interface fasterthernet 0/3
  ! 设置端口模式(access)
  F13(config-if)#switchport mode access
  ! 配置本端口属于 VLAN30
  F13(config-if)switchport access vlan 30
  !分别对交换机结束
  End
  ! 分别对交换机,进行保持配置:
  copy running-config startup-config 
  4) 配置三层交换
  到这里,VLAN已经基本划分完毕。但是,VLAN间如何实现三层(网络层)交换呢?这是就要给各VLAN分配网络(IP)地址了,给VLAN分配IP地址分两种情况:其一:给VLAN所以的节点分配一个静态IP地址;其二,给VLAN 所以节点分配动态IP地址;
  在核心交换机上面
  !进入VLAN 10 接口
  Core(config)#interface vlan 10
  ! 为VLAN 10 接口配置IP
  Core(config-if)#ip address 172.16.1.254 255.255.255.0
  !进入VLAN 20 接口
  Core(config)#interface vlan 20
  ! 为VLAN 20 接口配置IP
  Core(config-if)#ip address 172.16.2.254 255.255.255.0
  !进入VLAN 30 接口
  Core(config)#interface vlan 30
  ! 为VLAN 30 接口配置IP
  Core(config-if)#ip address 172.16.3.254 255.255.255.0
  !结束
  End
  ! 保持配置:
  copy running-config startup-config
  引用 http://www.qdgx.qdedu.net/byxz/blogview.asp?logID=136

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-536280-1-1.html 上篇帖子: 配置Cisco MDS光纤存储交换机配置zone 下篇帖子: cisco思科交换机 在VLAN中一次添加多个端口的命令
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表