netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Support of multiple default routes in Linux ?
@ 2009-10-06 15:37 Mallika Gautam
  2009-10-06 18:02 ` Ben Greear
  0 siblings, 1 reply; 2+ messages in thread
From: Mallika Gautam @ 2009-10-06 15:37 UTC (permalink / raw)
  To: linux-net, netdev

Hi All,

I am working on 2.6.26 kernel. I am trying to setup Policy based
routing with multiple IP addresses in same subnet, with multiple
routing tables, each having its own default gateway. I have no route
in the 'Main' table. Problem is that I am not able to add default
route in each of the routing table.

I have 3 interfaces in the same subnet, sharing the gateway. I am
using 3 different routing tables for them. I need to add this gateway
to each of the routing tables with different interface associated with
the routing table.

Routing tables look like this -

eth0: 192.168.1.1/16
eth1: 192.168.1.2/16
eth2: 192.168.1.3/16

main table: empty

---- eth0tbl: routing table for eth0 ----
192.168.0.0/16 dev eth0

--- eth1tbl: routing table for eth1 ---
192.168.0.0/16 dev eth1

--- eth2tbl: routing table for eth2 ---
192.168.0.0/16 dev eth2

#ip rule
0: from all lookup local
2: from 192.168.1.1 iif lo lookup eth0tbl
3: from all to 192.168.1.1 iif eth0 lookup eth0tbl
4: from 192.168.1.2 iif lo lookup eth1tbl
5: from all to 192.168.1.2 iif eth1 lookup eth1tbl
6: from 192.168.1.3 iif lo lookup eth2tbl
7: from all to 192.168.1.3 iif eth2 lookup eth2tbl
32766: from all lookup main ----------> /* empty */
32767: from all lookup default ----------> /* empty */

when I give following command to add default route, it returns error -
#ip route add default via 192.168.254.254 dev eth0 table eth0tbl
RTNETLINK answers: No such process.

#ip route add default via 192.168.254.254 dev eth1 table eth1tbl
RTNETLINK answers: No such process.

#ip route add default via 192.168.254.254 dev eth2 table eth2tbl
RTNETLINK answers: No such process.

arp_announce, arp_ignore and arp_filter are all set to 1.
Is there a way this can be achieved? Is this available in any of the
later kernel versions? Any pointers would be of help.

Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Support of multiple default routes in Linux ?
  2009-10-06 15:37 Support of multiple default routes in Linux ? Mallika Gautam
@ 2009-10-06 18:02 ` Ben Greear
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Greear @ 2009-10-06 18:02 UTC (permalink / raw)
  To: Mallika Gautam; +Cc: linux-net, netdev

On 10/06/2009 08:37 AM, Mallika Gautam wrote:
> Hi All,
>
> I am working on 2.6.26 kernel. I am trying to setup Policy based
> routing with multiple IP addresses in same subnet, with multiple
> routing tables, each having its own default gateway. I have no route
> in the 'Main' table. Problem is that I am not able to add default
> route in each of the routing table.
>
> I have 3 interfaces in the same subnet, sharing the gateway. I am
> using 3 different routing tables for them. I need to add this gateway
> to each of the routing tables with different interface associated with
> the routing table.
>
> Routing tables look like this -
>
> eth0: 192.168.1.1/16
> eth1: 192.168.1.2/16
> eth2: 192.168.1.3/16
>
> main table: empty
>
> ---- eth0tbl: routing table for eth0 ----
> 192.168.0.0/16 dev eth0
>
> --- eth1tbl: routing table for eth1 ---
> 192.168.0.0/16 dev eth1
>
> --- eth2tbl: routing table for eth2 ---
> 192.168.0.0/16 dev eth2
>
> #ip rule
> 0: from all lookup local
> 2: from 192.168.1.1 iif lo lookup eth0tbl
> 3: from all to 192.168.1.1 iif eth0 lookup eth0tbl
> 4: from 192.168.1.2 iif lo lookup eth1tbl
> 5: from all to 192.168.1.2 iif eth1 lookup eth1tbl
> 6: from 192.168.1.3 iif lo lookup eth2tbl
> 7: from all to 192.168.1.3 iif eth2 lookup eth2tbl
> 32766: from all lookup main ---------->  /* empty */
> 32767: from all lookup default ---------->  /* empty */
>
> when I give following command to add default route, it returns error -
> #ip route add default via 192.168.254.254 dev eth0 table eth0tbl
> RTNETLINK answers: No such process.
>
> #ip route add default via 192.168.254.254 dev eth1 table eth1tbl
> RTNETLINK answers: No such process.
>
> #ip route add default via 192.168.254.254 dev eth2 table eth2tbl
> RTNETLINK answers: No such process.
>
> arp_announce, arp_ignore and arp_filter are all set to 1.
> Is there a way this can be achieved? Is this available in any of the
> later kernel versions? Any pointers would be of help.

Try adding subnet routes first?  This can work, as we do it all
the time.

We also use numeric tags for table-id, but no idea if that is an issue.

Ben

>
> Thanks
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-06 18:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-06 15:37 Support of multiple default routes in Linux ? Mallika Gautam
2009-10-06 18:02 ` Ben Greear

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).