Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Multiple routes to same detstination IP in a linux gateway


    i am using linux pc as application gateway/router. I need to add two routes to the same destination IP/subnet in route table, and the packets that are going to these destinsation IP should be load balanced on the outgoing interfaces. That is, in linux route table i can add only single destination path for single destination/Target IP. In linux, it allows only the route additions like

    Route Table:

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface U 0 0 0 eth0 U 0 0 0 eth0 UG 0 0 0 eth0

    That is there can only one route for subnet through gw

    I need to have multiple gw entries in the route table for the same destination IP/subnet like this

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface U 0 0 0 eth0 U 0 0 0 eth0 U 0 0 0 eth0 U 0 0 0 eth0 U 0 0 0 eth0 UG 0 0 0 eth0

    and the traffic for destination shuold be load balanced throught the gateways.
    That is half of the destination traffic to be shared to each gateway for load balancing of gateways.

    But linux does not allow this kind of route additions generally.

    Is there anyway or tool or utility or routing patch to do this?

    how do is modify the routing module in linux kernetl itself to support this.

    any help is worth commendable.

    Suresh Guduru

  2. #2
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    The Keystone State
    First you can't do this as the kernel will not know which route to use and send the packets. Also you could/will introduce asyn routing and that is a bad thing.

    If you need both lines up to the same host then you might want to look into bundling them together to act as one link.


    The adventure of a life time.

    Linux User #296285
    Get Counted

  3. #3
    hi gsuresh,

    I don't think you really want or mean gateway here. A gateway is how packets not intended for one subnet segment to "get out" to some place where that packet might be forwarded to the correct location.

    You could maybe make aliases on eth0 to be used for each ip but you would still need to do some routing to have it know what to do. You would need to look at the command iptables. It is what is used to build the firewall and accomplish your routing. It is not light reading though.

    You can route by ip as well as by port and you can change the destination route and port with it also.

    There are a few applications out there that can attempt to assist you in building firewalls but I do not think there are many that would readily set up your needs straight out.

    You might post more details about what you need to do and also look-up routing and iptables for more help. <Linux> - Google Search really is a good friend if you look hard enough, there is a lot out there that is near worthless as well ( , I know from long looks myself.

    The load balancing is a little past me. I often find that the more I learn I see how little I know.

    But any project is always best done a portion at a time. Load Balancing is not as important right now as is getting the ips routed as you need. Start with that part and then ........


  4. $spacer_open
  5. #4
    i am thinking of changing the routing module in linux kernel to make this feature.
    Is there any one has the idea that how can this be done.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts