Default Route based on source?

Default Route based on source?

Post by Warren Flemme » Tue, 31 Oct 2000 17:03:08



Greetings

Is there a way to to set default routes based on source IP.

The situation is that I would like all pockets from source w.x.y.z/mk to
have a default route of x and all other pockets to have default route y.

Possible? If so what do I need to use?

 
 
 

Default Route based on source?

Post by James Knot » Tue, 31 Oct 2000 22:10:45



> Greetings

> Is there a way to to set default routes based on source IP.

> The situation is that I would like all pockets from source w.x.y.z/mk to
> have a default route of x and all other pockets to have default route y.

> Possible? If so what do I need to use?

You might be able to do that, using ipchains.  You can
filter on the IP address and set up a transfer to the
desired interface.

--
Replies sent via e-mail to this address will be promptly
ignored.

"james.knott".

 
 
 

Default Route based on source?

Post by Chris Friese » Wed, 01 Nov 2000 09:44:34



> Greetings

> Is there a way to to set default routes based on source IP.

> The situation is that I would like all pockets from source w.x.y.z/mk to
> have a default route of x and all other pockets to have default route y.

> Possible? If so what do I need to use?

Certainly possible.  You'll need to enable advanced routing in the kernel and
use the new iproute2 tools.

Basically, you'll make a new rule saying that any packets from w.x.y.z should
look up a different routing table than main.  That routing table has a single
entry (default) that sends it out route x.

something like this should do it:

ip rule add from w.x.y.z lookup table 200
ip route add default via x.x.x.x dev devname table 200

where x.x.x.x is the IP address of the interface that you want to route it out
on, and devname is the device name (eth0, ppp1, etc).

If you can't figure it out after looking at the docs, I'd be happy to get more
specific.

 
 
 

Default Route based on source?

Post by Fraser Campbel » Fri, 10 Nov 2000 04:00:00



> > Is there a way to to set default routes based on source IP.

> > The situation is that I would like all pockets from source w.x.y.z/mk to
> > have a default route of x and all other pockets to have default route y.

> > Possible? If so what do I need to use?

> You might be able to do that, using ipchains.  You can
> filter on the IP address and set up a transfer to the
> desired interface.

The command is ip ... it comes as part of the iproute2 package.  You can do
precisely what you want.

Fraser