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
    10.99.0.1 * 255.255.255.255 UH 0 0 0 ppp0
    10.0.0.0 * 255.0.0.0 U 0 0 0 eth1
    default 217.201.249.40 0.0.0.0 UG 0 0 0 ppp0
    default 10.1.1.10 0.0.0.0 UG 0 0 0 eth1

    10.1.1.10 is the local router.
    217.201.249.40 is the remote IP of the GPRS uplink.
    The Ethernet address of the device is 10.1.1.119.

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

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

    Thanks,
    Udo

    --
     
    Udo Giacomozzi, May 2, 2006
    #1
    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 255.255.255.0 ppp0
    will route everything to any machine on 111.222.333.x through ppp0



     
    Unruh, May 2, 2006
    #2
    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
     
    Udo Giacomozzi, May 3, 2006
    #3
    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.