Results 1 to 8 of 8

Thread: Add ip rule to routing policy database at startup

  1. #1

    Default Add ip rule to routing policy database at startup

    Hi
    I need to route all traffic from host A via gateway B. I use iproute2: "ip rule add from A lookup B". Is there already existant script where I can put "ip rule add" command or do I have to create my own custom startup script for this?

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,834

    Default Re: Add ip rule to routing policy database at startup

    I do not even have a iproute2 program, so I may misunderstand you completely. But it seems to me that B is your default router. You can configure that in YaST > Network devices > Network cards and the tab Routing. Put the ip address of B in the default route field and Finish.
    Henk van Velden

  3. #3

    Default Re: Add ip rule to routing policy database at startup

    B is not my default router, my default router is C. iproute2 commands let you send traffic from different host or different kinds of traffic through different routers. I can not do this with Yast.

  4. #4
    Join Date
    Aug 2008
    Location
    Temporarily, planet Earth
    Posts
    104

    Default Re: Add ip rule to routing policy database at startup

    Quote Originally Posted by leschenko View Post
    Hi
    I need to route all traffic from host A via gateway B. I use iproute2: "ip rule add from A lookup B". Is there already existant script where I can put "ip rule add" command or do I have to create my own custom startup script for this?
    I did a quick grep in the /etc directory and could not find a reference in an existing script. You could create a script to add and remove the command in /etc/sysconfig/network/scripts. Then in /etc/sysconfig/network/if-up.d and if-down.d symbolic links to that scripts.

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,834

    Default Re: Add ip rule to routing policy database at startup

    I did Google a bit about iproute2. It seems to be a replacement for several long existing network configuration statedments that still exist. So in this case I suppose that you use iproute2 to do the same as good old route add. But in that case I do not understand that you do not simply use YaST to configure the route. YaST will place the correct definition in /et/sysconf/network/routes so that it is used at every boot.

    Doesn't that work for you?
    Henk van Velden

  6. #6

    Default Re: Add ip rule to routing policy database at startup

    Quote Originally Posted by BotKeeper View Post
    I did a quick grep in the /etc directory and could not find a reference in an existing script. You could create a script to add and remove the command in /etc/sysconfig/network/scripts. Then in /etc/sysconfig/network/if-up.d and if-down.d symbolic links to that scripts.
    Thanks. I'll do that.

  7. #7

    Default Re: Add ip rule to routing policy database at startup

    Quote Originally Posted by hcvv View Post
    I did Google a bit about iproute2. It seems to be a replacement for several long existing network configuration statedments that still exist. So in this case I suppose that you use iproute2 to do the same as good old route add. But in that case I do not understand that you do not simply use YaST to configure the route. YaST will place the correct definition in /et/sysconf/network/routes so that it is used at every boot.

    Doesn't that work for you?
    You are not quite right. iproute2 is more powerfull tool than ifconfig, route, etc. I use it to forward traffic from different hosts via different gateways. You can not do this with route command. Alas yast can not work with iproute2

  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,834

    Default Re: Add ip rule to routing policy database at startup

    Quote Originally Posted by leschenko View Post
    You are not quite right. iproute2 is more powerfull tool than ifconfig, route, etc. I use it to forward traffic from different hosts via different gateways. You can not do this with route command. Alas yast can not work with iproute2
    Thanks for the explanation.

    What about an extra script in /etc/init.d/ (based on /etc/init.d/skeleton)? I think the skeleton gives you ideas on how to let it be run after the script network and before other scripts that start services that may rely on it being run earlier.
    Henk van Velden

Tags for this Thread

Posting Permissions

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