Routing over multiple uplinks

Discussion in 'Linux Networking' started by Udo Giacomozzi, May 2, 2006.

  1. Hello all,

    I have an embedded system that connects to the Internet using two
    different uplinks. One goes through a Ethernet connection and a
    router, the other is using a GPRS connection.

    Basically any Internet host can be reached with one of the two links.

    I need a way to send UDP packets over a explicitly choosen link. How
    can this be done?

    For example, I want to send a UDP packet to host X using the GPRS
    connection even if the Ethernet connection is online and could reach
    host X faster.

    I tried to bind the local IP address to the local IP address but the
    packets get routed through the automatically choosen gateway anyway.
    Even worse, the packets get sent with the wrong source IP address (the
    one belonging to the other interface).

    Here is an example of the routing table:

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface * UH 0 0 0 ppp0 * U 0 0 0 eth1
    default UG 0 0 0 ppp0
    default UG 0 0 0 eth1 is the local router. is the remote IP of the GPRS uplink.
    The Ethernet address of the device is

    When both links are active and I send a packet bound to to
    a Internet address, the packet gets routed through ppp0.

    Is there any way to tell sendto() and friends which interface to use?


    Udo Giacomozzi, May 2, 2006
    1. Advertisements

  2. Udo Giacomozzi

    Unruh Guest

    It will only ever use the latest default entry. Two default entries make no
    sense. If you want to route to specific hosts or netc, put it in explicitly

    route add -net 111.222.333.0 netmask ppp0
    will route everything to any machine on 111.222.333.x through ppp0

    Unruh, May 2, 2006
    1. Advertisements

  3. Ok, I see. However, I can reach 111.222.333.123 via eth1 *and* ppp0. But
    I want to decide myself which route to use. I think that's possible with
    iproute2 but on my machine I have no "ip" command so I' wondering if it can
    be done with route/ifconfig/iptables commands.

    Any idea?

    Udo Giacomozzi, May 3, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.