Thursday, December 2, 2010

configure VLANs in aCisco 2950 switch





Cisco conguration showing the existing ports connected to VLAN 1. Note: VLAN1 is the Default VLAN, which means, even before your configure a switch, it exists by default. 

Configuration commands for a cisco switch.














A Screenshot showing how to configure VLAN. 


What is the Difference between "acess mode" and "trunk mode"? Have a look at the above configuration example. In this Configuration, “access mode” is used. Switch ports run in either access or trunk mode. In access mode, the interface belongs to one and only one VLAN. Normally a switch port in access mode attaches to an end user device or a server. The frames transmitted on an access link look like any other Ethernet frame.

“Trunks” on the other hand, multiplex traffic for multiple VLANs over the same physical link. Trunk links usually interconnect switches. Trunks encapsulate Ethernet frames with other information to support multiplexing.


How to configure the trunk port? 

SwitchA(config)#interface 0/1
SwitchA(config-if)#switchport trunk encapsulation dot1q 
SwitchA(config-if)#switchport trunk allowed vlan 1,2,4 
SwitchA(config-if)#switchport mode trunk
 
How to confgure the Router?
Router(config-if)#no ip address (remove ip address in this interface)
Router(config-if)#no shutdown
Note: We are going to give different ip addresses to each sub interfaces,that is why we removed the above ip address.
 
Router(config-if)#int e0/0.3 (where 3 refers to vlan3)
Note: Instead of 3, you can use any number. giving the vlan id is more convenient.
Router(config-subif)#encapsulation dot1q 3
Note : The different encapsulation methods are dot1q, isl; here 3 refers to vlan id
Router(config-subif)#ip address 10.10.1.1 255.255.255.0
Note: Assign ip address from 10.10.1.2 to 10.10.1.254 to the computers connected to this VLAN. These computers should be configured with the default gateway: 10.10.1.1
Note: Configure the other sub interfaces in the same manner.
Note: Configure ACL to control the traffic between VLANs.

No comments: