Vai al contenuto

Inter-VLAN Routing (router a interfacce multiple)

Le VLAN sono interconnesse mediante un router che dispone di un'interfaccia di rete per ogni VLAN, oltre all'interfaccia di collegamento a una rete esterna

Caratteristiche generali

  • Vlan ID 2 "Server", rete IP 192.168.2.0/24; gateway 192.168.2.254
  • Vlan ID 3 "Client", rete IP 192.168.3.0/24; gateway 192.168.3.254
  • Rete esterna 1.2.3.0/24

Soluzione (.pkt)

Interconnessione di VLAN mediante router a interfacce multiple

Configurazione dei dispositivi di rete

sw1# configure terminal

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

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

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 gi0/1
sw1(config-if)# switchport mode trunk 
sw1(config-if)# switchport trunk allowed vlan 2,3
sw1(config-if)# end

sw1(config)# interface gi0/2
sw1(config-if)# switchport mode access 
sw1(config-if)# switchport access vlan 2
sw1(config-if)# end

sw1# show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
...
2    Server                           active    Fa0/1, Gig0/2
3    Client                           active    Fa0/2
...

sw1# show interfaces trunk

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

Port        Vlans allowed on trunk
Gig0/1      2-3
...

sw1# copy running-config startup-config

sw2# configure terminal

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

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

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

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

sw2(config)# interface gi0/1
sw2(config-if)# switchport mode trunk 
sw2(config-if)# switchport trunk allowed vlan 2,3
sw2(config-if)# end

sw2(config)# interface gi0/2
sw2(config-if)# switchport mode access 
sw2(config-if)# switchport access vlan 3
sw2(config-if)# end

sw2# show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
...
2    Server                           active    Fa0/1
3    Client                           active    Fa0/2, Gig0/2
...

sw2# show interfaces trunk

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

Port        Vlans allowed on trunk
Gig0/1      2-3
...

sw2# copy running-config startup-config

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# interface GigabitEthernet0/0
R0(config-if)# ip address 192.168.2.254 255.255.255.0
R0(config-if)# no shutdown

R0# interface GigabitEthernet0/1
R0(config-if)# ip address 192.168.3.254 255.255.255.0
R0(config-if)# no shutdown