1

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.

edit

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!

edit2

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.

cpf
  • 287
  • 4
  • 11

3 Answers3

0

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.

Chopper3
  • 101,299
  • 9
  • 108
  • 239
  • 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 07 '10 at 08:16
  • You just need to use Policy-Based Routing, only found in IOS 11 and greater. – Chopper3 Jul 07 '10 at 08: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 07 '10 at 09:22
0

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

cpf
  • 287
  • 4
  • 11
0

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.

Vatine
  • 5,440
  • 25
  • 24