xinhu1300 发表于 2018-7-17 13:45:28

Cisco Packer Trace 之 VTP配置

  VTP理解:
  在一个拥有多台交换机的交换网络中,通常会在多台交换机上配置相同的VLAN,并且也会对多个接口做相同的配置。 对于需要对多个接口做相同的配置,通过快速接口配置,能够轻松实现,提高工作效率。而对于在多台交换机上做相同的VLAN配置,则通过VTP来实现。
  VTP为了在多台交换机上配置相同的VLAN,通过将一台交换机的VLAN向其它交换机传播的方法来完成,其它交换机在接收到VLAN信息后,然后更新自己的VLAN数据库,以达到同步。
  要将自己的VLAN信息发送到网络中,交换机上必须配置Trunk,IEEE 802.1Q和ISL都支持,通过Trunk相连的交换机便能收到对方发来的VLAN信息。 VTP通过域来管理网络中的交换机,任何交换机发出的VLAN信息只能在一个域内传播,只有相同域的交换机才能接收此VLAN信息,并且根据接收到的VLAN信息更新自己的VLAN数据库。交换机是否在同一个域,是通过域名来分辨的,比如域名ccie与域名ccie属于同一个域,而域名ccie与域名cisco就属于不同的域。默认交换机的域名为空,但是最重点的,需要大家牢记的是,如果自己的域名为空,则表示与任何非空域名相同,也就是说如果对方有域名,而自己却没有域名,则自己和对方属于相同的域。
  实验环境如下:

  实现目的:
  1、在CoreSW核心三层交换机上配置VTP Server,并创建VLAN2 \ VLAN3,并各分配IP段:192.168.2.0 \ 192.168.3.0。
  2、在SW1 和 SW2 交换机上配置为VTP CLIENT,并把各交换机的端口F0/3划分到VLAN2 ,F0/4划分到VLAN3。
  3、把各PC的IP地址分别设置如下:
  PC0: 192.168.2.2/24   网关:192.168.2.1
  PC1: 192.168.3.2/24   网关:192.168.3.1
  PC2: 192.168.2.3/24   网关:192.168.2.1
  PC3: 192.168.3.3/24   网关:192.168.3.1
  4、在CoreSW交换机上启用路由功能,并配置路由交换协议,让各VLAN的数据互通。
  5、测试各个VLAN之间的数据是否互通。
  实验步骤:(按实现目的步骤操作)
  1、在CoreSW核心三层交换机上配置VTP Server,并创建VLAN2 \ VLAN3,并各分配IP段:192.168.2.0 \ 192.168.3.0。
  Switch>
  Switch>enable
  Switch#conf t
  Enter configuration commands, one per line.End with CNTL/Z.
  Switch(config)#hostname CoreSW
  CoreSW(config)#exit
  CoreSW#
  %SYS-5-CONFIG_I: Configured from console by console
  CoreSW#vlan database
  % Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.
  CoreSW(vlan)#vtp domain senya
  Domain name already set to senya.
  CoreSW(vlan)#vtp server
  Device mode already VTP SERVER.
  CoreSW(vlan)#exit
  APPLY completed.
  Exiting....
  CoreSW#
  CoreSW#conf t
  Enter configuration commands, one per line.End with CNTL/Z.
  CoreSW(config)#int fa0/1
  CoreSW(config-if)#switchport trunk encapsulation dot1q
  CoreSW(config-if)#switchport mode trunk
  CoreSW(config-if)#
  %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
  %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
  CoreSW(config-if)#exit
  CoreSW(config)#int fa0/2
  CoreSW(config-if)#switchport trunk encapsulation dot1q
  CoreSW(config-if)#switchport mode trunk
  CoreSW(config-if)#
  %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
  %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
  CoreSW(config)#int vlan 2
  CoreSW(config-if)#ip add 192.168.2.1 255.255.255.0
  CoreSW(config-if)#no shutdown
  CoreSW(config-if)#exit
  CoreSW(config)#int vlan 3
  CoreSW(config-if)#ip add 192.168.3.1 255.255.255.0
  CoreSW(config-if)#no shutdown
  2、在SW1 和 SW2 交换机上配置为VTP CLIENT,并把各交换机的端口F0/3划分到VLAN2 ,F0/4划分到VLAN3。
  SW1:
  Switch>enable
  Switch#conf t
  Enter configuration commands, one per line.End with CNTL/Z.
  Switch(config)#hostname SW1
  SW1(config)#exit
  SW1#
  %SYS-5-CONFIG_I: Configured from console by console
  SW1#
  SW1#vlan database
  % Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.
  SW1(vlan)#vtp domain senya
  Domain name already set to senya.
  SW1(vlan)#vtp client
  Device mode already VTP CLIENT.
  SW1(vlan)#exit
  APPLY completed.
  Exiting....
  SW1#show vlan
  VLAN Name                           Status    Ports
  ---- -------------------------------- --------- -------------------------------
  1    default                        active    Fa0/2, Fa0/3, Fa0/4, Fa0/5
  Fa0/6, Fa0/7, Fa0/8, Fa0/9
  Fa0/10, Fa0/11, Fa0/12, Fa0/13
  Fa0/14, Fa0/15, Fa0/16, Fa0/17
  Fa0/18, Fa0/19, Fa0/20, Fa0/21
  Fa0/22, Fa0/23, Fa0/24, Gig1/1
  Gig1/2
  2    VLAN0002                         active
  3    VLAN0003                         active
  4    VLAN0004                         active
  SW1(config)#int fa0/3
  SW1(config-if)#switchport mode access
  SW1(config-if)#switchport access vlan 2
  SW1(config-if)#exit
  SW1(config)#int fa0/4
  SW1(config-if)#switchport mode access
  SW1(config-if)#switchport access vlan 3
  SW2:(跟SW1同样的操作步骤省略)
  3、把各PC的IP地址分别设置如下:(省略)
  PC0: 192.168.2.2/24   网关:192.168.2.1
  PC1: 192.168.3.2/24   网关:192.168.3.1
  PC2: 192.168.2.3/24   网关:192.168.2.1
  PC3: 192.168.3.3/24   网关:192.168.3.1
  4、在CoreSW交换机上启用路由功能,并配置路由交换协议,让各VLAN的数据互通。
  CoreSW#conf t
  Enter configuration commands, one per line.End with CNTL/Z.
  CoreSW(config)#ip routing
  CoreSW(config)#router rip
  CoreSW(config-router)#ver 2
  CoreSW(config-router)#no au
  CoreSW(config-router)#no auto-summary
  CoreSW(config-router)#net 192.168.2.0
  CoreSW(config-router)#net 192.168.3.0
  CoreSW(config-router)#exit
  5、测试各个VLAN之间的数据是否互通。

  疑问:如果我在SW1或SW2里增加一台主机,设置IP地址为192.168.2.5,请问这个主机会PING通VLAN3的主机吗,结果是不行的,并且在同一个交换机上的VLAN2主机192.168.2.2也是PING不通的。
页: [1]
查看完整版本: Cisco Packer Trace 之 VTP配置