Loading ...
Sorry, an error occurred while loading the content.

Re: [dubailug] Policy based Routing in Linux

Expand Messages
  • Moeen Alinaghian
    Hi, I m not so familiar with ip, and avoid it (why ?!), so try these things : ifconfig eth0 10.0.1.10 netmask 255.255.255.0 up ifconfig eth1 10.0.2.10 netmask
    Message 1 of 12 , Nov 1, 2005
    • 0 Attachment
      Hi,
      I'm not so familiar with ip, and avoid it (why ?!), so
      try these things :

      ifconfig eth0 10.0.1.10 netmask 255.255.255.0 up
      ifconfig eth1 10.0.2.10 netmask 255.255.255.0 up
      ifconfig eth2 10.0.3.10 netmask 255.255.255.0 up
      route add default gw 10.0.1.1 dev eth0
      route add default gw 10.0.2.1 dev eth1
      route add default gw 10.0.3.1 dev eth2

      what's the result, now ?

      Sincerely yours,
      Moeen Alinaghian

      --- Jaison Jose <jaittu@...> wrote:

      > Hi,
      > Anyone can help me to setup policy based routing in
      > linux(Fedora 3). I want
      > to put seperate gateways to all of my three
      > interfaces, which are connected
      > to seperate routers.
      > I configured like;
      > ip addr add dev eth0 10.0.1.10/24
      > <http://10.0.1.10/24>
      > ip addr add dev eth1 10.0.2.10/24
      > <http://10.0.2.10/24>
      > ip addr add dev eth2 10.0.3.10/24
      > <http://10.0.3.10/24>
      > ip rule add dev eth0 table 1
      > ip route add default via 10.0.1.1 <http://10.0.1.1>
      > table 1
      > ip rule add dev eth1 table 2
      > ip route add default via 10.0.2.1 <http://10.0.2.1>
      > table 2
      > ip rule add dev eth2 table 3
      > ip route add default via 10.0.3.1 <http://10.0.3.1>
      > table 3
      > ip ro flush cache
      > But I cant ping to any ip behind the router..
      > Thanks in advance
      > Regards
      > Jaison
      >





      __________________________________
      Yahoo! Mail - PC Magazine Editors' Choice 2005
      http://mail.yahoo.com



      __________________________________
      Yahoo! FareChase: Search multiple travel sites in one click.
      http://farechase.yahoo.com
    • Dirk Tilger
      ... Reading your mail I assume your network structure is the following: +-----------+ +--------+ ... +-----------+ +--------+ ... +---- eth1 ---
      Message 2 of 12 , Nov 1, 2005
      • 0 Attachment
        On Mon, Oct 31, 2005 at 09:24:51PM +0400, Jaison Jose wrote:
        > Anyone can help me to setup policy based routing in linux(Fedora 3). I want
        > to put seperate gateways to all of my three interfaces, which are connected
        > to seperate routers.
        > I configured like;
        > ip addr add dev eth0 10.0.1.10/24 <http://10.0.1.10/24>
        > ip addr add dev eth1 10.0.2.10/24 <http://10.0.2.10/24>
        > ip addr add dev eth2 10.0.3.10/24 <http://10.0.3.10/24>
        > ip rule add dev eth0 table 1
        > ip route add default via 10.0.1.1 <http://10.0.1.1> table 1
        > ip rule add dev eth1 table 2
        > ip route add default via 10.0.2.1 <http://10.0.2.1> table 2
        > ip rule add dev eth2 table 3
        > ip route add default via 10.0.3.1 <http://10.0.3.1> table 3
        > ip ro flush cache
        > But I cant ping to any ip behind the router..

        Reading your mail I assume your network structure is the following:

        +-----------+ +--------+
        | something |-?-| router |--- eth0 --- 10.0.1.0/24
        +-----------+ +--------+
        |
        +---- eth1 --- 10.0.2.0/24
        |
        +---- eth2 --- 10.0.3.0/24

        I could not fully understand what you're trying to do.

        In my eyes your specific configuration makes only sense when there is
        another interface 'something' defined that is accessed from eth0-2 or
        vice versa. "Policy based routing" makes only sense when you want to
        route based on parameters other then the packets destination, but is not
        what you configured - in my eyes.

        Please give more info here.

        Dirk Tilger
        Advanced Technologies ME FZ LLC
        Tel +971 4 367 1071
        Fax +971 4 367 2529
        Mob +971 50 8809132
        +966 55 1650025
      • Dirk Tilger
        ... He should have three different default routes. The system will try to use the first one and only if the interface is down, it will try the second. It might
        Message 3 of 12 , Nov 1, 2005
        • 0 Attachment
          On Tue, Nov 01, 2005 at 03:51:15AM -0800, Moeen Alinaghian wrote:
          > ifconfig eth0 10.0.1.10 netmask 255.255.255.0 up
          > ifconfig eth1 10.0.2.10 netmask 255.255.255.0 up
          > ifconfig eth2 10.0.3.10 netmask 255.255.255.0 up
          > route add default gw 10.0.1.1 dev eth0
          > route add default gw 10.0.2.1 dev eth1
          > route add default gw 10.0.3.1 dev eth2
          >
          > what's the result, now ?

          He should have three different default routes. The system will try to
          use the first one and only if the interface is down, it will try the
          second. It might be with a very modern scheduler the packets will be
          distributed in round-robin fashion.

          Routing as shown above is destination only routing. The system should
          have a routing table like...

          10.0.1.0/24 -> eth0
          10.0.2.0/24 -> eth1
          10.0.3.0/24 -> eth2

          ...just from the ifconfig (ifconfig adds routes to interfaces fitting
          their destination). 'default' is a special target which should map to
          0.0.0.0/0. When I issue the first routing command, I would expect
          something like

          0.0.0.0/0 -> 10.0.1.1 via eth0

          The other two would add
          0.0.0.0/0 -> 10.0.2.1 via eth1
          0.0.0.0/0 -> 10.0.3.1 via eth2

          When we order the routing table as the kernel would do: smaller netmasks
          first, we would get:

          Target Bits of Netmask Gateway Interface
          10.0.1.0 24 direct(ARP) eth0
          10.0.2.0 24 direct(ARP) eth1
          10.0.3.0 24 direct(ARP) eth2
          0.0.0.0 0 10.0.1.1 eth0
          0.0.0.0 0 10.0.2.1 eth1
          0.0.0.0 0 10.0.3.1 eth2

          I'm a kernel and want to deliver a packet to 10.0.2.6, I go down the
          table and do:
          - Is (10.0.2.6 AND 255.255.255.0) == 10.0.1.0?
          --> 10.0.2.0 == 10.0.1.0?
          --> No
          - Is ((10.0.2.6 AND 255.255.255.0) == 10.0.2.0?
          --> 10.0.2.0 == 10.0.2.0?
          --> Yes
          - What is the gateway and interface? Gateway is local(ARP) via eth1
          - Sending ARP packet to eth1 to lookup address of network card for
          10.0.2.6
          - (getting the address)
          - Sending the packet.

          When I do the same thing for 217.17.202.242, then the first rule to hit
          is number four, because every packet would match that destination. This
          is why it is called the default route. As long as the interface is up,
          rule 5+6 will never be checked. I'm not sure, but some operating systems
          will even ignore 5+6 when eth0 is down, as their routing mechanism might
          have no concept of interfaces that are down.

          Dirk Tilger
          Advanced Technologies ME FZ LLC
          Tel +971 4 367 1071
          Fax +971 4 367 2529
          Mob +971 50 8809132
          +966 55 1650025
        • Jaison Jose
          Hi Dirk, In the diagram just imagine that eth1 and 2 also connected with 2 other routers. What I need is I want to ping from something (In the diagram,Can be
          Message 4 of 12 , Nov 1, 2005
          • 0 Attachment
            Hi Dirk,
             
                  In the diagram just imagine that eth1 and 2 also connected with 2 other routers. What I need is I want to ping from 'something' (In the diagram,Can be a PC) to the connected interface of our linux box.
             
                 Multiple default gateways will not work as it will only check the first one.
             
                Could you please guide me is there any applications to make the diagram which you made her so that I can explain little bit more as my english is so weak.
             
            Regards
            Jaison.
             
            On 11/1/05, Dirk Tilger <dirk@...> wrote:
            On Tue, Nov 01, 2005 at 03:51:15AM -0800, Moeen Alinaghian wrote:
            > ifconfig eth0 10.0.1.10 netmask 255.255.255.0 up
            > ifconfig eth1 10.0.2.10 netmask 255.255.255.0 up
            > ifconfig eth2 10.0.3.10 netmask 255.255.255.0 up
            > route add default gw 10.0.1.1 dev eth0
            > route add default gw 10.0.2.1 dev eth1
            > route add default gw 10.0.3.1 dev eth2
            >
            > what's the result, now ?

            He should have three different default routes. The system will try to
            use the first one and only if the interface is down, it will try the
            second. It might be with a very modern scheduler the packets will be
            distributed in round-robin fashion.

            Routing as shown above is destination only routing. The system should
            have a routing table like...

            10.0.1.0/24 -> eth0
            10.0.2.0/24 -> eth1
            10.0.3.0/24 -> eth2

            ...just from the ifconfig (ifconfig adds routes to interfaces fitting
            their destination). 'default' is a special target which should map to
            0.0.0.0/0. When I issue the first routing command, I would expect
            something like

            0.0.0.0/0 -> 10.0.1.1 via eth0

            The other two would add
            0.0.0.0/0 -> 10.0.2.1 via eth1
            0.0.0.0/0 -> 10.0.3.1 via eth2

            When we order the routing table as the kernel would do: smaller netmasks
            first, we would get:

            Target            Bits of Netmask            Gateway            Interface
            10.0.1.0      24                  direct(ARP)      eth0
            10.0.2.0      24                  direct(ARP)      eth1
            10.0.3.0      24                  direct(ARP)      eth2
            0.0.0.0            0                  10.0.1.1      eth0
            0.0.0.0            0                  10.0.2.1      eth1
            0.0.0.0            0                  10.0.3.1      eth2

            I'm a kernel and want to deliver a packet to 10.0.2.6, I go down the
            table and do:
            - Is (10.0.2.6 AND 255.255.255.0) == 10.0.1.0?
              --> 10.0.2.0 == 10.0.1.0?
              --> No
            - Is (( 10.0.2.6 AND 255.255.255.0) == 10.0.2.0?
              --> 10.0.2.0 == 10.0.2.0?
              --> Yes
            - What is the gateway and interface? Gateway is local(ARP) via eth1
            - Sending ARP packet to eth1 to lookup address of network card for
              10.0.2.6
            - (getting the address)
            - Sending the packet.

            When I do the same thing for 217.17.202.242 , then the first rule to hit
            is number four, because every packet would match that destination. This
            is why it is called the default route. As long as the interface is up,
            rule 5+6 will never be checked. I'm not sure, but some operating systems
            will even ignore 5+6 when eth0 is down, as their routing mechanism might
            have no concept of interfaces that are down.

            Dirk Tilger
            Advanced Technologies ME FZ LLC
            Tel +971 4 367 1071
            Fax +971 4 367 2529
            Mob +971 50 8809132
                +966 55 1650025


            SPONSORED LINKS
            Linux operating system Linux os Hosting linux unix web
            Free linux operating system Linux migration Linux user


            YAHOO! GROUPS LINKS




          • Jaison Jose
            Hi Moeen, The multiple gateways never work as it will check only the first one from the routing table. The solution is create multiple routing tables and have
            Message 5 of 12 , Nov 1, 2005
            • 0 Attachment
              Hi Moeen,
                
                   The multiple gateways never work as it will check only the first one from the routing table. The solution is create multiple routing tables and have 1 gateways for each of them. The only matter is how we can set the rule to identify the traffic.
                  
              I got the suse 10 today and started trying on that.
               
              Regards
              Jaison

               
              On 11/1/05, Jaison Jose <jaittu@...> wrote:
              Hi Dirk,
               
                    In the diagram just imagine that eth1 and 2 also connected with 2 other routers. What I need is I want to ping from 'something' (In the diagram,Can be a PC) to the connected interface of our linux box.
               
                   Multiple default gateways will not work as it will only check the first one.
               
                  Could you please guide me is there any applications to make the diagram which you made her so that I can explain little bit more as my english is so weak.
               
              Regards
              Jaison.
               
              On 11/1/05, Dirk Tilger <dirk@... > wrote:
              On Tue, Nov 01, 2005 at 03:51:15AM -0800, Moeen Alinaghian wrote:
              > ifconfig eth0 10.0.1.10 netmask 255.255.255.0 up
              > ifconfig eth1 10.0.2.10 netmask 255.255.255.0 up
              > ifconfig eth2 10.0.3.10 netmask 255.255.255.0 up
              > route add default gw 10.0.1.1 dev eth0
              > route add default gw 10.0.2.1 dev eth1
              > route add default gw 10.0.3.1 dev eth2
              >
              > what's the result, now ?

              He should have three different default routes. The system will try to
              use the first one and only if the interface is down, it will try the
              second. It might be with a very modern scheduler the packets will be
              distributed in round-robin fashion.

              Routing as shown above is destination only routing. The system should
              have a routing table like...

              10.0.1.0/24 -> eth0
              10.0.2.0/24 -> eth1
              10.0.3.0/24 -> eth2

              ...just from the ifconfig (ifconfig adds routes to interfaces fitting
              their destination). 'default' is a special target which should map to
              0.0.0.0/0. When I issue the first routing command, I would expect
              something like

              0.0.0.0/0 -> 10.0.1.1 via eth0

              The other two would add
              0.0.0.0/0 -> 10.0.2.1 via eth1
              0.0.0.0/0 -> 10.0.3.1 via eth2

              When we order the routing table as the kernel would do: smaller netmasks
              first, we would get:

              Target            Bits of Netmask            Gateway            Interface
              10.0.1.0      24                  direct(ARP)      eth0
              10.0.2.0      24                  direct(ARP)      eth1
              10.0.3.0      24                  direct(ARP)      eth2
              0.0.0.0            0                  10.0.1.1      eth0
              0.0.0.0            0                  10.0.2.1      eth1
              0.0.0.0            0                  10.0.3.1      eth2

              I'm a kernel and want to deliver a packet to 10.0.2.6, I go down the
              table and do:
              - Is (10.0.2.6 AND 255.255.255.0) == 10.0.1.0?
                --> 10.0.2.0 == 10.0.1.0?
                --> No
              - Is (( 10.0.2.6 AND 255.255.255.0) == 10.0.2.0?
                --> 10.0.2.0 == 10.0.2.0?
                --> Yes
              - What is the gateway and interface? Gateway is local(ARP) via eth1
              - Sending ARP packet to eth1 to lookup address of network card for
                10.0.2.6
              - (getting the address)
              - Sending the packet.

              When I do the same thing for 217.17.202.242 , then the first rule to hit
              is number four, because every packet would match that destination. This
              is why it is called the default route. As long as the interface is up,
              rule 5+6 will never be checked. I'm not sure, but some operating systems
              will even ignore 5+6 when eth0 is down, as their routing mechanism might
              have no concept of interfaces that are down.

              Dirk Tilger
              Advanced Technologies ME FZ LLC
              Tel +971 4 367 1071
              Fax +971 4 367 2529
              Mob +971 50 8809132
                  +966 55 1650025


              SPONSORED LINKS
              Linux operating system Linux os Hosting linux unix web
              Free linux operating system Linux migration Linux user


              YAHOO! GROUPS LINKS





            • Dirk Tilger
              ... That can be done just with normal routing. When you have multiple routes on an interface, you can just do it. Guess you have the networks 10.5.6.0/24 on
              Message 6 of 12 , Nov 5, 2005
              • 0 Attachment
                On Tue, Nov 01, 2005 at 11:00:58PM +0400, Jaison Jose wrote:
                > In the diagram just imagine that eth1 and 2 also connected with 2 other
                > routers. What I need is I want to ping from 'something' (In the diagram,Can
                > be a PC) to the connected interface of our linux box.

                That can be done just with normal routing. When you have multiple routes
                on an interface, you can just do it. Guess you have the networks
                10.5.6.0/24 on the router 172.16.15.14 and 10.7.8.9/24 on the router
                172.16.17.18 then you would do:

                route add -net 10.5.6.0 netmask 255.255.255.0 gw 172.16.15.14
                route add -net 10.7.8.9 netmask 255.255.255.0 gw 172.16.17.18

                The interfaces would be choosen by the kernel so that the routers
                172.16.15.14 and 172.16.17.18 can be reached.

                > Could you please guide me is there any applications to make the diagram
                > which you made her so that I can explain little bit more as my english is so
                > weak.

                Well...I just draw it in my preffered mail editor, which is vim.

                Dirk Tilger
                Advanced Technologies ME FZ LLC
                Tel +971 4 367 1071
                Fax +971 4 367 2529
                Mob +971 50 8809132
                +966 55 1650025
              • Dirk Tilger
                ... That is not true. Every Internet router has at least two gateways. Multiple *default* gateways may not work. Dirk Tilger Advanced Technologies ME FZ LLC
                Message 7 of 12 , Nov 5, 2005
                • 0 Attachment
                  On Tue, Nov 01, 2005 at 11:10:03PM +0400, Jaison Jose wrote:
                  > The multiple gateways never work

                  That is not true. Every Internet router has at least two gateways.
                  Multiple *default* gateways may not work.

                  Dirk Tilger
                  Advanced Technologies ME FZ LLC
                  Tel +971 4 367 1071
                  Fax +971 4 367 2529
                  Mob +971 50 8809132
                  +966 55 1650025
                • Yunus Shaikh
                  On Wed, 2005-11-02 at 00:30, Jaison Jose wrote: hi all IPROUTE2 supports Multipath Routing . meaning you can have more than one gateway , balancing traffic on
                  Message 8 of 12 , Nov 7, 2005
                  • 0 Attachment
                    On Wed, 2005-11-02 at 00:30, Jaison Jose wrote:

                    hi all
                    IPROUTE2 supports Multipath Routing . meaning you can have more than one
                    gateway , balancing traffic on more than one ext interface
                    however the alogrithm is based on round robin ,
                    you can set up multipath routing by checking the option in kernel (
                    Advanced Routing)

                    ip route add default nexthop via {IPADD1} dev {IFACE1} weight 1 \
                    nexthop via {IPADD2} dev {IFACE2} weight 1 \
                    nexthop via {IPADD3} dev {IFACE3} weight 1


                    change weight to prefer a particular gateway


                    more information http://lartc.org


                    regards
                    yunus


                    > Hi Dirk,
                    >
                    > In the diagram just imagine that eth1 and 2 also connected with
                    > 2 other routers. What I need is I want to ping from 'something' (In
                    > the diagram,Can be a PC) to the connected interface of our linux box.
                    >
                    > Multiple default gateways will not work as it will only check the
                    > first one.
                    >
                    > Could you please guide me is there any applications to make the
                    > diagram which you made her so that I can explain little bit more as my
                    > english is so weak.
                    >
                    > Regards
                    > Jaison.
                    >
                    > On 11/1/05, Dirk Tilger <dirk@...> wrote:
                    > On Tue, Nov 01, 2005 at 03:51:15AM -0800, Moeen Alinaghian
                    > wrote:
                    > > ifconfig eth0 10.0.1.10 netmask 255.255.255.0 up
                    > > ifconfig eth1 10.0.2.10 netmask 255.255.255.0 up
                    > > ifconfig eth2 10.0.3.10 netmask 255.255.255.0 up
                    > > route add default gw 10.0.1.1 dev eth0
                    > > route add default gw 10.0.2.1 dev eth1
                    > > route add default gw 10.0.3.1 dev eth2
                    > >
                    > > what's the result, now ?
                    >
                    > He should have three different default routes. The system will
                    > try to
                    > use the first one and only if the interface is down, it will
                    > try the
                    > second. It might be with a very modern scheduler the packets
                    > will be
                    > distributed in round-robin fashion.
                    >
                    > Routing as shown above is destination only routing. The system
                    > should
                    > have a routing table like...
                    >
                    > 10.0.1.0/24 -> eth0
                    > 10.0.2.0/24 -> eth1
                    > 10.0.3.0/24 -> eth2
                    >
                    > ...just from the ifconfig (ifconfig adds routes to interfaces
                    > fitting
                    > their destination). 'default' is a special target which should
                    > map to
                    > 0.0.0.0/0. When I issue the first routing command, I would
                    > expect
                    > something like
                    >
                    > 0.0.0.0/0 -> 10.0.1.1 via eth0
                    >
                    > The other two would add
                    > 0.0.0.0/0 -> 10.0.2.1 via eth1
                    > 0.0.0.0/0 -> 10.0.3.1 via eth2
                    >
                    > When we order the routing table as the kernel would do:
                    > smaller netmasks
                    > first, we would get:
                    >
                    > Target Bits of Netmask Gateway
                    > Interface
                    > 10.0.1.0 24 direct(ARP) eth0
                    > 10.0.2.0 24 direct(ARP) eth1
                    > 10.0.3.0 24 direct(ARP) eth2
                    > 0.0.0.0 0 10.0.1.1 eth0
                    > 0.0.0.0 0 10.0.2.1 eth1
                    > 0.0.0.0 0 10.0.3.1 eth2
                    >
                    > I'm a kernel and want to deliver a packet to 10.0.2.6, I go
                    > down the
                    > table and do:
                    > - Is (10.0.2.6 AND 255.255.255.0) == 10.0.1.0?
                    > --> 10.0.2.0 == 10.0.1.0?
                    > --> No
                    > - Is ((10.0.2.6 AND 255.255.255.0) == 10.0.2.0?
                    > --> 10.0.2.0 == 10.0.2.0?
                    > --> Yes
                    > - What is the gateway and interface? Gateway is local(ARP) via
                    > eth1
                    > - Sending ARP packet to eth1 to lookup address of network card
                    > for
                    > 10.0.2.6
                    > - (getting the address)
                    > - Sending the packet.
                    >
                    > When I do the same thing for 217.17.202.242 , then the first
                    > rule to hit
                    > is number four, because every packet would match that
                    > destination. This
                    > is why it is called the default route. As long as the
                    > interface is up,
                    > rule 5+6 will never be checked. I'm not sure, but some
                    > operating systems
                    > will even ignore 5+6 when eth0 is down, as their routing
                    > mechanism might
                    > have no concept of interfaces that are down.
                    >
                    > Dirk Tilger
                    > Advanced Technologies ME FZ LLC
                    > Tel +971 4 367 1071
                    > Fax +971 4 367 2529
                    > Mob +971 50 8809132
                    > +966 55 1650025
                    >
                    >
                    > SPONSORED LINKS
                    > Linux operating
                    > system
                    > Linux os
                    > Hosting linux unix
                    > web
                    > Free linux operating
                    > system
                    > Linux migration
                    > Linux user
                    >
                    > ______________________________________________________________
                    > YAHOO! GROUPS LINKS
                    > 1. Visit your group "dubailug" on the web.
                    >
                    > 2. To unsubscribe from this group, send an email to:
                    > dubailug-unsubscribe@yahoogroups.com
                    >
                    > 3. Your use of Yahoo! Groups is subject to the Yahoo!
                    > Terms of Service.
                    >
                    >
                    > ______________________________________________________________
                    >
                    >
                    >
                    > ______________________________________________________________________
                    > YAHOO! GROUPS LINKS
                    > 1. Visit your group "dubailug" on the web.
                    >
                    > 2. To unsubscribe from this group, send an email to:
                    > dubailug-unsubscribe@yahoogroups.com
                    >
                    > 3. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                    > Service.
                    >
                    >
                    > ______________________________________________________________________
                    --
                    ------------------------------------------------------------------
                    Name : Shaikh Yunus
                    Email primary : yshaikh@...
                    : yshaikh@...
                    Encrypted Mail Preferred
                    PGP ID : 0xA7B0AB1D
                    Fingerprint = 384E B543 F594 6DCA 358D F646 A3A8 0A65 A7B0 AB1D
                    ------------------------------------------------------------------




                    --
                    PRIVACY WARNING: For auditing purposes, a copy of this message has been
                    saved in a permanent database.
                  • Jaison Jose
                    Hi, I successfully configured my system with multiple Routing table with different gateways. Now m system has more than 100 interfaces (of ourse virtual
                    Message 9 of 12 , Nov 10, 2005
                    • 0 Attachment
                      Hi,
                      I successfully configured my system with multiple Routing table with different gateways. Now m system has more than 100 interfaces (of ourse virtual interfaces) and more than 300 routing tables.
                       
                      ip ru add from 10.0.1.2/32 to 0/0 dev eth0.101 table 1
                      ip ro add default via 10.0.1.1 table 1

                      This will make a default gateway 10.0.1.1 for the interface eth0.101. But the problem is all layer 2 traffic is also passed to 10.0.1.1
                       
                      So I made different rules for each network and its works fine.
                       
                      Once again thanks to all.
                      Regards
                      Jaison

                       
                      On 11/8/05, Yunus Shaikh <yshaikh@...> wrote:
                      On Wed, 2005-11-02 at 00:30, Jaison Jose wrote:

                      hi all
                      IPROUTE2 supports Multipath Routing . meaning you can have more than one
                      gateway , balancing traffic on more than one ext interface
                      however the alogrithm is based on round robin ,
                      you can set up multipath routing by checking the option in kernel (
                      Advanced Routing)

                      ip route add default  nexthop via {IPADD1} dev {IFACE1} weight 1 \
                                               nexthop via {IPADD2} dev {IFACE2} weight 1 \
                                        nexthop via {IPADD3} dev {IFACE3} weight 1


                      change weight to prefer a particular gateway


                      more information  http://lartc.org


                      regards
                      yunus



                      > Hi Dirk,

                      >       In the diagram just imagine that eth1 and 2 also connected with
                      > 2 other routers. What I need is I want to ping from 'something' (In
                      > the diagram,Can be a PC) to the connected interface of our linux box.

                      >      Multiple default gateways will not work as it will only check the
                      > first one.

                      >     Could you please guide me is there any applications to make the
                      > diagram which you made her so that I can explain little bit more as my
                      > english is so weak.

                      > Regards
                      > Jaison.

                      > On 11/1/05, Dirk Tilger < dirk@...> wrote:
                      >         On Tue, Nov 01, 2005 at 03:51:15AM -0800, Moeen Alinaghian
                      >         wrote:
                      >         > ifconfig eth0 10.0.1.10 netmask 255.255.255.0 up
                      >         > ifconfig eth1 10.0.2.10 netmask 255.255.255.0 up
                      >         > ifconfig eth2 10.0.3.10 netmask 255.255.255.0 up
                      >         > route add default gw 10.0.1.1 dev eth0
                      >         > route add default gw 10.0.2.1 dev eth1
                      >         > route add default gw 10.0.3.1 dev eth2
                      >         >
                      >         > what's the result, now ?
                      >        
                      >         He should have three different default routes. The system will
                      >         try to
                      >         use the first one and only if the interface is down, it will
                      >         try the
                      >         second. It might be with a very modern scheduler the packets
                      >         will be
                      >         distributed in round-robin fashion.
                      >        
                      >         Routing as shown above is destination only routing. The system
                      >         should
                      >         have a routing table like...
                      >        
                      >         10.0.1.0/24 -> eth0
                      >         10.0.2.0/24 -> eth1
                      >         10.0.3.0/24 -> eth2
                      >        
                      >         ...just from the ifconfig (ifconfig adds routes to interfaces
                      >         fitting
                      >         their destination). 'default' is a special target which should
                      >         map to
                      >         0.0.0.0/0. When I issue the first routing command, I would
                      >         expect
                      >         something like
                      >        
                      >         0.0.0.0/0 -> 10.0.1.1 via eth0
                      >        
                      >         The other two would add
                      >         0.0.0.0/0 -> 10.0.2.1 via eth1
                      >         0.0.0.0/0 -> 10.0.3.1 via eth2
                      >        
                      >         When we order the routing table as the kernel would do:
                      >         smaller netmasks
                      >         first, we would get:
                      >        
                      >         Target            Bits of Netmask            Gateway    
                      >         Interface
                      >         10.0.1.0      24                  direct(ARP)      eth0
                      >         10.0.2.0      24                  direct(ARP)      eth1
                      >         10.0.3.0      24                  direct(ARP)      eth2
                      >         0.0.0.0            0                  10.0.1.1      eth0
                      >         0.0.0.0            0                  10.0.2.1      eth1
                      >         0.0.0.0            0                  10.0.3.1      eth2
                      >        
                      >         I'm a kernel and want to deliver a packet to 10.0.2.6, I go
                      >         down the
                      >         table and do:
                      >         - Is ( 10.0.2.6 AND 255.255.255.0) == 10.0.1.0?
                      >           --> 10.0.2.0 == 10.0.1.0?
                      >           --> No
                      >         - Is ((10.0.2.6 AND 255.255.255.0) == 10.0.2.0?
                      >           --> 10.0.2.0 == 10.0.2.0?
                      >           --> Yes
                      >         - What is the gateway and interface? Gateway is local(ARP) via
                      >         eth1
                      >         - Sending ARP packet to eth1 to lookup address of network card
                      >         for
                      >           10.0.2.6
                      >         - (getting the address)
                      >         - Sending the packet.
                      >        
                      >         When I do the same thing for 217.17.202.242 , then the first
                      >         rule to hit
                      >         is number four, because every packet would match that
                      >         destination. This
                      >         is why it is called the default route. As long as the
                      >         interface is up,
                      >         rule 5+6 will never be checked. I'm not sure, but some
                      >         operating systems
                      >         will even ignore 5+6 when eth0 is down, as their routing
                      >         mechanism might
                      >         have no concept of interfaces that are down.
                      >        
                      >         Dirk Tilger
                      >         Advanced Technologies ME FZ LLC
                      >         Tel +971 4 367 1071
                      >         Fax +971 4 367 2529
                      >         Mob +971 50 8809132
                      >             +966 55 1650025
                      >        
                      >        
                      >         SPONSORED LINKS
                      >         Linux operating
                      >         system
                      >         Linux os
                      >         Hosting linux unix
                      >         web
                      >         Free linux operating
                      >         system
                      >         Linux migration
                      >         Linux user
                      >        
                      >         ______________________________________________________________
                      >         YAHOO! GROUPS LINKS
                      >              1.  Visit your group "dubailug" on the web.
                      >                 
                      >              2.  To unsubscribe from this group, send an email to:
                      >                  dubailug-unsubscribe@yahoogroups.com
                      >                 
                      >              3.  Your use of Yahoo! Groups is subject to the Yahoo!
                      >                 Terms of Service.
                      >        
                      >        
                      >         ______________________________________________________________
                      >
                      >
                      >
                      > ______________________________________________________________________
                      > YAHOO! GROUPS LINKS
                      >      1.  Visit your group "dubailug" on the web.
                      >         
                      >      2.  To unsubscribe from this group, send an email to:
                      >          dubailug-unsubscribe@yahoogroups.com
                      >         
                      >      3.  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                      >         Service.
                      >
                      >
                      > ______________________________________________________________________
                      --
                      ------------------------------------------------------------------
                      Name                       : Shaikh Yunus
                      Email primary              : yshaikh@...
                                        : yshaikh@...
                      Encrypted Mail Preferred
                      PGP ID                  : 0xA7B0AB1D
                      Fingerprint = 384E B543 F594 6DCA 358D F646 A3A8 0A65 A7B0 AB1D
                      ------------------------------------------------------------------
                           



                      --
                      PRIVACY WARNING: For auditing purposes, a copy of this message has been
                      saved in a permanent database.



                      YAHOO! GROUPS LINKS




                    • Dirk Tilger
                      ... Should you come to the LUG meeting on Tuesday, you ll have to help me understanding why you chose this way. There is most probably something I ve overseen,
                      Message 10 of 12 , Nov 10, 2005
                      • 0 Attachment
                        On Thu, Nov 10, 2005 at 06:11:23PM +0400, Jaison Jose wrote:
                        > So I made different rules for each network and its works fine.
                        > Once again thanks to all.

                        Should you come to the LUG meeting on Tuesday, you'll have to help me
                        understanding why you chose this way. There is most probably something
                        I've overseen, but I don't yet got the point.

                        Dirk Tilger
                        Advanced Technologies ME FZ LLC
                        Tel +971 4 367 1071
                        Fax +971 4 367 2529
                        Mob +971 50 8809132
                        +966 55 1650025
                      • Jaison Jose
                        Sure, not a problem at all. Looking forward for the meeting.. Regards Jaison
                        Message 11 of 12 , Nov 11, 2005
                        • 0 Attachment
                          Sure, not a problem at all. Looking forward for the meeting..
                          Regards
                          Jaison

                           
                          On 11/10/05, Dirk Tilger <dirk@...> wrote:
                          On Thu, Nov 10, 2005 at 06:11:23PM +0400, Jaison Jose wrote:
                          >  So I made different rules for each network and its works fine.
                          >  Once again thanks to all.

                          Should you come to the LUG meeting on Tuesday, you'll have to help me
                          understanding why you chose this way. There is most probably something
                          I've overseen, but I don't yet got the point.

                          Dirk Tilger
                          Advanced Technologies ME FZ LLC
                          Tel +971 4 367 1071
                          Fax +971 4 367 2529
                          Mob +971 50 8809132
                              +966 55 1650025


                          YAHOO! GROUPS LINKS




                        Your message has been successfully submitted and would be delivered to recipients shortly.