Cisco 的基本配置实例之四----vlan的规划及配置(核心交换机)
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 ---- -------------------------------- --------- ------------------------------- default active Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi3/, Gi3/, Gi3/ firewall active Gi1/ Engineering active Gi3/, Gi3/ Procurement active Gi3/ QAQC active Operation active Yard active Gi3/ BM active HRAD active Facility active Finance active GO active Wlan active Server active Gi3/, Gi3/, Gi3/, Gi3/, Gi3/, Gi3/, Gi3/, Gi3/ Client active Gi3/, Gi3/
# 从这行往下是为其他协议预留的vlan号段,这些不必理会。
fddi-default act/unsup token-ring-default act/unsup fddinet-default act/unsup trnet-default act/unsup VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - fddi - - - - - tr - - - - - fdnet - - - ieee -
TEST#conf
TEST(config)#vlan 200 # 我们新建一个vlan号为200的vlan
TEST(config-vlan)#name test # 给这个vlan命名,这样便于日常的管理。
TEST(config-vlan)#END # 建好vlan后退出到特权模式中
TEST#show ip int brief
# 显示目前有的端口配置状态,我们会发现此时并没有vlan200的相关信息
Interface IP-Address OK? Method Status Protocol FastEthernet1 unassigned YES NVRAM down down Vlan1 192.168.113.254 YES NVRAM up up Vlan2 172.16.0.2 YES NVRAM up up Vlan10 192.168.101.254 YES NVRAM up up Vlan20 192.168.102.254 YES NVRAM up up Vlan30 192.168.103.254 YES NVRAM up up Vlan40 192.168.104.254 YES NVRAM up up Vlan50 192.168.105.254 YES NVRAM up up Vlan60 192.168.106.254 YES NVRAM up up Vlan70 192.168.107.254 YES NVRAM up up Vlan80 192.168.108.254 YES NVRAM up up Vlan100 192.168.110.254 YES NVRAM up up Vlan110 192.168.111.254 YES NVRAM up up Vlan120 192.168.112.254 YES NVRAM up up Vlan150 192.168.100.254 YES NVRAM up up Vlan160 192.168.115.254 YES NVRAM up up GigabitEthernet1/ unassigned YES unset up up GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset up up GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset down down
TEST#sh vlan # 显示一下vlan信息
# 这个是我们新建好的vlan,但是vlan中没有任何端口。
fddi-default act/unsup token-ring-default act/unsup fddinet-default act/unsup trnet-default act/unsup VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - fddi - - - - -
TEST#conf t
TEST(config)#interface gigabitEthernet 1/2 # 进入端口配置模式,配置gigabitEthernet 1/2这个端口
TEST(config-if)#switchport access vlan 200 # 将此端口加入到刚才建好的vlan200中
TEST(config-if)#end
TEST#sh vlan # 退出来验证一下
TEST#sh ip int brief # 再显示一下所有端口的状态,我们会发现同样没有vlan200的相关信息。
Interface IP-Address OK? Method Status Protocol FastEthernet1 unassigned YES NVRAM down down Vlan1 192.168.113.254 YES NVRAM up up Vlan2 172.16.0.2 YES NVRAM up up Vlan10 192.168.101.254 YES NVRAM up up Vlan20 192.168.102.254 YES NVRAM up up Vlan30 192.168.103.254 YES NVRAM up up Vlan40 192.168.104.254 YES NVRAM up up Vlan50 192.168.105.254 YES NVRAM up up Vlan60 192.168.106.254 YES NVRAM up up Vlan70 192.168.107.254 YES NVRAM up up Vlan80 192.168.108.254 YES NVRAM up up Vlan100 192.168.110.254 YES NVRAM up up Vlan110 192.168.111.254 YES NVRAM up up Vlan120 192.168.112.254 YES NVRAM up up Vlan150 192.168.100.254 YES NVRAM up up Vlan160 192.168.115.254 YES NVRAM up up GigabitEthernet1/ unassigned YES unset up up GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset up up GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset down down
TEST#conf t
TEST(config)#int vlan 200 # 给这个vlan添加相应的ip地址,注意此处的语法
TEST(config-if)#ip add 10.10.10.0.1 255.255.255.0 # 配置vlan 200 的ip地址
TEST(config-if)#no shut # 使能此端口
TEST(config-if)#end
TEST#sh ip int b
# 重新显示一下所有端口的状态,我们会发现已经有了vlan200的端口信息了。
Interface IP-Address OK? Method Status Protocol FastEthernet1 unassigned YES NVRAM down down Vlan1 192.168.113.254 YES NVRAM up up Vlan2 172.16.0.2 YES NVRAM up up Vlan10 192.168.101.254 YES NVRAM up up Vlan20 192.168.102.254 YES NVRAM up up Vlan30 192.168.103.254 YES NVRAM up up Vlan40 192.168.104.254 YES NVRAM up up Vlan50 192.168.105.254 YES NVRAM up up Vlan60 192.168.106.254 YES NVRAM up up Vlan70 192.168.107.254 YES NVRAM up up Vlan80 192.168.108.254 YES NVRAM up up Vlan100 192.168.110.254 YES NVRAM up up Vlan110 192.168.111.254 YES NVRAM up up Vlan120 192.168.112.254 YES NVRAM up up Vlan150 192.168.100.254 YES NVRAM up up Vlan160 192.168.115.254 YES NVRAM up up Vlan200 10.10.0.1 YES manual up up GigabitEthernet1/ unassigned YES unset up up GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset up up GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet1/ unassigned YES unset down down GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up GigabitEthernet3/ unassigned YES unset up up
## 小结一下:在刚才的配置过程中,端口Gi1/2下面所连接的电脑的网关就是vlan200的地址——10.10.0.1。下面所连的电脑找到相应的网关后在会去找具体的路由,这些我们下节会讲解。
TEST#show inter trunk
# 显示当前交换机中的trunk接口。作为trunk接口的端口下联的是接入层(或者是汇聚层)的交换机。
TEST#conf t
TEST(config)#int gi1/15 # 我们以gi1/15来说明,如何将此端口配置成trunk接口
TEST(config-if)#switchport mode trunk # 首先定义此接口的模式为trunk
TEST(config-if)#switchport trunk encapsulation ?
# 然后定义trunk口的封装类型,此处选择dot1q也叫802.1q,为通用封装类型
dot1q Interface uses only 802.1q trunking encapsulation when trunking
isl Interface uses only ISL trunking encapsulation when trunking
negotiate Device will negotiate trunking encapsulation with peer on interface
TEST(config-if)#switchport trunk encapsulation dot1q # 回车后就将此trunk口的封装类型定义成了dot1q
## 小结一下:刚才配置的是如何将下联接入层交换机的端口配置成trunk模式,并且如何将此trunk口封装成特定的类型,接下来我们介绍如何配置此核心交换机的VTP的一些相关设置。
TEST(config)#vtp mode server # 首先我们在全局配置模式中将vtp的mode设置成server
TEST(config)#vtp domain pjoe # 然后配置vtp的domain,所有的交换机应该在一个domain中,此例中我们定义的doamin为pjoe
TEST(config)#vtp password pjoeserver # 配置此vtp的介入密码,这样可以防止未授权的交换机随便加入到这个domian中来。
TEST#sh vtp status # 配置完毕后显示一下vtp的状态
VTP Version : 2
Configuration Revision : 22
Maximum VLANs supported locally : 1005
Number of existing VLANs : 20
VTP Operating Mode : Server # vtp的模式为server模式
VTP Domain Name : pjoe # vtp的域名是pjoe
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Enabled
MD5 digest : 0x00 0xB3 0x21 0xB7 0x56 0xD7 0x06 0x4F
# 此处表示的是vtp的密码(已加密)
Configuration last modified by 192.168.113.254 at 12-3-07 22:52:46
Local updater ID is 192.168.113.254 on interface Vl1 (lowest numbered VLAN interface found)
TEST# ## 小结一下:经过以上的配置就将核心交换机的vtp等的配置工作完成了,只需要再配置好接入交换机的相关vtp参数和对应的trunk接口,接入交换机就能够从核心交换机上获取到所有的vlan信息,而不需要重新建立各个vlan。
TEST#sh vlan # 接下来我们去掉新增加的vlan,先显示一下。
VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- default active Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi3/, Gi3/, Gi3/, firewall active Gi1/ Engineering active Gi3/, Gi3/ Procurement active Gi3/ QAQC active Operation active Yard active Gi3/ BM active HRAD active Facility active Finance active GO active Wlan active Server active Gi3/, Gi3/, Gi3/, Gi3/, Gi3/, Gi3/, Gi3/, Gi3/ Client active Gi3/, Gi3/ test active Gi1/ fddi-default act/unsup token-ring-default act/unsup fddinet-default act/unsup trnet-default act/unsup VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - fddi - - - - - tr - - - - -
TEST#conf t
Enter configuration commands, one per line. End with CNTL/Z. #删除vlan 及重新划分的方法步骤!
TEST(config)#no vlan 200 # 第一步,删除vlan200
TEST(config)#no int vlan 200 # 第二步,删除int vlan200 ,经过这两步就可以彻底的删除vlan200了
TEST(config)int gi1/2 # 进入到gi1/2这个端口中
TEST(config-if)#switchport access vlan 1 # 将这个端口重新划分到vlan1中
TEST(config-if)#end
TEST#shv vlan
# 确认一下,我们成功的将gi1/2回归到vlan1中,并且删除掉了vlan200
VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- default active Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi1/, Gi3/, Gi3/, Gi3/ firewall active Gi1/ Engineering active Gi3/, Gi3/ Procurement active Gi3/ QAQC active Operation active Yard active Gi3/ BM active HRAD active Facility active Finance active GO active Wlan active Server active Gi3/, Gi3/, Gi3/, Gi3/, Gi3/, Gi3/, Gi3/, Gi3/ Client active Gi3/, Gi3/ fddi-default act/unsup token-ring-default act/unsup fddinet-default act/unsup trnet-default act/unsup VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - enet - - - - - fddi - - - - - tr - - - - - fdnet - - - ieee -
Cisco 的基本配置实例之四----vlan的规划及配置(核心交换机)的更多相关文章
- Cisco 的基本配置实例之四----vlan的规划及配置(接入交换机)
4.2 接入交换机的相关配置 ## 在此例中,我们联入的是一台接入交换机,此交换机的gi0/1口上联至核心交换机.也就意味着我们需要配置gi0/1为trunk口.具体的配置如下: D-2960-3(c ...
- CCNA网络工程师学习进程(6)vlan相关协议的配置与路由器简单配置介绍
前面已经介绍了大部分与vlan技术相关的交换机的协议的配置,更深层次的还有STP协议和以太网端口聚合技术,接着还会简单介绍一下路由器的基本应用. (1)STP(Spanning-tre ...
- Nginx常用配置实例(4)
Nginx作为一个HTTP服务器,在功能实现方面和性能方面都表现得非常卓越,完全可以与Apache相媲美,几乎可以实现Apache的所有功能,下面就介绍一些Nginx常用的配置实例,具体包含虚拟主机配 ...
- 锐捷交换机实验案例:vlan间互访的配置与验证
组网需求: 1.如下图所示,某用户内网被划分为VLAN 10.VLAN 20.VLAN 30,以实现相互间的2 层隔离: 2.3 个VLAN 对应的IP 子网分别为192.168.10.0/24 .1 ...
- 轻量级HTTP服务器Nginx(常用配置实例)
轻量级HTTP服务器Nginx(常用配置实例) 文章来源于南非蚂蚁 Nginx作为一个HTTP服务器,在功能实现方面和性能方面都表现得非常卓越,完全可以与Apache相媲美,几乎可以实现Apa ...
- cisco路由器 三层交换机简单环境配置实例(图)
出处:http://www.jb51.NET/softjc/56600.html cisco路由器&三层交换机简单环境配置实例 一.网络拓扑图: 二.配置命令: 1.路由器的配置: inter ...
- CISCO3560 VLAN配置实例
1.注意事项 1.1.交换机启动需要大约4-5分钟: 1.2.网线插入交换机接口从黄变为绿需要大约1-2分钟,即进入正常工作模式: 1.3.建议使用XP系统进行操作,2003默认没有安装超级终端,需要 ...
- Cisco 的基本配置实例之五----交换机的路由功能与DHCP 功能
5.配置交换机的路由功能 说明:只有在三层交换机上才有路由功能,其他的二层接入交换机要想在不同的vlan之间传送数据需要通过trunk口到核心交换机上进行完路由交换后才可以. TEST(config) ...
- Cisco基础(一):Vlan的划分、配置trunk中继链路、以太通道配置、DHCP服务配置
一.Vlan的划分 目标: VLAN(虚拟局域网)是对连接到的第二层交换机端口的网络用户的逻辑分段,不受网络用户的物理位置限制而根据用户需求进行网络分段.一个VLAN可以在 一个交换机或者跨交换机实现 ...
随机推荐
- Java 持久化操作之 --io流与序列化
1)File类操作文件的属性 1.File类的常用方法 1. 文件的绝对完整路径:getAbsolutePath() 文件名:getName() 文件相对路径:getPath() 文件的上一级目录:g ...
- Python内置函数(6)——round
英文文档: round(number[, ndigits]) Return the floating point value number rounded to ndigits digits afte ...
- 安装 docker-compose
安装Docker-Compose之前,请先安装 python-pip,安装好pip之后,就可以安装Docker-Compose了. 一.检查是否已经安装 二.安装 docker-compose 1.安 ...
- 新概念英语(1-11)Is this your shirt ?
Is this your shirt?Whose shirt is white? A:Whose shirt is that? Is this your shirt, Dave? Dave:No si ...
- jenkins创建multibranch pipeline
参考以下文章进行实践: https://jenkins.io/doc/pipeline/tour/hello-world/#what-is-a-jenkins-pipeline (看见一个介绍的还不错 ...
- Android自定义圆形图片工具类(CTRL+C加CTRL+V直接使用)
先贴一下工具类的代码!可直接复制粘贴 public class RoundImageView extends ImageView { private Paint mPaint; //画笔 privat ...
- uva 1411 Ants
题意: 一个平面上有n个黑色的点,n个白色的点,要求黑色的点与白色点之间一一配对,且线段之间不相交. 思路: 线段不相交并不好处理,想了很久想不出,所以看了蓝书的讲解. 一个很明显的结论是,不相交的线 ...
- Spring源码情操陶冶-任务定时器ConcurrentTaskScheduler
承接前文Spring源码情操陶冶#task:scheduled-tasks解析器,本文在前文的基础上讲解单核心线程线程池的工作原理 应用附例 承接前文的例子,如下 <!--define bean ...
- JS面向对象之原型链
对象的原型链 只要是对象就有原型 原型也是对象 只要是对象就有原型, 并且原型也是对象, 因此只要定义了一个对象, 那么就可以找到他的原型, 如此反复, 就可以构成一个对象的序列, 这个结构就被成 ...
- Android系统框架构
写此本文是为了对Android系统框架有一个整体的认识和了解,对于开发和测试人员脑子里要有整体认识以便对工作有所帮助. 进入正题 首先Android系统架构采用了分层架构的思想,共分为四层由上到下分: ...