Vai al contenuto

Inter-VLAN Routing (Router on a Stick) e VTP

Caratteristiche generali

  • Vlan ID 2 "Server", rete IP 192.168.2.0/24, gateway 192.168.2.254 (interfaccia virtuale 0/1.2 del router)
  • Vlan ID 3 "Client", rete IP 192.168.3.0/24, gateway 192.168.3.254 (interfaccia virtuale 0/1.3 del router)
  • Vlan ID 4 "Stampanti", rete IP 192.168.4.0/24, gateway 192.168.4.254 (interfaccia virtuale 0/1.4 del router)
  • Configurazione VTP (versione 2)
    • Switch sw0: VTP server
    • Switch sw1 e sw2: VTP client
    • Dominio VTP: azienda
    • Password VTP: 123456

Soluzione (.pkt)

Inter-VLAN Routing con Router on a Stick

Configurazione dei dispositivi di rete

sw0# configure terminal 

sw0(config)# vlan 2
sw0(config-vlan)# name Server
sw0(config-vlan)# exit

sw0(config)# vlan 3
sw0(config-vlan)# name Client
sw0(config-vlan)# exit

sw0(config)# vlan 4
sw0(config-vlan)# name Stampanti
sw0(config-vlan)# exit

sw0(config)# interface gi0/1
sw0(config-if-range)# switchport mode trunk
sw0(config-if-range)# exit

sw0(config)# interface gi1/1
sw0(config-if-range)# switchport mode trunk
sw0(config-if-range)# exit

sw0(config)# interface gi2/1
sw0(config-if-range)# switchport mode trunk
sw0(config-if-range)# end

sw0# show vlan brief

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
...
2    Server                           active    
3    Client                           active    
4    Stampanti                        active    
...

sw0# show interfaces trunk

Port        Mode         Encapsulation  Status        Native vlan
Gig0/1      on           802.1q         trunking      1
Gig1/1      on           802.1q         trunking      1
Gig2/1      on           802.1q         trunking      1

Port        Vlans allowed on trunk
Gig0/1      1-1005
Gig1/1      1-1005
Gig2/1      1-1005

Port        Vlans allowed and active in management domain
Gig0/1      1,2,3,4
Gig1/1      1,2,3,4
Gig2/1      1,2,3,4

Port        Vlans in spanning tree forwarding state and not pruned
Gig0/1      1,2,3,4
Gig1/1      1,2,3,4
Gig2/1      1,2,3,4

! Configurazione VTP

sw0(config)# vtp mode server 
sw0(config)# vtp domain azienda
sw0(config)# vtp password 123456
sw0(config)# vtp version 2

sw0# show vtp status 

VTP Version                     : 2
Configuration Revision          : 13
Maximum VLANs supported locally : 255
Number of existing VLANs        : 8
VTP Operating Mode              : Server
VTP Domain Name                 : azienda
VTP Pruning Mode                : Disabled
VTP V2 Mode                     : Enabled
...    

sw1# configure terminal 

sw1(config)# vtp mode client 
sw1(config)# vtp domain azienda
sw1(config)# vtp password 123456
sw1(config)# vtp version 2

sw1(config)# interface fa0/1
sw1(config-if)# switchport mode access
sw1(config-if)# switchport access vlan 2
sw1(config-if)# exit

sw1(config)# interface fa0/2
sw1(config-if)# switchport mode access
sw1(config-if)# switchport access vlan 3
sw1(config-if)# exit

sw1(config)# interface fa0/3
sw1(config-if)# switchport mode access
sw1(config-if)# switchport access vlan 4
sw1(config)# end

! L'interfaccia gi0/1 di default è dinamica (auto), diventa
! automaticamente trunk se collegata a un'altra porta trunk

sw1# show vlan brief

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
...
2    Server                           active    Fa0/1
3    Client                           active    Fa0/2
4    Stampanti                        active    Fa0/3
...

sw1# show interfaces trunk 

Port        Mode         Encapsulation  Status        Native vlan
Gig0/1      auto         n-802.1q       trunking      1

Port        Vlans allowed on trunk
Gig0/1      1-1005

Port        Vlans allowed and active in management domain
Gig0/1      1,2,3,4

Port        Vlans in spanning tree forwarding state and not pruned
Gig0/1      1,2,3,4

sw1# show vtp status

VTP Version capable             : 1 to 2
VTP version running             : 2
VTP Domain Name                 : azienda
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : 000A.41B0.8E00
Configuration last modified by 0.0.0.0 at 3-1-93 00:05:55

Feature VLAN : 
--------------
VTP Operating Mode                : Client
Maximum VLANs supported locally   : 255
Number of existing VLANs          : 8
Configuration Revision            : 13
...

La configurazione dello switch sw2 è identica a quella dello switch sw1.

R0# configure terminal 

! Interfaccia per testare la raggiungibilità della rete Internet     
R0# interface loopback 1
R0(config-if)# ip address 1.2.3.1 255.255.255.0
R0(config-if)# exit

! L'interfaccia fisica deve essere attivata    
R0# interface GigabitEthernet0/1
R0(config-if)# no shutdown   
R0(config-if)# exit

! Configurazione delle tre interfacce virtuali associate a gi0/1
R0# interface gi0/1.2
R0(config-subif)# encapsulation dot1Q 2
R0(config-subif)# ip address 192.168.2.254 255.255.255.0
R0(config-subif)# exit

R0# interface gi0/1.3
R0(config-subif)# encapsulation dot1Q 3
R0(config-subif)# ip address 192.168.3.254 255.255.255.0
R0(config-subif)# exit

R0# interface gi0/1.4
R0(config-subif)# encapsulation dot1Q 4
R0(config-subif)# ip address 192.168.4.254 255.255.255.0
R0(config-subif)# exit