cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
8639
Views
5
Helpful
6
Replies

Default route for a specific subnet

s.hellman
Level 1
Level 1

I have a default route for the whole router

ip route 0.0.0.0 0.0.0.0 10.5.1.31

but for a specific subnet, 10.80.1.0/24, I want another default route. Can this be done?

2 Accepted Solutions

Accepted Solutions

Hello,

just add a route for 10.80.1.0/24, e.g.:

ip route 10.80.1.0 255.255.255.0 FastEthernet0/0

the router will choose that route for all traffic destined for 10.80.1.0/24, since that route is more specific than the default route.

Or is 10.80.1.0/24 your source and do you want to have traffic originating in that network to be routed somewhere else ? This can be done as well, with policy routing, the syntax would look like this:

interface FastEthernet 0/0

ip policy route-map SUBNET

1

route-map SUBNET permit 10

match ip address 101

set ip next-hop 10.10.10.1

or

set interface FastEthernet0/1

1

access-list 101 permit ip 10.80.1.0 0.0.0.255 any

Regards,

Georg

View solution in original post

As I read the original post I believe that they want a different default route for traffic originating from that subnet.

I agree that the approach to solving this is to use policy routing. But I would suggest that "set ip next-hop 10.10.10.1" or "set interface FastEthernet0/1" will affect forwarding of ALL packets from that subnet not just provide a different default route. I would suggest that it should be "set ip default next-hop 10.10.10.1" or "set default interface FastEthernet0/1". This will allow normal forwarding for traffic which has a match in the routing table and will change only forwarding of traffic which is going to the default route.

HTH

Rick

View solution in original post

6 Replies 6

Hello,

just add a route for 10.80.1.0/24, e.g.:

ip route 10.80.1.0 255.255.255.0 FastEthernet0/0

the router will choose that route for all traffic destined for 10.80.1.0/24, since that route is more specific than the default route.

Or is 10.80.1.0/24 your source and do you want to have traffic originating in that network to be routed somewhere else ? This can be done as well, with policy routing, the syntax would look like this:

interface FastEthernet 0/0

ip policy route-map SUBNET

1

route-map SUBNET permit 10

match ip address 101

set ip next-hop 10.10.10.1

or

set interface FastEthernet0/1

1

access-list 101 permit ip 10.80.1.0 0.0.0.255 any

Regards,

Georg

As I read the original post I believe that they want a different default route for traffic originating from that subnet.

I agree that the approach to solving this is to use policy routing. But I would suggest that "set ip next-hop 10.10.10.1" or "set interface FastEthernet0/1" will affect forwarding of ALL packets from that subnet not just provide a different default route. I would suggest that it should be "set ip default next-hop 10.10.10.1" or "set default interface FastEthernet0/1". This will allow normal forwarding for traffic which has a match in the routing table and will change only forwarding of traffic which is going to the default route.

HTH

Rick

It seems that policy routing with "set ip default.." will solve it. Thanks both of you!

It seems that neighter "set ip default" or "set ip next-hop" is supported on my Catalyst 3550 sw/v 12.1(12c)EA1.

Is there any other way?

Hello,

AFAIK, before you can enable policy routing, you must configure one of these commands in the global configuration mode, and then the configuration must be written and the switch reloaded:

sdm prefer extended-match

sdm prefer access extended-match

sdm prefer routing extended-match

HTH,

Georg

 Richard Burts

 i agree sir 

and your respond helped remember that we can actually do this when we have routing protocol and we need to segregate the default route for specific subnets without effecting the interconnection made by the routing protocol

 

*****