cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
24258
Views
25
Helpful
5
Replies

L2 & L3 Vlan

sham_chennala
Level 1
Level 1

HI,

What is the differance between L2 Vlan and L3 Vlan ? How it will communicate each other.

2 Accepted Solutions

Accepted Solutions

Jon Marshall
Hall of Fame
Hall of Fame

Hi

Vlans exist at layer 2. At layer 3 you have vlan interfaces. Vlan interfaces are only needed if you wanted to route between your vlans. So

vlan 10 = 192.168.5.0/24

vlan 11 = 182.168.6.0/24

On a switch you create vlan 10 and vlan 11 at layer 2 only.

Any PC connected into vlan 10 can communicate with any other Pc connected into vlan 10 and any PC in vlan 11 can communicate with any other PC in vlan 11 BUT

a PC in vlan 10 cannot communicate with a PC in vlan 11 and vice-versa.

If you want a PC in vlan 10 to be able to communicate with a PC in vlan 11 then you need to create a L3 interface for that vlan. Typically this is an SVI (Switched Virtual Interface) on a L3 switch. So you would

int vlan 10

ip address 192.168.5.1 255.255.255.0

int vlan 11

ip address 192.168.6.1 255.255.255.0

Then you would set the default-gateway of a PC in vlan 10 to be 192.168.5.1 and the default-gateway of a PC in vlan 11 to be 192.168.6.1 and PC's in vlan 10 and vlan 11 can now talk to each other.

HTH

Jon

View solution in original post

Sham:

I will try to add a bit to Jon's excellent post.

There is no such thing as a layer 2 or layer 3 vlan, per se. A vlan is a vlan, period. It is a virtual network that comprises one broadcast domain.

Now, given the ROLE that the switch is playing, the vlan configuration will differ.

For example, If you are configuring an ACCEESS switch that users will plug their PCs into directly, you will have to create the vlan first and then configure each user port to be placed in that vlan.

Example:

interface gi2/1

switchport

switchport mode access

switchport access vlan 10

This is a LAYER 2 configuration for VLAN 10.

Two devices that are part of the same vlan can communicate directly without a layer 3 vlan interface and an IP address.

However, if you want to communicate between 2 DIFFERENT vlans, then you will have to go through a router - a Layer 3 device. On that router, you will then configure the layer 3 routed vlan interface with an IP address on that vlan.

Example:

interface vlan 10

ip address 10.10.10.1 255.255.255.0

This is a LAYER 3 configuration for VLAN 10.

It may help you to think of the routed layer 3 vlan interface as a gateway OUT OF or INTO the vlan.

Take note, that you can configure a switch that is layer 3-capable to perform the tasks of an access switch and the inter-vlan router.

HTH

Victor

View solution in original post

5 Replies 5

Jon Marshall
Hall of Fame
Hall of Fame

Hi

Vlans exist at layer 2. At layer 3 you have vlan interfaces. Vlan interfaces are only needed if you wanted to route between your vlans. So

vlan 10 = 192.168.5.0/24

vlan 11 = 182.168.6.0/24

On a switch you create vlan 10 and vlan 11 at layer 2 only.

Any PC connected into vlan 10 can communicate with any other Pc connected into vlan 10 and any PC in vlan 11 can communicate with any other PC in vlan 11 BUT

a PC in vlan 10 cannot communicate with a PC in vlan 11 and vice-versa.

If you want a PC in vlan 10 to be able to communicate with a PC in vlan 11 then you need to create a L3 interface for that vlan. Typically this is an SVI (Switched Virtual Interface) on a L3 switch. So you would

int vlan 10

ip address 192.168.5.1 255.255.255.0

int vlan 11

ip address 192.168.6.1 255.255.255.0

Then you would set the default-gateway of a PC in vlan 10 to be 192.168.5.1 and the default-gateway of a PC in vlan 11 to be 192.168.6.1 and PC's in vlan 10 and vlan 11 can now talk to each other.

HTH

Jon

Thanks for your valueable replay.

Thanks & Regards

Sham

Hi,

In my switch both VLANS are present,L2 & L3.For L3 VLAN we are having ip address but L2 VLAN not having any ip address.then how it will communicate.

Thanks & Regards,

Sham.

Sham:

I will try to add a bit to Jon's excellent post.

There is no such thing as a layer 2 or layer 3 vlan, per se. A vlan is a vlan, period. It is a virtual network that comprises one broadcast domain.

Now, given the ROLE that the switch is playing, the vlan configuration will differ.

For example, If you are configuring an ACCEESS switch that users will plug their PCs into directly, you will have to create the vlan first and then configure each user port to be placed in that vlan.

Example:

interface gi2/1

switchport

switchport mode access

switchport access vlan 10

This is a LAYER 2 configuration for VLAN 10.

Two devices that are part of the same vlan can communicate directly without a layer 3 vlan interface and an IP address.

However, if you want to communicate between 2 DIFFERENT vlans, then you will have to go through a router - a Layer 3 device. On that router, you will then configure the layer 3 routed vlan interface with an IP address on that vlan.

Example:

interface vlan 10

ip address 10.10.10.1 255.255.255.0

This is a LAYER 3 configuration for VLAN 10.

It may help you to think of the routed layer 3 vlan interface as a gateway OUT OF or INTO the vlan.

Take note, that you can configure a switch that is layer 3-capable to perform the tasks of an access switch and the inter-vlan router.

HTH

Victor

Hi Sham,

You should have a default gateway created for your Layer2 Vlan (Just as your Layer 3 Vlan) which becomes a Layer 3 Vlan, that way both the Vlans will be able to communicate with each other.

Regards,

Mohana R.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card