VLAN&VTP实验2:配置VLAN Trunk和VTP域

VLAN&VTP实验2:配置VLAN TrunkVTP

 
实验等级: Assistant
 
实验拓扑:
VLAN&VTP实验2:配置VLAN Trunk和VTP域_第1张图片
 
 
实验说明:
 
在不同交换机上相同的 VLAN 内的终端是无法互相通信的,为了解决这个问题,可以将不同交换机通过 Trunk 链路连接起来。 Trunk 链路是支持多个 VLAN 的点到点链路,使用它可以让支持 VLAN 的设备创建链路时,节省端口。
 
VTP 域是由一组 VTP 域名相同的互相连接的交换机组成。一个交换机只能在一个 VTP 域内。它可以减少在配置改变时可能引起的配置不一致的问题,并且可以减少对于 VLAN 的操作。
 
 
基本配置:
 
PC1
PC1(config)#int fa0/0
PC1(config-if)#ip add 12.1.1.1 255.255.255.0
PC1(config-if)#no sh   
 
PC2
PC2(config)#int fa0/0
PC2(config-if)#ip add 12.1.1.2 255.255.255.0
PC2(config-if)#no sh
 
PC3
PC3(config)#int fa0/0
PC3(config-if)#ip add 23.1.1.3 255.255.255.0
PC3(config-if)#no sh
 
SW1
SW1(config)#int fa1/11
SW1(config-if)#speed 100
SW1(config-if)#duplex full
SW1(config-if)#no sh
SW1(config-if)#int fa1/1
SW1(config-if)#no sh
 
SW2
SW2(config)#int fa1/11
SW2(config-if)#speed 100
SW2(config-if)#duplex full
SW2(config-if)#no sh
SW2(config-if)#int fa1/12
SW2(config-if)#speed 100
SW2(config-if)#duplex full
SW2(config-if)#no sh
SW2(config-if)#int fa1/2
SW2(config-if)#no sh
 
测试连通性,在 PC1 ping  PC2
    PC1#ping 12.1.1.2
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 72/432/1136 ms
可以 ping
 
SW1 SW2 上建立 VLAN ,并且将相应的端口划分到 VLAN
 
    SW1#vlan database
SW1(vlan)#vlan 3
VLAN 3 added:
        Name: VLAN0003
SW1(vlan)#exit
APPLY completed.
Exiting....
SW1#
SW1#conf t
SW1(config)#int fa1/11
SW1(config-if)#switchport access vlan 3
 
查看 VLAN 信息:
 
SW2#vlan da
SW2(vlan)#vlan 3
VLAN 3 added:
    Name: VLAN0003
SW2(vlan)#vlan 5
VLAN 5 added:
    Name: VLAN0005
SW2(vlan)#exit
APPLY completed.
Exiting....
SW2#
SW2#conf t
SW2(config)#int fa1/11
SW2(config-if)#sw ac vla 3
SW2(config-if)#int fa1/12
SW2(config-if)#sw ac vla 5
 
查看 VLAN 信息:
 
 
回到 PC1 上尝试 ping PC2
    PC1#ping 12.1.1.2
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:
......
Success rate is 0 percent (0/5)
此时已经无法 ping
 
 
实验步骤:
 
 
1. SW1 Fa1/1 SW2 Fa1/2 端口设置为 trunk 端口:
 
SW1#conf t
SW1(config)#int fa1/1
SW1(config-if)#switchport mode trunk
SW2#conf t
SW2(config)#int fa1/2
SW2(config-if)#switchport mo tr
 
查看端口信息:
 
此时在回到 PC1 ping  PC2
PC1#ping 12.1.1.2
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 48/80/120 ms
通了。
 
 
2.Trunk 的帧标识
在以太网的 Trunk 链路上,有两种帧标识的方法。分别为 ISL (交换机间连接)和 IEEE 802.1Q dot1q
 
ISL Cisco 私有的。它的标识方法是:在以太网帧上装上一个 26 字节的 ISL 头(包含 VLAN ID 信息)和 4 字节的 CRC 。这种封装格式不会改变以原有的以太网帧。
 
802.1Q 是国际标准,任何厂商都支持。它的标识方法是:在原有的以太网帧内部插入一个 4 字节的标记头,然后改变原有以太网帧的 CRC 。这种封装格式会改变原有的以太网帧。
 
3.VTP
 
一个交换机只能位于具有相同域名的一个 VTP 域中。所以在使用 VTP 时,必须先配置 VTP 域名。
VTP 有三种模式: Server (服务器), Client (客户), Transparent (透明)
 
 
在这个实验中,将域名设置为 gairuhe ,将 SW2 设置为 Server SW1 设置为 Client
首先查看 VTP 的状态
 
 
默认情况下,所以的交换机都为 Server 模式,并且域名为空( Null
 
 
改变交换机的域名:
SW1#vlan data
SW1(vlan)#vtp domain gairuhe
Changing VTP domain name from NULL to gairuhe
SW1(vlan)#exit
APPLY completed.
Exiting....
SW2(vlan)#vtp domain gairuhe
Domain name already set to gairuhe .
SW2(vlan)#exit
APPLY completed.
Exiting....
 
这里可以看到,当我们将 SW1 的域名设置为 gairuhe 时, SW2 的域名就会学习,并且也设置为 gairuhe
 
到这里,再次查看 SW1 VLAN 信息:
 
 
这里只有 VLAN3.
现在将 SW1 设置成为 Client 模式
SW1#vlan database
SW1(vlan)#vtp client
Setting device to VTP CLIENT mode.
 
再次查看 SW1 VLAN 信息:
 
 
发现多了一个 VLAN5 ,这是从服务器 SW2 学习过来的。
 
 
SW1 上尝试创建一个 VLAN 10
SW1#vlan database
SW1(vlan)#vlan 10
VLAN 10 added:
    Name: VLAN0010
SW1(vlan)#exit
In CLIENT state, no apply attempted.
Exiting....
这里可以看出,处于 Client 模式的交换机不能创建,修改,删除 VLAN
 
 
关于 VTP 三种模式的区别,可以参考下表:
 
 
VTP 模式
描述
Server
默认模式。可以创建、删除、修改 VLAN 。可以指定本 VTP 域中所有交换机的配置参数。 VTP 服务器在本 VTP 域中想其它交换机通告 VLAN 信息,同时根据从 Trunk 链路上接收到的通告,对本域中其它交换机的 VLAN 进行同步。
VLAN 的配置存入 NVRAM 中。
Client
不能创建、删除、修改 VLAN
VLAN 的配置不存入 NVRAM
Transparent
处于此种模式的交换机不参与到 VTP 域中。不通告自己的 VLAN 配置,也不会根据接受到的通告同步自己的 VLAN 配置。在 VTP 版本二中,透明模式的交换机会转发接受到的通告。可以在这种模式下创建、删除、修改 VLAN 信息。
VLAN 的配置存入 NVRAM 中,但是不会通告出去。
 

你可能感兴趣的:(职场,VLAN,休闲,交换,VTP)