Exempel 4 VLAN och RIP

I denna laboration arbetar vi med inter-VLAN-routing, DHCP och RIP i ett campusnätverk. Målet är att förstå hur ett fysiskt nätverk kan delas upp i logiska delar med hjälp av VLAN, hur klienter automatiskt får IP-adresser och hur routing mellan olika nätverk fungerar.

Virtual LAN (VLAN) används för att segmentera ett fysiskt nätverk i flera logiska nätverk. Detta gör det möjligt att separera datorer från olika avdelningar, även när de är anslutna till samma fysiska switch. Genom att använda VLAN minskar broadcast-trafiken, säkerheten förbättras och nätverket blir mer överskådligt och lättare att administrera.

I denna laboration används tre typer av VLAN. Data VLAN används för att bära användardata, till exempel klientdatorer i VLAN 10, 20 och 30. Management VLAN används för administration av switchar, exempelvis VLAN 66 och 99. Native VLAN används för otaggad trafik på trunklänkar; som standard är detta VLAN 1, men i praktiska nätverk ändras det ofta av säkerhetsskäl.

Topologi

För att förenkla hanteringen av VLAN används VTP (VLAN Trunking Protocol) i campusnätverket. Switcharna DS1 och NS1 fungerar som VTP-servrar, vilket innebär att VLAN som skapas på dessa switchar automatiskt distribueras till övriga switchar inom samma VTP-domän.

Switcharna DS2, DS3, NS2 och NS3 är VTP-klienter och kan därför inte själva skapa eller ta bort VLAN, men de tar emot VLAN-informationen från sin VTP-server och skapar motsvarande VLAN lokalt.

Det är viktigt att komma ihåg att VTP endast hanterar VLAN-nummer och namn. Konfiguration av trunklänkar samt tilldelning av switchportar till rätt VLAN måste alltid göras manuellt.

DHCP-servrar

I nätverket används två routrar som DHCP-servrar. DR1 fungerar som DHCP-server för domänen diginto.se och NR1 för domänen ng.se. Routrarna delar automatiskt ut IP-adresser till klienterna i respektive VLAN. Varje VLAN tilldelas ett eget IP-nät, till exempel 192.168.10.0/24 för VLAN 10, och routern fungerar som default gateway för klienterna i detta nät.

Vissa IP-adresser reserveras och exkluderas från DHCP-utdelning, exempelvis adresser som används av routerns egna gränssnitt, såsom 192.168.10.1 till 192.168.10.9.

