CCNP (switch) – How to configure VLANs

How to configure VLANs?

Suppose you have two members of IT department connected with fastethernet 0/3 and 0/4 ports of switch and you want to create VLAN 2 for IT department. And you have two members for HR department connected with fastethernet 0/7 and 0/9 and want to create VLAN 3 for HR department.

Switch#config

Configuring from terminal, memory, or network [terminal]?

Enter configuration commands, one per line. End with CNTL/Z.

(Creating VLAN 2)

Switch(config)#vlan 2

Switch(config-vlan)#name IT

Switch(config-vlan)#exit

(Assigning membership of VLAN 2 to 0/3 and 0/4)

Switch(config)#interface fastEthernet 0/3

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 2

Switch(config-if)#exit

Switch(config)#interface fastEthernet 0/4

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 2

Switch(config-if)#exit

(Creating VLAN 3 for HR department)

Switch(config)#vlan 3

Switch(config-vlan)#name HR

Switch(config-vlan)#exit

(Assigning membership)

Switch(config)#int fa 0/7

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 3

Switch(config-if)#exit

Switch(config)#int fa 0/9

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 3

Switch(config-if)#exit

Switch(config)#exit

Switch#

%SYS-5-CONFIG_I: Configured from console by console

(To save configuration)

Switch#wr

Building configuration…

[OK]

(To check VLANs and port’s membership with these VLANs)

Switch#show vlan

VLAN Name                             Status   Ports

—- ——————————– ——— ——————————-

1   default                         active   Fa0/1, Fa0/2, Fa0/5, Fa0/6

Fa0/8, Fa0/10, Fa0/11, Fa0/12

Fa0/13, Fa0/14, Fa0/15, Fa0/16

Fa0/17, Fa0/18, Fa0/19, Fa0/20

Fa0/21, Fa0/22, Fa0/23, Fa0/24

Gig1/1, Gig1/2

2   IT                               active   Fa0/3, Fa0/4

3   HR                               active   Fa0/7, Fa0/9

Now you have to create VLAN 2 for IT department and VLAN 3 for HR on every switch in company. Now, if you create any other VLAN for IT department on another switch, they will not be able to connect with each other.

Related Posts