Showing results for 
Search instead for 
Did you mean: 

Routing based on source subnet


I need to route 2 networks through 4431 out separate interfaces.

I currently have a default route - 

ip route (G0/0/0)

Now, I need VLAN 50 traffic to route to G0/0/2 specifically.

interface GigabitEthernet0/0/0
ip address
negotiation auto
interface GigabitEthernet0/0/1
description >>Link To SWX<<
mac-address 50f7.22e6.7111
no ip address
negotiation auto
interface GigabitEthernet0/0/1.10
description DATA Vlan
encapsulation dot1Q 10 native
ip address
no ip unreachables
service-policy input PM_CLASSIFY_IN
interface GigabitEthernet0/0/1.50
description Student VLAN
encapsulation dot1Q 50
ip address dhcp
no ip unreachables
interface GigabitEthernet0/0/1.200
description Voice Vlan
encapsulation dot1Q 200
ip address
no ip unreachables
service-policy input PM_CLASSIFY_IN
interface GigabitEthernet0/0/1.250
encapsulation dot1Q 250
ip address
service-policy input PM_CLASSIFY_IN
interface GigabitEthernet0/0/2
ip address A.A.A.A
negotiation auto


1 Accepted Solution
4 Replies 4

VIP Community Legend VIP Community Legend
VIP Community Legend

Not sure what VLAN 50 IP address range :

below example - i use for many places works as expected.

- configure an access list to identify the traffic to be forwarded by PBR


access-list 101 permit ip 00.0.255 any  (this is your VLAN IP address range)


- configure a route map to use the acl and set the next hop address


route-map PBR permit 1

match ip address 101

set ip next-hop <next hop address>  (your Gig 0/0/2 next hop IP)

- apply the route map to the interface

interface x/x  ( apply to interface, where required)

ip policy route-map PBR


***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

paul driver
VIP Expert VIP Expert
VIP Expert

So you would possibly first want to make your static default route conditional
The apply some with Policy Base routing (PBR) for your vlan 50 traffic,

However when you do PBR vlan 50 this will ONLY be based on egress traffic, it will have not any bearing on the return path for vlan 50, as such you may incur asymmetric routing, which any ingress traffic for vlan 50 could come in via the primary wan interface.

Example:1 - conditional static default routes

ip sla 1
icmp-echo source-interface gig0/0
timeout 1000
frequency 15

ip sla schedule 1 start now life forever

track 10 rtr1 reachability

access-list 100 permit icmp host host echo

route-map ipsla
match ip address 100
set ip next-hop
set interface Null0

ip local policy route-map ipsla

ip route gig0/0 track 10 name primary link
ip route gig0/2 <nexthop ip> 2 name backup link

Example:2 - conditional PBR  (if gig0./2 fails vlan 50 traffic will take the normal routing path specified by routing table

track 11 interface gig0/2 line-protocol

route-map pbr permit 10
set ip next-hop verify-availability <gig0/2 next-hop ip> 1 track 11

Interface GigabitEthernet0/0/1.50
ip policy route-map pbr

Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards


To route VLAN 50 traffic through G0/0/2, you can create a static route with the destination network being the VLAN 50 subnet and the next hop being the IP address of G0/0/2.

For example, if the subnet for VLAN 50 is, you would use the following command:

ip route G0/0/2


This tells the router that any traffic destined for the subnet should be sent out of the G0/0/2 interface.

Additionally, you can also use a route-map to match the source IP address of the traffic and set the next hop IP address to G0/0/2.

It is also good practice to verify the routing table with command

show ip route

to confirm that the correct routes are in place.

Please rate this and mark as solution/answer, if this resolved your issue
All the best,

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:

Recognize Your Peers