Konfigurationer

  • Switch> enable
  • Switch# configure terminal
  • Switch(config)# hostname DS1
  • DS1(config)# no ip domain-lookup
  • DS1(config)# service password-encryption
  • ! VTP-konfiguration DS1 fungerar som VTP-server
  • DS1(config)# vtp mode server
  • DS1(config)# vtp domain diginto.se
  • DS1(config)# vtp password digP@55
  • DS1(config)# vtp version 2
  • ! VLAN-konfiguration – skapande av VLAN som distribueras via VTP
  • DS1(config)# vlan 10
  • DS1(config-vlan)# name Technology
  • DS1(config-vlan)# exit
  • DS1(config)# vlan 20
  • DS1(config-vlan)# name Social
  • DS1(config-vlan)# exit
  • DS1(config)# vlan 30
  • DS1(config-vlan)# name Science
  • DS1(config-vlan)# exit
  • DS1(config)# vlan 66
  • DS1(config-vlan)# name Management
  • DS1(config-vlan)# exit
  • DS1(config)# vlan 999
    DS1(config-vlan)# name Native
    DS1(config-vlan)# exit
  • ! Trunk-konfiguration – trunklänkar mellan switchar och router
  • ! Native VLAN är satt till 999 i diginto-domänen
  • DS1(config)# interface g1/1
  • DS1(config-if)# description Trunk till DS2
  • DS1(config-if)# switchport mode trunk
  • DS1(config-if)# switchport trunk native vlan 999
  • DS1(config-if)# switchport trunk allowed vlan 10,20,30,66,999
  • DS1(config-if)# exit
  • DS1(config)# interface g2/1
  • DS1(config-if)# description Trunk till DS3
  • DS1(config-if)# switchport mode trunk
  • DS1(config-if)# switchport trunk native vlan 999
  • DS1(config-if)# switchport trunk allowed vlan 10,20,30,66,999
  • DS1(config-if)# exit
  • DS1(config)# interface g0/1
  • DS1(config-if)# description Trunk till DR1 (Inter-VLAN-routing)
  • DS1(config-if)# switchport mode trunk
  • DS1(config-if)# switchport trunk native vlan 999
  • DS1(config-if)# switchport trunk allowed vlan 10,20,30,66,999
  • DS1(config-if)# exit
  • ! Management-SVI – IP-adress för fjärradministration av switchen
  • DS1(config)# interface vlan 66
  • DS1(config-if)# description Management SVI
  • DS1(config-if)# ip address 192.168.66.2 255.255.255.248
  • DS1(config-if)# no shutdown
  • DS1(config-if)# exit
  • DS1(config)# end
  • DS1# write memory
  • Switch> enable
  • Switch# configure terminal
  • Switch(config)# hostname DS2
  • DS2(config)# no ip domain-lookup
  • DS2(config)# service password-encryption
  • ! VTP-konfiguration – DS2 fungerar som VTP-klient i diginto-domänen
  • DS2(config)# vtp mode client
  • DS2(config)# vtp domain diginto.se
  • DS2(config)# vtp password digP@55
  • DS2(config)# vtp version 2
  • ! Trunk-konfiguration – trunk mot distributionsswitch DS1
  • ! Native VLAN är satt till 999 i diginto-domänen
  • DS2(config)# interface g0/1
  • DS2(config-if)# description Trunk till DS1
  • DS2(config-if)# switchport mode trunk
  • DS2(config-if)# switchport trunk native vlan 999
  • DS2(config-if)# switchport trunk allowed vlan 10,20,30,66,999
  • DS2(config-if)# exit
  • ! Accessportar – klientportar för respektive VLAN
  • ! VLAN 10 – Technology
  • DS2(config)# interface range fa0/1 - 7
  • DS2(config-if-range)# description Accessport VLAN 10 (Technology)
  • DS2(config-if-range)# switchport mode access
  • DS2(config-if-range)# switchport access vlan 10
  • DS2(config-if-range)# exit
  • ! VLAN 20 – Social
  • DS2(config)# interface range fa0/8 - 14
  • DS2(config-if-range)# description Accessport VLAN 20 (Social)
  • DS2(config-if-range)# switchport mode access
  • DS2(config-if-range)# switchport access vlan 20
  • DS2(config-if-range)# exit
  • ! VLAN 30 – Science
  • DS2(config)# interface range fa0/15 - 21
  • DS2(config-if-range)# description Accessport VLAN 30 (Science)
  • DS2(config-if-range)# switchport mode access
  • DS2(config-if-range)# switchport access vlan 30
  • DS2(config-if-range)# exit
  • ! VLAN 66 – Management (lokal administration)
  • DS2(config)# interface range fa0/22 - 24
  • DS2(config-if-range)# description Accessport VLAN 66 (Management)
  • DS2(config-if-range)# switchport mode access
  • DS2(config-if-range)# switchport access vlan 66
  • DS2(config-if-range)# exit
  • ! Management-SVI - IP-adress för fjärradministration av switchen via VLAN 66.
  • DS2(config)# interface vlan 66
  • DS2(config-if)# description Management SVI
  • DS2(config-if)# ip address 192.168.66.3 255.255.255.248
  • DS2(config-if)# no shutdown
  • DS2(config-if)# exit
  • DS2(config)# ip default-gateway 192.168.66.1
  • DS2(config)# end
  • DS2# write memory
  • Switch> enable
  • Switch# configure terminal
  • Switch(config)# hostname DS3
  • DS3(config)# no ip domain-lookup
  • DS3(config)# service password-encryption
  • ! VTP-konfiguration
  • ! DS3 fungerar som VTP-klient och tar emot VLAN-information från DS1.
  • DS3(config)# vtp mode client
  • DS3(config)# vtp domain diginto.se
  • DS3(config)# vtp password digP@55
  • DS3(config)# vtp version 2
  • ! Trunk-konfiguration
  • ! Trunk mot DS1. Native VLAN är satt till 999 i diginto-domänen.
  • DS3(config)# interface g0/1
  • DS3(config-if)# description Trunk till DS1
  • DS3(config-if)# switchport mode trunk
  • DS3(config-if)# switchport trunk native vlan 999
  • DS3(config-if)# switchport trunk allowed vlan 10,20,30,66,999
  • DS3(config-if)# exit
  • Accessport-konfiguration
  • ! Klientportar placeras i respektive VLAN.
  • DS3(config)# interface range fa0/1 - 7
  • DS3(config-if-range)# description Accessport VLAN 10 (Technology)
  • DS3(config-if-range)# switchport mode access
  • DS3(config-if-range)# switchport access vlan 10
  • DS3(config-if-range)# exit
  • DS3(config)# interface range fa0/8 - 14
  • DS3(config-if-range)# description Accessport VLAN 20 (Social)
  • DS3(config-if-range)# switchport mode access
  • DS3(config-if-range)# switchport access vlan 20
  • DS3(config-if-range)# exit
  • DS3(config)# interface range fa0/15 - 21
  • DS3(config-if-range)# description Accessport VLAN 30 (Science)
  • DS3(config-if-range)# switchport mode access
  • DS3(config-if-range)# switchport access vlan 30
  • DS3(config-if-range)# exit 
  • DS3(config)# interface range fa0/22 - 24
  • DS3(config-if-range)# description Accessport VLAN 66 (Management)
  • DS3(config-if-range)# switchport mode access
  • DS3(config-if-range)# switchport access vlan 66
  • DS3(config-if-range)# exit
  • Management-SVI - IP-adress för fjärradministration av switchen via VLAN 66.
  • DS3(config)# interface vlan 66
  • DS3(config-if)# description Management SVI
  • DS3(config-if)# ip address 192.168.66.4 255.255.255.248
  • DS3(config-if)# no shutdown
  • DS3(config-if)# exit
  • DS3(config)# ip default-gateway 192.168.66.1
  • DS3(config)# end
  • DS3# write memory
  • Switch> enable
  • Switch# configure terminal
  • Switch(config)# hostname DR1
  • DR1(config)# no ip domain-lookup
  • ! WAN/ISP-konfiguration - Konfigurerar länken mot ISP på G0/1.
  • DR1(config)# interface g0/1
  • DR1(config-if)# description WAN till ISP
  • DR1(config-if)# ip address 123.1.0.2 255.255.255.252
  • DR1(config-if)# no shutdown
  • DR1(config-if)# exit
  • ! Inter-VLAN-routing (Router-on-a-stick) mot DS1
  • DR1(config)# interface g0/0
  • DR1(config-if)# description Trunk till DS1
  • DR1(config-if)# no ip address
  • DR1(config-if)# no shutdown
  • DR1(config-if)# exit
  • Subinterface VLAN 10 – Technology
  • DR1(config)# interface g0/0.10
  • DR1(config-subif)# description Gateway VLAN 10 (Technology)
  • DR1(config-subif)# encapsulation dot1q 10
  • DR1(config-subif)# ip address 192.168.10.1 255.255.255.0
  • DR1(config-subif)# exit
  • ! Subinterface VLAN 20 – Social
  • DR1(config)# interface g0/0.20
  • DR1(config-subif)# description Gateway VLAN 20 (Social)
  • DR1(config-subif)# encapsulation dot1q 20
  • DR1(config-subif)# ip address 192.168.20.1 255.255.255.0
  • DR1(config-subif)# exit
  • ! Subinterface VLAN 30 – Science
  • DR1(config)# interface g0/0.30
  • DR1(config-subif)# description Gateway VLAN 30 (Science)
  • DR1(config-subif)# encapsulation dot1q 30
  • DR1(config-subif)# ip address 192.168.30.1 255.255.255.0
  • DR1(config-subif)# exit
  • Subinterface VLAN 66 – Management
  • ! OBS: /29 används i ditt managementnät (192.168.66.0/29).
  • DR1(config)# interface g0/0.66
  • DR1(config-subif)# description Gateway VLAN 66 (Management)
  • DR1(config-subif)# encapsulation dot1q 66
  • DR1(config-subif)# ip address 192.168.66.1 255.255.255.248
  • DR1(config-subif)# exit
  • DHCP – exkludera reserverade adresser
  • DR1(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.9
  • DR1(config)# ip dhcp excluded-address 192.168.20.1 192.168.20.9
  • DR1(config)# ip dhcp excluded-address 192.168.30.1 192.168.30.9
  • ! DHCP-pool VLAN 10
  • DR1(config)# ip dhcp pool VLAN10
  • DR1(dhcp-config)# network 192.168.10.0 255.255.255.0
  • DR1(dhcp-config)# default-router 192.168.10.1
  • DR1(dhcp-config)# dns-server 4.4.4.4
  • DR1(dhcp-config)# domain-name diginto.se
  • DR1(dhcp-config)# exit
  • ! DHCP-pool VLAN 20
  • DR1(config)# ip dhcp pool VLAN20
  • DR1(dhcp-config)# network 192.168.20.0 255.255.255.0
  • DR1(dhcp-config)# default-router 192.168.20.1
  • DR1(dhcp-config)# dns-server 4.4.4.4
  • DR1(dhcp-config)# domain-name diginto.se
  • DR1(dhcp-config)# exit
  • ! DHCP-pool VLAN 30
  • DR1(config)# ip dhcp pool VLAN30
  • DR1(dhcp-config)# network 192.168.30.0 255.255.255.0
  • DR1(dhcp-config)# default-router 192.168.30.1
  • DR1(dhcp-config)# dns-server 4.4.4.4
  • DR1(dhcp-config)# domain-name diginto.se
  • DR1(dhcp-config)# exit
  • ! Routing – RIP v2
  • DR1(config)# router rip
  • DR1(config-router)# version 2
  • DR1(config-router)# no auto-summary
  • DR1(config-router)# network 192.168.10.0
  • DR1(config-router)# network 192.168.20.0
  • DR1(config-router)# network 192.168.30.0
  • DR1(config-router)# network 192.168.66.0
  • DR1(config-router)# network 123.1.0.0
  • DR1(config-router)# exit
  • DR1(config)# end
  • DR1# write memory
  • Switch> enable
  • Switch# configure terminal
  • Switch(config)# hostname NS1
  • NS1(config)# no ip domain-lookup
  • NS1(config)# service password-encryption
  • ! VTP-konfiguration – NS1 fungerar som VTP-server i ng.se-domänen
  • NS1(config)# vtp mode server
  • NS1(config)# vtp domain ng.se
  • NS1(config)# vtp password ngP@55
  • NS1(config)# vtp version 2
  • VLAN-konfiguration – VLAN skapas här och distribueras via VTP
  • NS1(config)# vlan 50
  • NS1(config-vlan)# name Staff
  • NS1(config-vlan)# exit
  • NS1(config)# vlan 60
  • NS1(config-vlan)# name Teachers
  • NS1(config-vlan)# exit
  • NS1(config)# vlan 70
  • NS1(config-vlan)# name Students
  • NS1(config-vlan)# exit
  • NS1(config)# vlan 99
  • NS1(config-vlan)# name Management
  • NS1(config-vlan)# exit
  • NS1(config)# vlan 888
  • NS1(config-vlan)# name Native
  • NS1(config-vlan)# exit
  • ! Trunk-konfiguration – trunklänkar mot access-switchar och router
  • ! Native VLAN är satt till 888 i ng.se-domänen
  • NS1(config)# interface g1/1
  • NS1(config-if)# description Trunk till NS2
  • NS1(config-if)# switchport mode trunk
  • NS1(config-if)# switchport trunk native vlan 888
  • NS1(config-if)# switchport trunk allowed vlan 50,60,70,99,888
  • NS1(config-if)# exit
  • NS1(config)# interface g2/1
  • NS1(config-if)# description Trunk till NS3
  • NS1(config-if)# switchport mode trunk
  • NS1(config-if)# switchport trunk native vlan 888
  • NS1(config-if)# switchport trunk allowed vlan 50,60,70,99,888
  • NS1(config-if)# exit
  • NS1(config)# interface g0/1
  • NS1(config-if)# description Trunk till NR1 (Inter-VLAN-routing)
  • NS1(config-if)# switchport mode trunk
  • NS1(config-if)# switchport trunk native vlan 888
  • NS1(config-if)# switchport trunk allowed vlan 50,60,70,99,888
  • NS1(config-if)# exit
  • ! Management-SVI – IP-adress för fjärradministration av switchen via VLAN 99
  • NS1(config)# interface vlan 99
  • NS1(config-if)# description Management SVI
  • NS1(config-if)# ip address 172.30.99.2 255.255.255.248
  • NS1(config-if)# no shutdown
  • NS1(config-if)# exit
  • NS1(config)# ip default-gateway 172.30.99.1
  • NS1(config)# end
  • NS1# write memory
  • Switch> enable
  • Switch# configure terminal
  • Switch(config)# hostname NS2
  • NS2(config)# no ip domain-lookup
  • NS2(config)# service password-encryption
  • ! VTP-konfiguration
  • ! NS2 fungerar som VTP-klient och tar emot VLAN-information från NS1.
  • NS2(config)# vtp mode client
  • NS2(config)# vtp domain ng.se
  • NS2(config)# vtp password ngP@55
  • NS2(config)# vtp version 2
  • ! Trunk-konfiguration
  • ! Trunk mot NS1. Native VLAN är satt till 888 i ng.se-domänen.
  • NS2(config)# interface g0/1
  • NS2(config-if)# description Trunk till NS1
  • NS2(config-if)# switchport mode trunk
  • NS2(config-if)# switchport trunk native vlan 888
  • NS2(config-if)# switchport trunk allowed vlan 50,60,70,99,888
  • NS2(config-if)# exit
  • ! Accessport-konfiguration
  • ! VLAN 50 – Staff
  • NS2(config)# interface range fa0/1 - 7
  • NS2(config-if-range)# description Accessport VLAN 50 (Staff)
  • NS2(config-if-range)# switchport mode access
  • NS2(config-if-range)# switchport access vlan 50
  • NS2(config-if-range)# exit
  • ! VLAN 60 – Teachers
  • NS2(config)# interface range fa0/8 - 14
  • NS2(config-if-range)# description Accessport VLAN 60 (Teachers)
  • NS2(config-if-range)# switchport mode access
  • NS2(config-if-range)# switchport access vlan 60
  • NS2(config-if-range)# exit
  • ! VLAN 70 – Students
  • NS2(config)# interface range fa0/15 - 21
  • NS2(config-if-range)# description Accessport VLAN 70 (Students)
  • NS2(config-if-range)# switchport mode access
  • NS2(config-if-range)# switchport access vlan 70
  • NS2(config-if-range)# exit
  • ! VLAN 99 – Management
  • NS2(config)# interface range fa0/22 - 24
  • NS2(config-if-range)# description Accessport VLAN 99 (Management)
  • NS2(config-if-range)# switchport mode access
  • NS2(config-if-range)# switchport access vlan 99
  • NS2(config-if-range)# exit
  • ! Management-SVI - IP-adress för fjärradministration av switchen via VLAN 99 (172.30.99.0/29).
  • NS2(config)# interface vlan 99
  • NS2(config-if)# description Management SVI
  • NS2(config-if)# ip address 172.30.99.3 255.255.255.248
  • NS2(config-if)# no shutdown
  • NS2(config-if)# exit
  • NS2(config)# ip default-gateway 172.30.99.1
  • NS2(config)# end
  • NS2# write memory
  • Switch> enable
  • Switch# configure terminal
  • Switch(config)# hostname NS3
  • NS3(config)# no ip domain-lookup
  • NS3(config)# service password-encryption
  • ! VTP-konfiguration
  • ! NS3 fungerar som VTP-klient och tar emot VLAN-information från NS1.
  • NS3(config)# vtp mode client
  • NS3(config)# vtp domain ng.se
  • NS3(config)# vtp password ngP@55
  • NS3(config)# vtp version 2
  • ! Trunk-konfiguration
  • ! Trunk mot NS1. Native VLAN är satt till 888 i ng.se-domänen.
  • NS3(config)# interface g0/1
  • NS3(config-if)# description Trunk till NS1
  • NS3(config-if)# switchport mode trunk
  • NS3(config-if)# switchport trunk native vlan 888
  • NS3(config-if)# switchport trunk allowed vlan 50,60,70,99,888
  • NS3(config-if)# exit
  • ! Accessport-konfiguration
  • ! VLAN 50 – Staff
  • NS3(config)# interface range fa0/1 - 7
  • NS3(config-if-range)# description Accessport VLAN 50 (Staff)
  • NS3(config-if-range)# switchport mode access
  • NS3(config-if-range)# switchport access vlan 50
  • NS3(config-if-range)# exit
  • ! VLAN 60 – Teachers
  • NS3(config)# interface range fa0/8 - 14
  • NS3(config-if-range)# description Accessport VLAN 60 (Teachers)
  • NS3(config-if-range)# switchport mode access
  • NS3(config-if-range)# switchport access vlan 60
  • NS3(config-if-range)# exit
  • ! VLAN 70 – Students
  • NS3(config)# interface range fa0/15 - 21
  • NS3(config-if-range)# description Accessport VLAN 70 (Students)
  • NS3(config-if-range)# switchport mode access
  • NS3(config-if-range)# switchport access vlan 70
  • NS3(config-if-range)# exit
  • ! VLAN 99 – Management
  • NS3(config)# interface range fa0/22 - 24
  • NS3(config-if-range)# description Accessport VLAN 99 (Management)
  • NS3(config-if-range)# switchport mode access
  • NS3(config-if-range)# switchport access vlan 99
  • NS3(config-if-range)# exit
  • ! Management-SVI - IP-adress för fjärradministration av switchen via VLAN 99.
  • NS3(config)# interface vlan 99
  • NS3(config-if)# description Management SVI
  • NS3(config-if)# ip address 172.30.99.4 255.255.255.248
  • NS3(config-if)# no shutdown
  • NS3(config-if)# exit
  • NS3(config)# ip default-gateway 172.30.99.1
  • NS3(config)# end
  • NS3# write memory
  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname NR1
  • NR1(config)# no ip domain-lookup
  • ! WAN/ISP-konfiguration - Konfigurerar länken mot ISP på G0/1.
  • NR1(config)# interface g0/1
  • NR1(config-if)# description WAN till ISP
  • NR1(config-if)# ip address 125.2.0.2 255.255.255.252
  • NR1(config-if)# no shutdown
  • NR1(config-if)# exit
  • ! Inter-VLAN-routing (Router-on-a-stick) mot NS1
  • NR1(config)# interface g0/0
  • NR1(config-if)# description Trunk till NS1
  • NR1(config-if)# no ip address
  • NR1(config-if)# no shutdown
  • NR1(config-if)# exit
  • ! Subinterface VLAN 50 – Staff
  • NR1(config)# interface g0/0.50
  • NR1(config-subif)# description Gateway VLAN 50 (Staff)
  • NR1(config-subif)# encapsulation dot1q 50
  • NR1(config-subif)# ip address 172.30.50.1 255.255.255.0
  • NR1(config-subif)# exit
  • ! Subinterface VLAN 60 – Teachers
  • NR1(config)# interface g0/0.60
  • NR1(config-subif)# description Gateway VLAN 60 (Teachers)
  • NR1(config-subif)# encapsulation dot1q 60
  • NR1(config-subif)# ip address 172.30.60.1 255.255.255.0
  • NR1(config-subif)# exit
  • ! Subinterface VLAN 70 – Students
  • NR1(config)# interface g0/0.70
  • NR1(config-subif)# description Gateway VLAN 70 (Students)
  • NR1(config-subif)# encapsulation dot1q 70
  • NR1(config-subif)# ip address 172.30.70.1 255.255.255.0
  • NR1(config-subif)# exit
  • ! Subinterface VLAN 99 – Management
  • NR1(config)# interface g0/0.99
  • NR1(config-subif)# description Gateway VLAN 99 (Management)
  • NR1(config-subif)# encapsulation dot1q 99
  • NR1(config-subif)# ip address 172.30.99.1 255.255.255.248
  • NR1(config-subif)# exit
  • ! DHCP – exkludera reserverade adresser
  • NR1(config)# ip dhcp excluded-address 172.30.50.1 172.30.50.9
  • NR1(config)# ip dhcp excluded-address 172.30.60.1 172.30.60.9
  • NR1(config)# ip dhcp excluded-address 172.30.70.1 172.30.70.9
  • NR1(config)# ip dhcp excluded-address 172.30.99.1 172.30.99.4
  • ! DHCP-pool VLAN 50
  • NR1(config)# ip dhcp pool VLAN50
  • NR1(dhcp-config)# network 172.30.50.0 255.255.255.0
  • NR1(dhcp-config)# default-router 172.30.50.1
  • NR1(dhcp-config)# dns-server 5.5.5.5
  • NR1(dhcp-config)# domain-name ng.se
  • NR1(dhcp-config)# exit
  • ! DHCP-pool VLAN 60
  • NR1(config)# ip dhcp pool VLAN60
  • NR1(dhcp-config)# network 172.30.60.0 255.255.255.0
  • NR1(dhcp-config)# default-router 172.30.60.1
  • NR1(dhcp-config)# dns-server 5.5.5.5
  • NR1(dhcp-config)# domain-name ng.se
  • NR1(dhcp-config)# exit
  • ! DHCP-pool VLAN 70
  • NR1(config)# ip dhcp pool VLAN70
  • NR1(dhcp-config)# network 172.30.70.0 255.255.255.0
  • NR1(dhcp-config)# default-router 172.30.70.1
  • NR1(dhcp-config)# dns-server 5.5.5.5
  • NR1(dhcp-config)# domain-name ng.se
  • NR1(dhcp-config)# exit
  • ! Routing – RIP v2
  • NR1(config)# router rip
  • NR1(config-router)# version 2
  • NR1(config-router)# no auto-summary
  • NR1(config-router)# network 172.30.50.0
  • NR1(config-router)# network 172.30.60.0
  • NR1(config-router)# network 172.30.70.0
  • NR1(config-router)# network 172.30.99.0
  • NR1(config-router)# network 125.2.0.0
  • NR1(config-router)# exit
  • NR1(config)# end
  • NR1# write memory
  • Switch> enable
  • Switch# configure terminal
  • Switch(config)# hostname IS1
  • IS1(config)# no ip domain-lookup
  • IS1(config)# service password-encryption
  • ! VLAN-konfiguration
  • IS1(config)# vlan 4
  • IS1(config-vlan)# name Digweb
  • IS1(config-vlan)# exit
  • IS1(config)# vlan 5
  • IS1(config-vlan)# name Ngweb
  • IS1(config-vlan)# exit
  • IS1(config)# vlan 7
  • IS1(config-vlan)# name Parking
  • IS1(config-vlan)# exit
  • IS1(config)# vlan 9
  • IS1(config-vlan)# name Management
  • IS1(config-vlan)# exit
  • IS1(config)# vlan 777
  • IS1(config-vlan)# name Native
  • IS1(config-vlan)# exit
  • ! Accessportar – tilldelning av VLAN till serverportar
  • IS1(config)# interface fa0/10
  • IS1(config-if)# description Webserver VLAN 4 (Digweb)
  • IS1(config-if)# switchport mode access
  • IS1(config-if)# switchport access vlan 4
  • IS1(config-if)# no shutdown
  • IS1(config-if)# exit
  • IS1(config)# interface fa0/20
  • IS1(config-if)# description Webserver VLAN 5 (Ngweb)
  • IS1(config-if)# switchport mode access
  • IS1(config-if)# switchport access vlan 5
  • IS1(config-if)# no shutdown
  • IS1(config-if)# exit
  • ! Managementportar – portar för lokal administration
  • IS1(config)# interface range fa0/21 - 24
  • IS1(config-if-range)# description Management-accessport (VLAN 9)
  • IS1(config-if-range)# switchport mode access
  • IS1(config-if-range)# switchport access vlan 9
  • IS1(config-if-range)# no shutdown
  • IS1(config-if-range)# exit
  • ! Trunk-konfiguration – uplink till ISP-router
  • ! Trunken bär VLAN 4, 5, 9 och 777 mellan IS1 och ISP.
  • IS1(config)# interface g0/1
  • IS1(config-if)# description Trunk till ISP (Router-on-a-stick)
  • IS1(config-if)# switchport mode trunk
  • IS1(config-if)# switchport trunk native vlan 777
  • IS1(config-if)# switchport trunk allowed vlan 4,5,9,777
  • IS1(config-if)# no shutdown
  • IS1(config-if)# exit
  • ! Säkerhet – stäng av oanvända portar
  • IS1(config)# interface range fa0/1 - 9, fa0/11 - 19, g0/2
    IS1(config-if-range)# description Oanvänd port (Parking VLAN + shutdown)
    IS1(config-if-range)# switchport mode access
    IS1(config-if-range)# switchport access vlan 7
    IS1(config-if-range)# shutdown
    IS1(config-if-range)# exit
  • ! Management-SVI – IP-adress för fjärradministration av switchen
  • IS1(config)# interface vlan 9
  • IS1(config-if)# description Management SVI
  • IS1(config-if)# ip address 9.9.9.2 255.255.255.248
  • IS1(config-if)# no shutdown
  • IS1(config-if)# exit
  • IS1(config)# ip default-gateway 9.9.9.1
  • IS1(config)# end
  • IS1# write memory
  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname ISP
  • ISP(config)# no ip domain-lookup
  • ! Router-on-a-stick mot IS1 (Servers LAN)
  • ! G0/0 är trunk mot IS1. Ingen IP på huvudinterfacet – IP ligger på subinterfaces.
  • ISP(config)# interface g0/0
  • ISP(config-if)# description Trunk till IS1 (Servers LAN)
  • ISP(config-if)# no ip address
  • ISP(config-if)# no shutdown
  • ISP(config-if)# exit
  • ! Subinterface VLAN 4 – diginto.se (DNS/Webb) 4.4.4.0/29
  • ISP(config)# interface g0/0.4
  • ISP(config-subif)# description VLAN 4 (Digweb/DNS)
  • ISP(config-subif)# encapsulation dot1q 4
  • ISP(config-subif)# ip address 4.4.4.1 255.255.255.248
  • ISP(config-subif)# exit
  • ! Subinterface VLAN 5 – ng.se (DNS/Webb) 5.5.5.0/29
  • ISP(config)# interface g0/0.5
  • ISP(config-subif)# description VLAN 5 (Ngweb/DNS)
  • ISP(config-subif)# encapsulation dot1q 5
  • ISP(config-subif)# ip address 5.5.5.1 255.255.255.248
  • ISP(config-subif)# exit
  • ! Subinterface VLAN 9 – Management 9.9.9.0/29
  • ISP(config)# interface g0/0.9
  • ISP(config-subif)# description VLAN 9 (Management)
  • ISP(config-subif)# encapsulation dot1q 9
  • ISP(config-subif)# ip address 9.9.9.1 255.255.255.248
  • ISP(config-subif)# exit
  • ! Punkt-till-punkt-länkar mot kundroutrar
  • ! ISP ↔ DR1 (diginto.se) 123.1.0.0/30
  • ISP(config)# interface g0/1
  • ISP(config-if)# description WAN till DR1 (diginto.se)
  • ISP(config-if)# ip address 123.1.0.1 255.255.255.252
  • ISP(config-if)# no shutdown
  • ISP(config-if)# exit
  • ! ISP ↔ NR1 (ng.se) 125.2.0.0/30
  • ISP(config)# interface g0/2
  • ISP(config-if)# description WAN till NR1 (ng.se)
  • ISP(config-if)# ip address 125.2.0.1 255.255.255.252
  • ISP(config-if)# no shutdown
  • ISP(config-if)# exit
  • ! Routing – RIP v2
  • ! Annonserar alla direktanslutna nät så att DR1 och NR1 lär sig vägar via ISP.
  • ISP(config)# router rip
  • ISP(config-router)# version 2
  • ISP(config-router)# no auto-summary
  • ISP(config-router)# network 123.1.0.0
  • ISP(config-router)# network 125.2.0.0
  • ISP(config-router)# network 4.4.4.0
  • ISP(config-router)# network 5.5.5.0
  • ISP(config-router)# network 9.9.9.0
  • ISP(config-router)# exit
  • ISP(config)# end
  • ISP# write memory