Cisco Vlan通信

 
本实验中,将两个二层交换连接到三层的核心交换,并同处在一个VTP域,要求不仅让同vlan内主机能通信,也要不同vlan间主机实现通信(实际中意义是不大的,vlan的目的就是逻辑上通过不同网段划分工作组,但是这个实验能更清楚地明白对vlan,vtp,以及交换机接口的操作)。
swicth1/switch2上的配置:
Switch#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.
  Switch(vlan)#vtp domain 11
Changing VTP domain name from NULL to 11
Switch(vlan)#vtp client
Setting device to VTP CLIENT mode.
Switch(vlan)#exit
APPLY completed.
Exiting....
Switch(config)#int f0/1
Switch(config-if)#switchport mo trunk
%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
Switch(config-if)#no shut
Switch(config-if)#end
%SYS-5-CONFIG_I: Configured from console by console
Switch#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
2    VLAN0002                         active   
3    VLAN0003                         active   
1002 fddi-default                     active   
1003 token-ring-default               active   
1004 fddinet-default                  active   
1005 trnet-default                    active   
Switch(config)#int f0/2
Switch(config-if)#switchport mode access
Switch(config-if)#switchport ACCess VLAN 2
Switch(config-if)#NO SHUT
Switch(config-if)#int f0/3
Switch(config-if)#switchport mode access
Switch(config-if)#switchport ACCess VLAN 3
Switch(config-if)#no shut
 
Multilayer switch0上的配置:
Switch#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.
Switch(vlan)#vtp domain 11
Changing VTP domain name from NULL to 11
Switch(vlan)#vtp ?
  client       Set the device to client mode.
  domain       Set the name of the VTP administrative domain.
  password     Set the password for the VTP administrative domain.
  server       Set the device to server mode.
  transparent  Set the device to transparent mode.
  v2-mode      Set the administrative domain to V2 mode.
Switch(vlan)#vtp server
Device mode already VTP SERVER.
Switch(vlan)#
%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
%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
Switch(vlan)#exit
APPLY completed.
Exiting....
Switch(config)#int range f0/1-2
Switch(config-if-range)#switchport mo trunk
Switch(config-if-range)#no shut
Switch(config-if-range)#exit
Switch(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
Switch#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.
Switch(vlan)#vlan 2
VLAN 2 added:
    Name: VLAN0002
Switch(vlan)#vlan 3
VLAN 3 added:
    Name: VLAN0003
Switch(vlan)#exit
APPLY completed.
Exiting....
Switch#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config-if)#end
%SYS-5-CONFIG_I: Configured from console by console
Switch(config-if)#int vlan 2
Switch(config-if)#ip add 1.1.1 .1 255.0.0.0
Switch(config-if)#no shut
Switch(config-if)#int vlan 3
%LINK-5-CHANGED: Interface Vlan3, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan3, changed state to up
Switch(config-if)#int vlan 3
Switch(config-if)#ip add 2.2.2 .1 255.0.0.0
Switch(config-if)#no shut
 
注意:配置过程中要注意vtp中各交换机的配置修改编号(vtp revision),因为缺省均为server模式,而revision编号较低者会学习接收到的revision编号较高的信息,导致出现错误。但首先要保证接口为trunk,才能让vtp,vlan信息通过。
  此外。三层交换连接内网的两个接口仍为二层接口,无IP,我们是在vlan的虚拟网关中设置了两个网段的网关。

你可能感兴趣的:(职场,Cisco,休闲,不同Vlan之间通信)