I företagsnät separeras rösttrafik från datatrafik med Voice VLAN, vilket möjliggör korrekt prioritering, enklare felsökning och tydlig trafikisolering. Voice VLAN används ofta tillsammans med IP-telefoner som delar accessport med en dator.
I denna laboration används Call Manager Express (CME) för lokal samtalshantering. Samtal mellan sajter hanteras via dial-peers över ett routat WAN, där OSPF används för att sprida nätverksinformation mellan
Laboration – övergripande förklaring
Laborationen är uppbyggd i två separata sajter som vardera representerar ett mindre kontorsnät. Varje sajt innehåller:
- Ett data-VLAN
- Ett voice-VLAN
- En router som agerar default gateway, DHCP-server och CME
- En switch som hanterar Voice VLAN på accessportar
Lokala telefonsamtal hanteras helt inom respektive router via CME. När ett nummer rings som inte finns lokalt, används dial-peers för att vidarebefordra samtalet till den andra sitens CME-instans. På så sätt illustrerar laborationen både lokal VoIP-funktionalitet och inter-site VoIP via routing.

Router-on-a-Stick och VLAN-hantering
Varje router är ansluten till sin switch via en trunkport och använder subinterfaces för att hantera flera VLAN över samma fysiska interface. Ett subinterface används för data-VLAN och ett för voice-VLAN. Varje subinterface har en IP-adress som fungerar som default gateway för respektive VLAN.
- Sajt: DIGINTO
- VLAN 10 DATADI, 192.168.10.0/24
- VLAN 20 VOICEDI, 192.168.20.0/24
- Sajt: NG
- VLAN 30 DATANG, 192.168.30.0/24
- VLAN 20 VOICENG, 192.168.40.0/24
Denna lösning gör att routern kan routa mellan VLAN samtidigt som Voice VLAN hålls logiskt separerat från datatrafik.
DHCP för data och voice
Routern fungerar som DHCP-server för båda VLAN. Två separata DHCP-pooler används:
- En pool för data-VLAN, som tilldelar IP-adresser till datorer
- En pool för voice-VLAN, som tilldelar IP-adresser till IP-telefoner
I voice-poolen används DHCP option 150, som talar om för IP-telefonen var TFTP- och CME-servern finns. Detta är avgörande för att telefonen ska kunna ladda sin konfiguration och registrera sig korrekt.
Call Manager Express (CME)
CME aktiveras med kommandot telephony-service. Här definieras hur många telefoner och anknytningar routern kan hantera. Parametern ip source-address anger vilken IP-adress routern använder som samtalskontroll- och TFTP-adress, vilket i denna laboration är adressen i voice-VLAN.
När IP-telefoner startar:
- De får IP-adress via DHCP i voice-VLAN
- De får information om CME via option 150
- De laddar konfigurationsfiler via TFTP
- De registrerar sig mot CME
ephone-dn – lokala anknytningar
Varje anknytning (extension) definieras med ephone-dn. Dessa nummer representerar de lokala telefonerna på respektive sajt. Så länge ett uppringt nummer matchar en lokal ephone-dn, kopplas samtalet helt internt och lämnar aldrig routern.
Detta förklarar varför lokala samtal fungerar även innan WAN och dial-peers är konfigurerade.
WAN-länk och OSPF
Routrarna är direkt sammankopplade via ett WAN-nät. Detta nät används enbart för routing mellan sajterna. OSPF används för att dynamiskt sprida:
- Data-VLAN-nät
- Voice-VLAN-nät
- WAN-nätet
Genom OSPF säkerställs att varje router känner till den andra sajtens voice-adresser, vilket är en förutsättning för att VoIP-samtal mellan sajter ska fungera.
Dial-peers – samtal mellan siter
Dial-peers används för att avgöra vad som ska hända när ett nummer inte finns lokalt. Varje router har en utgående dial-peer som matchar den andra sitens nummerserie.
När ett externt nummer rings sker följande:
- CME kontrollerar om numret är lokalt
- Ingen lokal match hittas
- Destination-pattern i dial-peer matchar numret
- Samtalet skickas till den andra routerns CME-adress
I denna laboration används exakta fyrsiffriga mönster (1… och 2…), vilket visat sig vara mest stabilt i Packet Tracer.
Konfigurationer
SNG konfiguration
- Switch> enable
- Switch# configure terminal
- Switch(config)# hostname SNG
- SNG(config)# no ip domain-lookup
- ! ====== VLAN ======
- SNG(config)# vlan 30
- SNG(config-vlan)# name DATA_S2
- SNG(config-vlan)# exit
- SNG(config)# vlan 40
- SNG(config-vlan)# name VOICE_S2
- SNG(config-vlan)# exit
- ! ====== IP Phones + PCs (Fa0/1-4) ======
- SNG(config)# interface range fa0/1 - 4
- SNG(config-if-range)# switchport mode access
- SNG(config-if-range)# switchport access vlan 30
- SNG(config-if-range)# switchport voice vlan 40
- SNG(config-if-range)# spanning-tree portfast
- SNG(config-if-range)# spanning-tree bpduguard enable
- SNG(config-if-range)# exit
- ! ====== Trunk till R2 (Fa0/24 -> R2 Fa0/0) ======
- SNG(config)# interface fa0/24
- SNG(config-if)# switchport mode trunk
- SNG(config-if)# switchport trunk allowed vlan 30,40
- SNG(config-if)# exit
- SNG(config)# end
- SNG# copy running-config startup-config
RDI konfiguration
- Router> enable
- Router# configure terminal
- Router(config)# hostname RDI
- RDI(config)# no ip domain-lookup
- ! ====== LAN mot S1: Router-on-a-stick ======
- RDI(config)# interface fa0/0
- RDI(config-if)# no shutdown
- RDI(config-if)# exit
- RDI(config)# interface fa0/0.10
- RDI(config-subif)# encapsulation dot1Q 10
- RDI(config-subif)# ip address 192.168.10.1 255.255.255.0
- RDI(config-subif)# exit
- RDI(config)# interface fa0/0.20
- RDI(config-subif)# encapsulation dot1Q 20
- RDI(config-subif)# ip address 192.168.20.1 255.255.255.0
- RDI(config-subif)# exit
- ! ====== DHCP ======
- RDI(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.20
- RDI(config)# ip dhcp excluded-address 192.168.20.1 192.168.20.20
- RDI(config)# ip dhcp pool DATADI
- RDI(dhcp-config)# network 192.168.10.0 255.255.255.0
- RDI(dhcp-config)# default-router 192.168.10.1
- RDI(dhcp-config)# dns-server 8.8.8.8
- RDI(dhcp-config)# domain-name diginto.se
- RDI(dhcp-config)# exit
- RDI(config)# ip dhcp pool VOICEDI
- RDI(dhcp-config)# network 192.168.20.0 255.255.255.0
- RDI(dhcp-config)# default-router 192.168.20.1
- RDI(dhcp-config)# option 150 ip 192.168.20.1
- RDI(dhcp-config)# exit
- ! ====== CME ======
- RDI(config)# telephony-service
- RDI(config-telephony)# max-ephones 10
- RDI(config-telephony)# max-dn 10
- RDI(config-telephony)# ip source-address 192.168.20.1 port 2000
- RDI(config-telephony)# auto assign 1 to 4
- RDI(config-telephony)# create cnf-files
- RDI(config-telephony)# exit
- ! ====== Extensions 1001-1004 ======
- RDI(config)# ephone-dn 1
- RDI(config-ephone)# number 1001
- RDI(config-ephone)# exit
- RDI(config)# ephone-dn 2
- RDI(config-ephone)# number 1002
- RDI(config-ephone)# exit
- RDI(config)# ephone-dn 3
- RDI(config-ephone)# number 1003
- RDI(config-ephone)# exit
- RDI(config)# ephone-dn 4
- RDI(config-ephone)# number 1004
- RDI(config-ephone)# exit
- ! (Bra i PT) generera om telefonfiler efter DN
- RDI(config)# telephony-service
- RDI(config-telephony)# create cnf-files
- RDI(config-telephony)# exit
- ! ====== WAN mot R2 (direkt länk) ======
- RDI(config)# interface fa0/1
- RDI(config-if)# ip address 10.0.12.1 255.255.255.252
- RDI(config-if)# no shutdown
- exit
- ! ====== OSPF (process 110) ======
- RDI(config)# router ospf 110
- RDI(config-router)# router-id 1.1.1.1
- RDI(config-router)# network 10.0.12.0 0.0.0.3 area 0
- RDI(config-router)# network 192.168.10.0 0.0.0.255 area 0
- RDI(config-router)# network 192.168.20.0 0.0.0.255 area 0
- RDI(config-router)# exit
- ! ====== Dial-peer till Site 2 ======
- RDI(config)# dial-peer voice 200 voip
- RDI(config-dial-peer)# destination-pattern 2...
- RDI(config-dial-peer)# session target ipv4:192.168.40.1
- RDI(config-dial-peer)# exit
- RDI(config)# end
- RDI# copy running-config startup-config
SNG konfiguration
- Switch> enable
- Switch# configure terminal
- Switch(config)# hostname SNG
- SNG(config)# no ip domain-lookup
- ! ====== VLAN ======
- SNG(config)# vlan 30
- SNG(config-vlan)# name DATA_S2
- SNG(config-vlan)# exit
- SNG(config)# vlan 40
- SNG(config-vlan)# name VOICE_S2
- SNG(config-vlan)# exit
- ! ====== IP Phones + PCs (Fa0/1-4) ======
- SNG(config)# interface range fa0/1 - 4
- SNG(config-if-range)# switchport mode access
- SNG(config-if-range)# switchport access vlan 30
- SNG(config-if-range)# switchport voice vlan 40
- SNG(config-if-range)# spanning-tree portfast
- SNG(config-if-range)# spanning-tree bpduguard enable
- SNG(config-if-range)# exit
- ! ====== Trunk till R2 (Fa0/24 -> R2 Fa0/0) ======
- SNG(config)# interface fa0/24
- SNG(config-if)# switchport mode trunk
- SNG(config-if)# switchport trunk allowed vlan 30,40
- SNG(config-if)# exit
- SNG(config)# end
- SNG# copy running-config startup-config
RNG konfiguration
- Router> enable
- Router#
- Router(config)# hostname RNG
- RNG(config)# no ip domain-lookup
- ! ====== LAN mot S2: Router-on-a-stick ======
- RNG(config)# interface fa0/0
- RNG(config-if)# no shutdown
- RNG(config-if)# exit
- RNG(config)# interface fa0/0.30
- RNG(config-subif)# encapsulation dot1Q 30
- RNG(config-subif)# ip address 192.168.30.1 255.255.255.0
- RNG(config-subif)# exit
- RNG(config)# interface fa0/0.40
- RNG(config-subif)# encapsulation dot1Q 40
- RNG(config-subif)# ip address 192.168.40.1 255.255.255.0
- RNG(config-subif)# exit
- ! ====== DHCP ======
- RNG(config)# ip dhcp excluded-address 192.168.30.1 192.168.30.20
- RNG(config)# ip dhcp excluded-address 192.168.40.1 192.168.40.20
- RNG(config)# ip dhcp pool DATANG
- RNG(dhcp-config)# network 192.168.30.0 255.255.255.0
- RNG(dhcp-config)# default-router 192.168.30.1
- RNG(dhcp-config)# dns-server 8.8.8.8
- RNG(dhcp-config)# domain-name ng.se
- RNG(dhcp-config)# exit
- RNG(config)# ip dhcp pool VOICENG
- RNG(dhcp-config)# network 192.168.40.0 255.255.255.0
- RNG(dhcp-config)# default-router 192.168.40.1
- RNG(dhcp-config)# option 150 ip 192.168.40.1
- RNG(dhcp-config)# exit
- ! ====== CME ======
- RNG(config)# telephony-service
- RNG(config-telephony)# max-ephones 10
- RNG(config-telephony)# max-dn 10
- RNG(config-telephony)# ip source-address 192.168.40.1 port 2000
- RNG(config-telephony)# auto assign 1 to 4
- RNG(config-telephony)# create cnf-files
- RNG(config-telephony)# exit
- ! ====== Extensions 2001-2004 ======
- RNG(config)# ephone-dn 1
- RNG(config-ephone)# number 2001
- RNG(config-ephone)# exit
- RNG(config)# ephone-dn 2
- RNG(config-ephone)# number 2002
- RNG(config-ephone)# exit
- RNG(config)# ephone-dn 3
- RNG(config-ephone)# number 2003
- RNG(config-ephone)# exit
- RNG(config)# ephone-dn 4
- RNG(config-ephone)# number 2004
- RNG(config-ephone)# exit
- ! (Bra i PT) generera om telefonfiler efter DN
- RNG(config)# telephony-service
- RNG(config-telephony)# create cnf-files
- RNG(config-telephony)# exit
- ! ====== WAN mot R1 (direkt länk) ======
- RNG(config)# interface fa0/1
- RNG(config-if)# ip address 10.0.12.2 255.255.255.252
- RNG(config-if)# no shutdown
- RNG(config-if)# exit
- ! ====== OSPF (process 110) ======
- RNG(config)# router ospf 110
- RNG(config-router)# router-id 2.2.2.2
- RNG(config-router)# network 10.0.12.0 0.0.0.3 area 0
- RNG(config-router)# network 192.168.30.0 0.0.0.255 area 0
- RNG(config-router)# network 192.168.40.0 0.0.0.255 area 0
- RNG(config-router)# exit
- ! ====== Dial-peer till Site 1 ======
- RNG(config)# dial-peer voice 100 voip
- RNG(config-dial-peer)# destination-pattern 1...
- RNG(config-dial-peer)# session target ipv4:192.168.20.1
- RNG(config-dial-peer)# exit
- RNG(config)# end
- RNG# copy running-config startup-config
Sammanfattning
Denna laboration visar hur Voice VLAN används i praktiken för att stödja IP-telefoni i ett routat nätverk. Genom att kombinera VLAN-separering, DHCP option 150, CME, OSPF och dial-peers skapas en realistisk enterprise-liknande VoIP-miljö där både lokala och inter-site-samtal fungerar korrekt.