Find the answer to your Linux question:
Results 1 to 4 of 4
i am attempting to make direct routing to work.....suppose there are A, B, C, D computers on the same network, how do i make my packets go from A to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2004
    Posts
    7

    how to direct route in RH9


    i am attempting to make direct routing to work.....suppose there are A, B, C, D computers on the same network, how do i make my packets go from A to B to C end stop at D in traceroute?

    i did the following:

    on machine A:
    service network stop
    ifconfig eth0 ip_A netmask 255.255.255.255 up
    route add -host ap_B gw ip_A eth0
    route add -host ap_A gw ip_B eth0

    on machine B:
    service network stop
    ifconfig eth0 ip_B netmask 255.255.255.255 up
    route add -host ap_C gw ip_B eth0
    route add -host ap_B gw ip_C eth0

    on machine C:
    service network stop
    ifconfig eth0 ip_C netmask 255.255.255.255 up
    route add -host ap_D gw ip_C eth0
    route add -host ap_C gw ip_D eth0

    to test the route from ip_A, i did:
    ping ip_B, which worked
    ping ip_C tells me that the network is unreacheable...........any idea why
    and how do i fix it?

    thanks in advance

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Try these routes instead:

    Machine A:
    route add -host ip_B eth0

    Machine B:
    route add -host ip_A eth0
    route add -host ip_C eth0

    Machine C:
    route add -host ip_B eth0
    route add -host ip_D eth0

    Machine D:
    route add -host ip_C eth0

    If I'm understanding what it is that you want to do, that should work.

  3. #3
    Just Joined!
    Join Date
    Feb 2004
    Posts
    7
    does that guranteed that my packets will only go through the route A-B-C-D?

    cuz if i only add route it seems machine A can still reach other machines in the network, and my packets will jump straight to D.............or am i getting this all wrong?

    thanks

  4. #4
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    If you use ifconfig as you did in your post (ie. with a /32 netmask), it won't know how to route anything except those that you have explicitly given routes for. Therefore, if you only give machine A the route info to B, it will only know how to route to B. It hits me, though, that you'll need to do it like this instead:

    Machine A:
    route add -host ip_B eth0
    route add -host ip_C gw ip_B
    route add -host ip_D gw ip_B

    Machine B:
    route add -host ip_A eth0
    route add -host ip_C eth0
    route add -host ip_D gw ip_C

    Machine C:
    route add -host ip_A gw ip_B
    route add -host ip_B eth0
    route add -host ip_D eth0

    Machine D:
    route add -host ip_A gw ip_C
    route add -host ip_B gw ip_C
    route add -host ip_C eth0

    Otherwise, machine A won't know how to route to C or D, and likewise for the other machines.

    Also, remember to enable /proc/sys/net/ipv4/ip_forward on all the systems.

    However, what are you using this for? It might be easier to use the SSRR (Strict Source and Record Route) IP option instead, depending on the application.

Posting Permissions

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