Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible in a cisco router to route based on vlan? I have in the router 2 vlans, and 2 possible ways to go out:

  • One vlan should be routed to a certain ip
  • One vlan should be routed to the "outside world" (the router is also an adsl modem)

I currently know of no way to do this. Although it might seem simple...

Many thanks in advance.


Correction regarding this question: The problem does resolve around vlans, but the question is better formulated in this way:

How do I route a packet in this way: Packet A from source subnet1 needs to go to outside1. All other packets need to go to outside2

We currently have a cisco adsl router, and a voip router after that. Recently our connections got upgraded with a vdsl, so we now have adsl and vdsl in the picture. It is the intention that internet traffic goes through vdsl, and voip traffic through adsl. I figured this would be easiest to separate through vlans, and try to route the vlans accordingly.

If there is a better way to do this, it would also be very appreciated!


The specific problem we were facing was solved. The simpler solutions always are best of course:

Since we're using voip for our telephoning, and that was the only thing needing to go through the adsl outside line, I came up with the idea to route the specific range of IP's used by our voip provider. Also the port used for dialing was forwarded (using static nat)

Everything else is sent over the vdsl line (default route)

This effectively splits the voip and internet traffic.

share|improve this question

Yes, well kind of anyway. VLANs are a feature of Layer 2, presumably you mean IP routing - which is a Layer 3 feature. So you can certainly route from two VLANs differently but what you're actually doing is routing from two different IP subnets; each VLAN having one or more subnets.

What you need to do is identify the various subnets that correspond to your VLANs and simply define static routes - i.e. traffic from subnet A goes to Z and traffic from subnet B goes to Y.

Let me know if I've misunderstood your query.

share|improve this answer
Pretty much. I was just going to change the topic / content to say: I need a way to say: Traffic from A must go to Z. The only way I know I can route traffic is depending on the destination, not the source. – cpf Jul 7 '10 at 8:16
You just need to use Policy-Based Routing, only found in IOS 11 and greater. – Chopper3 Jul 7 '10 at 8:47
I'll most certainly remember that. However, another solution has been found specific to our problem. Thanks for thinking with me on this one. – cpf Jul 7 '10 at 9:22
up vote 0 down vote accepted

See adjusted question. The answer to our specific problem did not need vlan (although I left the tag)

share|improve this answer

If you defnitely need to route based on source IP, the only solution is to use policy-maps.

As you noticed, if all you need is for certain destinations (the VoIP servers) to go one route, it's easier and probably less resource-intensive to just route a specific netblock in that direction.

If you absolutely want to hinder things on a different VLAN from being able to send packets to the VoIP provider, you can accomplish this by using an ACL to block the unwanted traffic while allowing the traffic you want.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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