TRUNK VTP CDP

2018-7-18

配置网络环境 

  1. 两边TRUNK使用相同的封装方式
  2. 两边TRUNK使用相同的NATIVE VLAN(本征VLAN)

配置交换机1 

Switch>en
Switch#
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#
%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/1 (1), with SW1 FastEthernet0/2 (10).

Switch(config)#vlan 10
Switch(config-vlan)#lan 20
                    ^
% Invalid input detected at '^' marker.
	
Switch(config-vlan)#vlan 20
Switch(config-vlan)#int vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up

Switch(config-if)#int range fa0/1-2
Switch(config-if-range)#sw ac vlan 20
Switch(config-if-range)#

配置交换机2 

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#ho SW1
SW1(config)#no ip domain lo
SW1(config)#no ip domain lookup 
SW1(config)#
SW1(config)#line c 0
SW1(config-line)#no ex
SW1(config-line)#no exec-timeout 
SW1(config-line)#log 
SW1(config-line)#logg ss
SW1(config-line)#logg s
SW1(config-line)#do wr
Building configuration...
[OK]
SW1(config-line)#
SW1(config-line)#exit
SW1(config)#
SW1(config)#vlan 10
SW1(config-vlan)#vlan 20
SW1(config-vlan)#do show vlan b

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, 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
                                                Gig0/1, Gig0/2
10   VLAN0010                         active    
20   VLAN0020                         active    
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
SW1(config-vlan)#int fa0/1
SW1(config-if)#sw ac vlan 10
SW1(config-if)#do wr
Building configuration...
[OK]
SW1(config-if)#int fa0/2
SW1(config-if)#sw ac vlan 10
SW1(config-if)#do wr

互ping 

Packet Tracer PC Command Line 1.0
C:\>ping 192.168.1.1

Pinging 192.168.1.1 with 32 bytes of data:

Reply from 192.168.1.1: bytes=32 time=3ms TTL=128
Reply from 192.168.1.1: bytes=32 time<1ms TTL=128
Reply from 192.168.1.1: bytes=32 time<1ms TTL=128
Reply from 192.168.1.1: bytes=32 time=1ms TTL=128

Ping statistics for 192.168.1.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 3ms, Average = 1ms

*路由器之间的接口配置推荐使用trunk

如果VLAN跨越多台交换机通信(每个交换机之间配置好了TRUNK):中间交换机必须要把两边交换机创建的VLAN都创建才能实现通信

以FA0/1接口为例:

  1. PC0送过来的以太网数据包到FA0/1接口是会被打上VLAN10的标签

  2. SW1将带有VLAN10标签的以太网数据包从FA0/1接口送出去时接口会摘除VLAN 10的标签


单臂路由:解决不同VLAN之间的通信

(只适用于中小型企业)

  1. 交换机上和路由器相连的接口需要配置TRUNK
  2. 有几个VLAN需要通信,就要在路由器上创建几个子接口
  • 主接口必须开启(开启物理接口)
  • 子接口要先定义封装方式
  • 然后才能配置子接口的IP地址

   en dot 10

  1. dot-----802.1Q
  2. 10-------vlan 10

  1. 定义了路由器和交换机之间TRUNK的封装方式为802.1Q
  2. 当交换机发送带有VLAN标签的以太网数据包到路由器时,该子接口只能接受接口标签时10的以太网数据包
  3. 当路由器收到数据包,检查路由表,从这个子接口把数据包送给交换机的时候,会被打上VLAN10的标签。

第一步 配置交换机

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#no ip domain loo
Switch(config)#line c 0
Switch(config-line)#no exec-timeout 
Switch(config-line)#exit
Switch(config)#ho sw1
sw1(config)#vlan 10
sw1(config-vlan)#vlan 20
sw1(config-vlan)#int fa0/3
sw1(config-if)#sw ac vlan 10
sw1(config-if)#int fa 0/2
sw1(config-if)#sw ac vlan 20
sw1(config-if)#int fa 0/1
sw1(config-if)#sw tr en d
sw1(config-if)#sw mo tr

第二步 配置路由器

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#no ip domain loo
Switch(config)#line c 0
Switch(config-line)#no e
Switch(config-line)#no exec-timeout 
Switch(config-line)#exit
Switch(config)#ho sw1
sw1(config)#vlan 10
sw1(config-vlan)#vlan 20
sw1(config-vlan)#int fa0/3
sw1(config-if)#sw ac vlan 10
sw1(config-if)#ip add 192.168.10.1
                  ^
% Invalid input detected at '^' marker.
	
sw1(config-if)#ip add 192.168.10.
                  ^
% Invalid input detected at '^' marker.
	
sw1(config-if)#int fa 0/2
sw1(config-if)#sw ac valn 20
                      ^
% Invalid input detected at '^' marker.
	
sw1(config-if)#sw ac vlan 20
sw1(config-if)#int fa 0/1
sw1(config-if)#sw mo tr
Command rejected: An interface whose trunk encapsulation is "Auto" can not be configured to "trunk" mode.
sw1(config-if)#sw tr en d
sw1(config-if)#sw mo tr
sw1(config-if)#
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#HO R1
R1(config)#int fa0/0
R1(config-if)#sw tr	
R1(config-if)#no sh
R1(config)#int fa0/0.100
R1(config-subif)#int fa0/0
R1(config-if)#sw mo tr
R1(config-if)#exit 
R1(config)#int fa0/0.100
R1(config-subif)#en dot1Q 10
R1(config-subif)#ip add 192.168.1.254 255.255.255.0
R1(config-subif)#exit
R1(config)#int fa0/0.200
R1(config-subif)#en dot1Q 20
R1(config-subif)#ip add 192.168.2.254 255.255.255.0
R1(config-subif)#exit

*帧经过交换机时,其源、目标MAC地址时不变,即二层转发不改变帧的源目MAC地址、源目IP地址;

帧经过路由器时,进行路由转发,源目IP地址是不会变的,但源目MAC地址必定会变。

例:A----B----C-----D  四个路由器   A发送报文至D。


CDP


VTP

VTP

交换机清空借口配置:default int faX/X

VTP Trunking Protocol:

宣告VLAN信息

同步VLAN信息

转发VLAN信息

 

支持多种网路类型:以太网,FDDI,令牌环

 

第一个模式:服务器模式(思科交换机默认模式)

添加、删除、修改VLAN

宣告VLAN信息

同步VLAN信息

转发VLAN信息

VLAN信息保存在NVRAM中

 

第二个模式:客户端模式

不能添加、删除、修改VLAN

同步VLAN信息

转发VLAN信息

VLAN信息不保存在NVRAM中

 

第三个模式:透明模式(在透明模式中添加、删除、修改VLAN,透明模式修订号永远为0)

添加、删除、修改VLAN

同步VLAN信息

转发VLAN信息

VLAN信息保存在NVRAM中

 

第一步:配置VTP相关信息

 

第二部:配置Trunk

 

 

 

VTP修订号如何归0

  1. 修改为透明模式
  2. 修改DOMAIN名称
  3. 格式化启动配置文件,删除VLAN信息

猜你喜欢

转载自blog.csdn.net/qq_39524009/article/details/81104609
VTP
今日推荐