On Wed, Oct 7, 2009 at 12:20 AM, Leslie Rhorer <lrhorer@xxxxxxxxxxx> wrote: > >> 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 > > Why are you trying to do this? It's not something that is normally > done, and unless you have a really good reason, I think it's likely it's not > really a very good idea. If you want them to share a gateway, then I would > think you would simply provision each interface with a different subnet and > then just create a single gateway. > >> 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. > > To the best of my knowledge, it can't be done. It doesn't even make > a whole lot of sense to me. What are you trying to do? > > Some routers allow multiple paths to a single destination, but I > don't think Linux does. Regardless, having three different LAN segments on > the same subnet presents a number of very sticky issues. Why do you want > three different segments on the same box to be on the same subnet? Why do > you want three different default gateways? Are you trying to load balance > your network or something? > > -- Hi, Thanks for the response. I'll try my best to explain the scenario. I am working to provide IP reachability to a box with 6 physical interfaces, clubbed as 3 pairs, with 2 physical interface each. An interface pair looks like this bond0 (IP: 192.168.1.1/16) /\ macvlan0 macvlan1 | | eth0 eth1 (IP: 192.168.1.3/16) (IP: 192.168.1.2/16) Deployment is such that physical interafces should always be pingable 'individually'. Therefore, 3 IP address assigned to a pair should be always pingable, hence the need of multiple gateways per subnet. To keep them separate, I have created multiple routing tables and added policy rules and appropriate ARP options (given in original post) I have 3 such subnets. Below are examples (10.10.10.1/16, 10.10.10.2/16, 10.10.10.3/16) <=> (bond1, eth2, eth3) (172.10.1/16, 172.10.10.2/16, 172.10.10.3/16) <=> (bond2, eth4, eth5) I understand that adding multiple gateways for a single subnet may be crazy and I can possibly negotiate that, but is it possible to add a gateway per subnet i.e. can we have 3 default routes pointing to 3 different gateways that can be reached via that subnet ? e.g default via 192.168.254.254 dev bond0 default via 10.10.254.254 dev bond1 default via 172.10.254.254 dev bond2 Thanks again. -- To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html