5

VLANs are a layer 2 concept. We can all agree on that but why, then, do we use the 'interface vlanX' to allow routing on a switch. If we want to setup a default gateway for VLAN X on a Layer 3 switch would be be able to accomplish the same goal with an 'interface loopbackX' command as an 'interface vlanX' command? Aren't they both just virtual interfaces that can be used to hold IP addresses and thus route?

  • 1
    When packet is being L2 switched, it cannot ever hit loopback interface, as it is L3 interface which is not facing any L2 network. Imagine SVI/VLAN interface as virtual router where all L2 interface with that VLAN tag are physically wired to. For L2 packet to reach loopback interface, it must first hit interface between L2 and L3 before it can hit loopback. – ytti Nov 23 '13 at 10:33
  • ytti, I've never thought of it that way. The virtual router with physical connections analogy is an excellent way to visualize it. I wish your response wasn't a comment so I can vote you as best answer – Michael May Nov 27 '13 at 3:22
11

When you create 'interface vlan x' you are creating a brand new logical interface that happens to be automagically associated with the corresponding L2 vlan. When you put an IP address on 'interface vlan x' then you are simply giving that logical interface an IP that is on the same broadcast domain (or subnet or vlan or L2 domain or whatever terminology you wish to use).

A loopback interface is a virtual interface that has no such magical association. It is not associated with a vlan, nor is it associated with a physical interface.

Routing is a different function entirely though. My windows 7 computer has a few virtual IP addresses, but it is unable to route traffic thru them because I have not told it to do so. This same logic applies to network devices, you can have an IP address on 'interface vlan x' of a cisco 2960, but this is a layer 2 switch and will be unable to route traffic.

| improve this answer | |
  • Magical association = what ytti previously mentioned; a virtual router acting as if it has physical connections to the VLAN interfaces – Michael May Nov 27 '13 at 3:25
3

Int vlanX is simply the Cisco way of creating a layer3 interface on a switch.

for Brocade Netirons you use interface ve while Junos uses vlan.x

When you bridge on a Cisco router you create a layer3 interface on a BVI interface. On Junos you can create an IRB interface.

At the end of the day it's simply a name. It's a routed interface that all the other ports on the same vlan/brocadcast domain is connected to.

| improve this answer | |
3

Although both of these are indeed virtual interfaces, they pursue totally different goals. Loopback is an interface that mostly is being used by other modules, like routing protocols or as the address holder for other interfaces, while SVI interface (vlan interface) that belongs to a corresponding vlan can be used for either management purposes in L2 infrastructure or it also can terminate (support) the vlan in L3 infrastructure in order to perform the intervlan routing.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.