Exempel 1: VLAN

I detta exempel konfigureras ett enkelt VLAN-baserat nätverk med syfte att gå genom tre protokoll:

  • DTP – Dynamic Trunking Protocol som ger switchar förmåga att förhandla arbetssätt (Access, Dynamic, Trunk)
  • VTP – VLAN Trunking Protocol som sprider konfigurationsinformation mellan switchar.
  • DOT1Q – 802.1Q som markerar nätverkstrafik tillhörande till specifik VLAN

Studera nätverket nedan där ingen VLAN teknik används. Tre olika nätverk ansluts till var sitt interface på router R1. Så kan router dirigera nätverkstrafik mellan dessa tre olika nätverk:

Totalt nio switchar och en router används i nätverkstopologin ovan där varje yrkesgrupp placeras på separata nätverk. Färgerna markerar de olika nätverk, annars fyller inte någon annan funktion.

Med VLAN-teknologi kan nio switchar reduceras till tre, studera topologin nedan:

L2-switchar möjliggör en logisk segmentering av ett fysiskt nätverk genom att använda protokollet DOT1Q. Router R1 konfiguration är intressant eftersom den använder virtuella interface eller på engelska ”subinterface” för att ansluta olika nätverk till ett och samma fysiska interface. När en router använder sig av subinterface kallas den ”router on a stick”. Ett nätverk med flera VLAN som kopplas ihop via en router kallas Inter-VLAN.

Konfigurationer

  • Switch> enable
  • Switch# configure terminal
  • Switch(config)# hostname S3
  • S3(config)# no ip domain-lookup
  • ! VLANs
  • S3(config)# vlan 10
  • S3(config-vlan)# name Developers
  • S3(config-vlan)# exit
  • S3(config)# vlan 20
  • S3(config-vlan)# name Designers
  • S3(config-vlan)# exit
  • S3(config)# vlan 30
  • S3(config-vlan)# name Engineers
  • S3(config-vlan)# exit
  • S3(config)# vlan 99
  • S3(config-vlan)# name Management
  • S3(config-vlan)# exit
  • ! Trunk portar
  • S3(config)# interface G1/1
  • S3(config-if)# switchport mode trunk
  • S3(config-if)# switchport trunk allowed vlan 10,20,30,99
  • S3(config-if)# exit
  • S3(config)# interface G2/1
  • S3(config-if)# switchport mode trunk
  • S3(config-if)# switchport trunk allowed vlan 10,20,30,99
  • S3(config-if)# exit
  • VTP konfigurering
  • S3(config)# vtp version 2
  • S3(config)# vtp domain diginto.se
  • S3(config)# vtp password LetmeP@55
  • S3(config)# vtp mode server
  • S3(config)# end
  • S3#
  • Switch> enable
  • Switch# configure terminal
  • Switch(config)# hostname S1
  • S1(config)# no ip domain-lookup
  • VTP konfigurering
  • S1(config)# vtp version 2
  • S1(config)# vtp domain diginto.se
  • S1(config)# vtp password LetmeP@55
  • S1(config)# vtp mode client
  • ! Trunk konfiguration - tillåtna VLAN 10, 20, 30,99
  • S1(config)# interface g0/1
  • S1(config-if)# switchport mode trunk
  • S1(config-if)# switchport trunk allowed vlan 10,20,30,99
  • S1(config-if)# exit
  • ! Access portar
  • S1(config)# interface range fa0/1-7
  • S1(config-if-range)# switchport mode access
  • S1(config-if-range)# switchport access vlan 10
  • S1(config-if-range)# exit
  • S1(config)# interface range fa0/8-14
  • S1(config-if-range)# switchport mode access
  • S1(config-if-range)# switchport access vlan 20
  • S1(config-if-range)# exit
  • S1(config)# interface range fa0/15-21
  • S1(config-if-range)# switchport mode access
  • S1(config-if-range)# switchport access vlan 30
  • S1(config-if-range)# exit
  • S1(config)# interface range fa0/22-23
  • S1(config-if-range)# switchport mode access
  • S1(config-if-range)# switchport access vlan 99
  • S1(config-if-range)# end
  • S1#
  • Switch> enable
  • Switch# configure terminal
  • Switch(config)# hostname S2
  • S2(config)# no ip domain-lookup
  • VTP konfiguration
  • S2(config)# vtp version 2
  • S2(config)# vtp domain diginto.se
  • S2(config)# vtp password LetmeP@55
  • S2(config)# vtp mode client
  • ! Trunk konfiguration - tillåtna VLAN 10, 20, 30, 99
  • S2(config)# interface G0/2
  • S2(config-if)# switchport mode trunk
  • S2(config-if)# switchport trunk allowed vlan 10,20,30,99
  • S2(config-if)# exit
  • ! Access portar
  • S2(config)# interface range fa0/1-7
  • S2(config-if-range)# switchport mode access
  • S2(config-if-range)# switchport access vlan 10
  • S2(config-if-range)# exit
  • S2(config)# interface range fa0/8-14
  • S2(config-if-range)# switchport mode access
  • S2(config-if-range)# switchport access vlan 20
  • S2(config-if-range)# exit
  • S2(config)# interface range fa0/15-21
  • S2(config-if-range)# switchport mode access
  • S2(config-if-range)# switchport access vlan 30
  • S2(config-if-range)# exit
  • S2(config)# interface range fa0/22-23
  • S2(config-if-range)# switchport mode access
  • S2(config-if-range)# switchport access vlan 99
  • S2(config-if-range)# end
  • S2#
  • Router>enable
  • Router# configure terminal
  • Router(config)# hostname R1
  • R1(config)# no ip domain-lookup
  • ! Router-on-a-stick konfiguration
  • R1(config)# interface Gig0/1
  • R1(config-if)# no ip address
  • R1(config-if)# no shutdown
  • R1(config-if)# exit
  • ! Sub-interface
  • R1(config)# interface Gig0/1.10
  • R1(config-subif)# encapsulation dot1q 10
  • R1(config-subif)# ip address 192.168.10.1 255.255.255.0
  • R1(config-subif)# exit
  • R1(config)# interface Gig0/1.20
  • R1(config-subif)# encapsulation dot1q 20
  • R1(config-subif)# ip address 192.168.20.1 255.255.255.0
  • R1(config-subif)# exit
  • R1(config)# interface Gig0/1.30
  • R1(config-subif)# encapsulation dot1q 30
  • R1(config-subif)# ip address 192.168.30.1 255.255.255.0
  • R1(config-subif)# exit
  • R1(config)# interface Gig0/1.99
  • R1(config-subif)# encapsulation dot1q 99
  • R1(config-subif)# ip address 192.168.99.1 255.255.255.0
  • R1(config-subif)# exit
  • R1(config-if)# end
  • R1#