VLAN del 1

I exemplet ska VLAN teknik utforskas med hjälp av en laboration från Cisco. En enkel nätverkstopologi med två 2960-switchar fem datorer. Förutom de tre datorer som syns på bilden två till läggs i topologin.

Bild 1: VLAN teknik

Till en början alla switchar har ett konfigurerat VLAN  med namn Default och identifierat som VLAN 1. Alla portar tillhör VLAN 1 och det kan verifieras med kommandot show vlan. VLAN 1 kan inte ändras eller tas bort, men portarna kan ändras.

Del 1 konfigurationer

Bild 2: VLAN teknik – Del 1
  • VLAN 10 Student konfigureras på S1 och S2, samt VLAN 99 som Management
  • VLAN 20 Faculty konfigureras på S2, samt VLAN 99 som Management
  • På S1 VLAN 10 tilldelas access-port F0/6, VLAN 99 access-port F0/2, och trunk konfigureras på port F0/1
  • På S2 VLAN 10 tilldelas access-port F0/11, VLAN 20 access-port F0/18, VLAN 99 access-port F0/2, och trunk konfigureras på port F0/1
  • På S1 VLAN Management adresseras med IP-adress 192.168.1.11/24. Till nätverkstopologin lägger du till en PC ansluten till port F0/2
  • På S2 VLAN Management adresseras med IP-adress 192.168.1.12/24. Till nätverkstopologin lägger du till en PC ansluten till port F0/2
  • Telnet och ping testar och verifierar:
    • ping mellan datorer i Management VLAN
    • ping från datorer i Management VLAN till switch S1 192.168.1.11 och till switch S2 192.168.12
    • kör telnet från datorer i Management till switch S1 och S2
  • IP-adresser för datorer:
    • PC-A 192.168.10.3/24, DG 192.168.10.1
    • PC-B 192.168.10.4/24, DG 192.168.10.1
    • PC-C 192.168.20.3/24, DG 192.168.10.1

Konfigurationer

  • Grundkonfiguration på switch S1
  • Switch> enable
  • Switch# configure terminal
  • Switch(config)# hostname S1
  • S1(config)# no ip domain-lookup
  • S1(config)# service password-encryption
  • S1(config)# enable secret enpass
  • S1(config)# banner motd # Unauthorized access is strictly prohibited. #
  • S1(config)# line console 0
  • S1(config-line)# password conpass
  • S1(config-line)# login
  • S1(config-line)# logging synchronous
  • S1(config-line)# exit
  • S1(config)# line vty 0 15
  • S1(config-line)# password vtypass
  • S1(config-line)# login
  • S1(config-line)# logging synchronous
  • S1(config-line)# end
  • S1#
  • Grundkonfiguration på switch S2
  • Switch> enable
  • Switch# configure terminal
  • Switch(config)# hostname S2
  • S2(config)# no ip domain-lookup
  • S2(config)# service password-encryption
  • S2(config)# enable secret enpass
  • S2(config)# banner motd # Unauthorized access is strictly prohibited. #
  • S2(config)# line console 0
  • S2(config-line)# password conpass
  • S2(config-line)# login
  • S2(config-line)# logging synchronous
  • S2(config-line)# exit
  • S2(config)# line vty 0 15
  • S2(config-line)# password vtypass
  • S2(config-line)# login
  • S2(config-line)# logging synchronous
  • S2(config-line)# end
  • S2#
  • S1# configure terminal
  • S1(config)# vlan 10
  • S1(config-vlan)# name Student
  • S1(config-vlan)# vlan 20
  • S1(config-vlan)# name Faculty
  • S1(config-vlan)# vlan 99
  • S1(config-vlan)# name Management
  • S1(config-vlan)# end
  • S1# show vlan
  • Interface tilldelning
  • S1# configure terminal
  • S1(config)# interface fa0/6
  • S1(config-if)# switchport mode access
  • S1(config-if)# switchport access vlan 10
  • S1(config-if)# exit
  • Nollställ VLAN 1 och adressera VLAN 99
  • S1(config)# interface vlan 1
  • S1(config-if)# no ip address
  • S1(config-if)# exit
  • S1(config)# interface vlan 99
  • S1(config-if)# ip address 192.168.1.11 255.255.255.0
  • S1(config-if)# end
  • S1# show vlan brief
  • S1# show ip interface brief
  • S2# configure terminal
  • S2(config)# vlan 10
  • S2(config-vlan)# name Student
  • S2(config-vlan)# vlan 20
  • S2(config-vlan)# name Faculty
  • S2(config-vlan)# vlan 99
  • S2(config-vlan)# name Management
  • S2(config-vlan)# end
  • S2# show vlan
  • Interface tilldelning
  • S2# configure terminal
  • S2(config)# interface fa0/11
  • S2(config-if)# switchport mode access
  • S2(config-if)# switchport access vlan 10
  • S2(config-if)# exit
  • S2(config)# interface fa0/18
  • S2(config-if)# switchport mode access
  • S2(config-if)# switchport access vlan 20
  • S2(config-if)# exit
  • Nollställ VLAN 1 och adressera VLAN 99
  • S2(config)# interface vlan 1
  • S2(config-if)# no ip address
  • S2(config-if)# exit
  • S2(config)# interface vlan 99
  • S2(config-if)# ip address 192.168.1.12 255.255.255.0
  • S2(config-if)# end
  • S2# show vlan brief
  • S2# show ip interface brief
  • S1#configure terminal
  • S1(config)#interface fa 0/1
  • S1(config-if)#switchport mode trunk
  • S1(config-if)#end
  • S1#
  •  
  • S2#configure terminal
  • S2(config)#interface fa 0/1
  • S2(config-if)#switchport mode trunk
  • S2(config-if)#end
  • S2#

Det är inte möjligt att kommunicera med switchar via Telnet från datorerna eftersom switchens privilegierat exekveringsläge och virtuella terminaler VTY måste konfigureras först. 

  • S1(config)#enable password enPa55
  • S1(config)#line vty 0 4
  • S1(config-line)#transport input telnet
  • S1(config-line)#password vtyPa55
  • S1(config-line)#login
  • S1(config-line)#end
  • S1#
  • S2(config)#
  • S2(config)#enable password enPa55
  • S2(config)#line vty 0 4
  • S2(config-line)#transport input telnet
  • S2(config-line)#password vtyPa55
  • S2(config-line)#login
  • S2(config-line)#end
  • S2#

I konfigurationer ovan vem som helst som har lösenorden kan komma åt switcharna. Det kan ändras ifall man skapar först användarkonton:

  • S1(config)#enable password enPa55
  • S1(config)#username Admin privilege 15 password Pa51nimdA
  • S1(config)#line vty 0 4
  • S1(config-line)#transport input telnet
  • S1(config-line)#password vtyPa55
  • S1(config-line)#login local
  • S1(config-line)#end
  • S1#
  • S2(config)#enable password enPa55
  • S2(config)#username Nimja privilege 15 password Pa52ajmiN
  • S2(config)#line vty 0 4
  • S2(config-line)#transport input telnet
  • S2(config-line)#password vtyPa55
  • S2(config-line)#login local
  • S2(config-line)#end
  • S2#