实验拓扑:

223422367.jpg

实验需求:R2交换机上不添加VLAN2,会怎样呢?验证其C2发往C1数据的路径过程

配置如下:

R1:                                        R3:

vlan 2                                      vlan 2

exit                                        exit

int f0/0                                    int f0/0

switch mode access                          switch mode access

switch access vlan 2                        swtich access vlan 2

exit                                        exit

int f0/15                                   int f0/15

switch mode trunk                           switch mode trunk

switch trunk encapsulation dot1q            switch trunk encapsulation dot1q

switch trunk allowed vlan except 3-1001     switch trunk allowed vlan except 3-1001


R2:

interface range f0/14 - 15

switch mode trunk

switch trunk encapsulation dot1q

switch trunk allowd vlan except 3-1001


C1的IP地址为:172.16.1.1/24     C2的IP地址为:172.16.1.2/24


C2 ping  C1  不通


通过抓包得知:

C2将产生ARP广播包,经过R3的f0/0,查CAM表知道,需要将该包泛洪到所有VLAN2接口和

Switch2#show mac-address-table

Destination Address  Address Type  VLAN  Destination Port

-------------------  ------------  ----  --------------------

cc02.17e8.0000          Self          1     Vlan1

cc02.17e8.0000          Self          2     Vlan2

0024.8cbf.42ee          Dynamic       2     FastEthernet0/0

0c72.2ced.826c          Dynamic       2     FastEthernet0/0

继续发往F0/15 TRUNK口,打上VLAN2标签,发往R2的F0/15口

查看R2的CAM表

Destination Address  Address Type  VLAN  Destination Port

-------------------  ------------  ----  --------------------

cc01.17e8.0000          Self          1     Vlan

通过查表得知,没有VLAN2的信息,丢弃帧。

通过在R2添加VLAN2后


R2#show mac-address-table

Destination Address  Address Type  VLAN  Destination Port

-------------------  ------------  ----  --------------------

cc01.17e8.0000          Self          1     Vlan1

c008.14c8.0000          Dynamic       2     FastEthernet0/15

c007.14c8.0000          Dynamic       2     FastEthernet0/14

看到了VLAN2的转发信息,通了

备注:

一个交换机在刚配置了VLAN,而所有接口都没有接入设备的情况下


R1(config)#do show ip inter brie

Interface                  IP-Address      OK? Method Status                Protocol

FastEthernet0/0            unassigned      YES unset  up                    down

FastEthernet0/1            unassigned      YES unset  up                    down

FastEthernet0/2            unassigned      YES unset  up                    down

FastEthernet0/3            unassigned      YES unset  up                    down

FastEthernet0/4            unassigned      YES unset  up                    down

FastEthernet0/5            unassigned      YES unset  up                    down

FastEthernet0/6            unassigned      YES unset  up                    down

FastEthernet0/7            unassigned      YES unset  up                    down

FastEthernet0/8            unassigned      YES unset  up                    down

FastEthernet0/9            unassigned      YES unset  up                    down

FastEthernet0/10           unassigned      YES unset  up                    down

FastEthernet0/11           unassigned      YES unset  up                    down

FastEthernet0/12           unassigned      YES unset  up                    down

FastEthernet0/13           unassigned      YES unset  up                    down

FastEthernet0/14           unassigned      YES unset  up                    down

FastEthernet0/15           unassigned      YES unset  up                    down

Vlan1                      unassigned      YES unset  up                    down

看,VLAN 1是down的,而新添加的VLAN 2还没有出现在这张表里

那么怎样才能让VLAN 2出现在这个表里面呢?

很简单:interface vlan2

no shut

就出现,但是protocol也是down的,知道为什么了吗?

那就是还没有设备接入相应VLAN的端口,使其up;如果VLAN的相应端口up了,vlan也就up了

Vlan1                      unassigned      YES NVRAM  up                    up

Vlan2                      unassigned      YES NVRAM  up                    up