Cisco Switch Voice and Data VLAN
Creating VLAN's
Voice VLAN
Switch#conf t
Switch(config)#vlan <VLAN ID>
Switch(config-vlan)#name Voice - description of the VLAN
Similarly for the Data VLAN
Creating VLAN interfaces (SVI's) and assigning IP address to them:
Switch#conf t
Switch(config)#interface vlan <VLAN ID>
Switch(config-if)#ip address <X.X.X.X> <X.X.X.X> - IP address Subnet Mask
(The ip address should be one of the useable IP addresses of the phone or data subnet)
Similarly for the Data VLAN
Interface configuration - Data/Voice
Switch#conf t
Switch(config)#interface GigabitEthernet <interface ID>
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan <VLAN ID> - data VLAN in case of PC
or
Switch(config-if)#switchport voice vlan <VLAN ID> - Voice VLAN in case of phone
If QOS is to be applied
Switch(config)#mls qos - Enabline QOS globally on the switch
Switch(config)#interface GigabitEthernet <interface ID>
Switch(config-if)#auto qos voip trust
Case 2: PC's connected via switchport behind the IP phone.
Creating VLAN's
Voice VLAN
Switch#conf t
Switch(config)#vlan <VLAN ID>
Switch(config-vlan)#name Voice - description of the VLAN
Similarly for the Data VLAN
Creating VLAN interfaces (SVI's) and assigning IP address to them:
Switch#conf t
Switch(config)#interface vlan <VLAN ID>
Switch(config-if)#ip address <X.X.X.X> <X.X.X.X> - IP address Subnet Mask
(The ip address should be one of the useable IP addresses of the phone or data subnet)
Similarly for the Data VLAN
Interface configuration - Data/Voice
Switch#conf t
Switch(config)#interface GigabitEthernet <interface ID>
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk native vlan <VLAN ID> - Data VLAN
Switch(config-if)#switchport access vlan <VLAN ID> - Voice VLAN
OR
Switch#conf t
Switch(config)#interface GigabitEthernet <interface ID>
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode access
Switch(config-if)#switchport voice vlan <Voice VLAN ID>
Switch(config-if)#switchport access vlan <VLAN ID>
* With newer IOS it is not required that a switchport connecting a phone piggybacking a PC to be configured as a trunk specifically. Please see the secondary configuration above.
If QOS is to be applied
Switch(config)#mls qos - Enabline QOS globally on the switch
Switch(config)#interface GigabitEthernet <interface ID>
Switch(config-if)#auto qos voip trust
Or
Switch(config-if)#auto qos voip trust cisco-phone (specifically for Cisco IP phones)
Note: The above mentioned commands are version specific, however are same or similar in most of the cases.