Monday, October 12, 2009

VLAN



VLAN


Learn How to configure Cisco Routers

How to configure Router on a Stick aka 802.1q This is a Cisco Web Blog that will help you learn how to Design, Configure and Manage a Cisco router.

The first technology that we are going to try and master will be VLAN.

I guess the best way to start learning about VLAN is from configuring Router on a Stick.

Before you can configure Router on a Stick you need to know what a VLAN is

What is VLAN ?

What is Vlan and what does it mean to a non technical person ?. VLAN stands for Virtual Local Area Network. It's a way of virtually separating a switch physical ports into different Logical Networks an each Nework behaving as if they were configured on a different Logical Switch.

The diagram above shows 2 VLANS configured on a switch connected to a router. This is known as Router on a Stick. This Layer 2 Cisco switch carries two VLANs (VLAN 10 – RED and VLAN 20 – GREEN) with two hosts connected on them as shown on the diagram above. The first host belongs to Network 10.10.10.0/24 (VLAN10) and the second one to 20.20.20.0/24 (VLAN20). By default, if the switch is just a normal Layer 2 switch the two hosts can not communicate between them because they belong to different VLANs and there is no routing between the 2 VLANS.Howevere, if we want to provide network connectivity between the two VLANs we need to have a Layer 3 device somewhere in the network. We can either do this with a layer 3 switch or a router. In this example I will use a router to provide Layer 3 connectivity as shown in our diagram.

The router uses just a single interface connected to a trunk port on the switch. The Router interface can be divided into two subinterfaces, with each subinterface belonging to the appropriate VLAN. The switch port connected to the router must be a trunk in order to be able to carry both VLANs towards the router port. Lets see the configuration below:

SWITCH CONFIGURATION

(config)# vlan database
(config-vlan)# vlan 10 name RED
(config-vlan)# vlan 20 name GREEN
(config-vlan)# exit
(config)# interface FastEthernet1/0/1
(config-if)# description trunk-to-router-on-a-stick
(config-if)# switchport trunk encapsulation dot1q
(config-if)# switchport mode trunk
(config-if)# exit
(config)# interface FastEthernet1/0/2
(config-if)# description connection-to-RED-VLAN
(config-if)# switchport mode access
(config-if)# switchport access vlan 10
(config-if)# exit
(config)# interface FastEthernet1/0/3
(config-if)# description connection-to-GREEN-VLAN
(config-if)# switchport mode access
(config-if)# switchport access vlan 20
(config-if)# exit
(config)# exit
# copy run start

ROUTER CONFIGURATION
# conf t
(config)# interface fastethernet 0/0.10
(config-if)# encapsulation dot1q 10
(config-if)# ip address 10.10.10.2 255.255.255.0
(config-if)# exit
(config)# interface fastethernet 0/0.20
(config-if)# encapsulation dot1q 20
(config-if)# ip address 20.20.20.2 255.255.255.0(
config-if)# exit

Now, in order for the two hosts to communicate between them, they must set as default gateway the IP address of the corresponding router subinterface address (e.g for host in VLAN 10 the gateway must be 10.10.10.2 and for host in VLAN 20 the gateway must be 20.20.20.2).

What is a Trunk ?

A trunk according to Cisco is a link that can carry frames for more than one VLAN
at once. A trunk can also be used to connect two switches so that devices in either VLAN can talk to device in the second switch in the same VLAN. When we talk about VLAN in most intances we are talking about Switches, However, Routers's can also connect to VLAN'S as Mentioned above (Router on a Stick).



No comments:

Post a Comment