cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2604
Views
0
Helpful
9
Replies

Same subnet in different Layer 2 vlans

grapevine
Level 1
Level 1

Assume that there are two switches A & B that are connected via a trunk. Switch A has a PC in vlan 10 with IP address 10.0.0.1/24 and Switch B has a PC with IP address 10.0.0.2/24 in Vlan 20. Will the two hosts ping? If not, what is the configuration changes needed to make them ping and all vlans are allowed on the trunk interface. I have tried this is in packet tracer and nothing seems to work for me. Please help me on this.

9 Replies 9

Hi,

if you are using layer 2 devices (layer 2 switches) with VLANs, then you cannot do inter VLAN communication between hosts. trunk port will just pass the allowed VLANs through trunk link. this can setup when configuring trunk mode in switchport and setting allowed VLANs  using below command. by default some switches are enabled all VLANs through trunk.

#switchport trunk allowed vlan

according to your scenario below steps you can use to enable communication between two computers.

1. put both computers in same VLAN

2. use layer 3 device (router or layer 3 switch) to do the inter vlan routing. in this case you cannot have same network ip range between two hosts.

Regards,

Kasun

Please rate this and mark as solution/answer, if this resolved your issue
Good luck
KB

Thanks for the reply. I had this question in one of the interviews. The interviewer said to configure switchport trunk native vlan 10 on Switch A and then switchport trunk native vlan 20 on Switch B.

I tried what he suggested but I got 'Native vlan mismatch' error messages on the console.

yes. if you done that so, console messages will be there with that error. thats not best practise.

Please rate this and mark as solution/answer, if this resolved your issue
Good luck
KB

I wasn't able to ping the hosts in Packet tracer. Is it possible to ping the hosts when we use real switches and clients?

can you upload file here?

Please rate this and mark as solution/answer, if this resolved your issue
Good luck
KB

Please find the file attached. Thanks for the help anyway

Hi there,

as i explained you cannot do inter vlan communication using only layer 2 devices. you need a layer 3 device like a router to do inter vlan communication. 

Please rate this and mark as solution/answer, if this resolved your issue
Good luck
KB

From the IP address, the 2 PC's are in the same subnet.

Effectively, as the interviewer said, by using the "native vlan" command and effectively faking the the trunk to link the 2 vlans together.  With a common subnet addressing and native vlan passing frames untagged, the 2 PC's SHOULD be able to talk.

Oh, and with CDP enabled, the switches will complain.

Disclaimer

The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.

Liability Disclaimer

In no event shall Author be liable for any damages wha2tsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.

Posting

It depends on whether hosts have a GW defined.

If you intermingle two different subnets on the same broadcast domain, if the hosts have a GW IP, they will direct any traffic, not on their network, to that IP.  If they don't have a GW, they will ARP for IPs both on and off their network.

Review Cisco Networking for a $25 gift card