openSUSE Forums > Network/Internet » Add ip rule to routing policy database at startup

Go Back   openSUSE Forums > Network/Internet
Forums FAQ Members List Search Today's Posts Mark Forums Read


Network/Internet Questions about internet applications, network configuration, usage (SAMBA, network printing, NFS)

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 22-Oct-2009, 08:27
Puzzled Penguin
 
Join Date: Oct 2009
Posts: 4
leschenko hasn't been rated much yet
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?
Reply With Quote
  #2 (permalink)  
Old 22-Oct-2009, 08:57
hcvv's Avatar
Wise Penguin
 
Join Date: Jun 2008
Location: Netherlands
Posts: 1,910
hcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enough
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
Reply With Quote
  #3 (permalink)  
Old 23-Oct-2009, 00:28
Puzzled Penguin
 
Join Date: Oct 2009
Posts: 4
leschenko hasn't been rated much yet
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.
Reply With Quote
  #4 (permalink)  
Old 24-Oct-2009, 22:02
Student Penguin
 
Join Date: Aug 2008
Location: Temporarily, planet Earth
Posts: 50
BotKeeper hasn't been rated much yet
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.
Reply With Quote
  #5 (permalink)  
Old 25-Oct-2009, 06:26
hcvv's Avatar
Wise Penguin
 
Join Date: Jun 2008
Location: Netherlands
Posts: 1,910
hcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enough
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
Reply With Quote
  #6 (permalink)  
Old 26-Oct-2009, 03:39
Puzzled Penguin
 
Join Date: Oct 2009
Posts: 4
leschenko hasn't been rated much yet
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.
Reply With Quote
  #7 (permalink)  
Old 26-Oct-2009, 03:48
Puzzled Penguin
 
Join Date: Oct 2009
Posts: 4
leschenko hasn't been rated much yet
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
Reply With Quote
  #8 (permalink)  
Old 26-Oct-2009, 04:10
hcvv's Avatar
Wise Penguin
 
Join Date: Jun 2008
Location: Netherlands
Posts: 1,910
hcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enough
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
Reply With Quote
Reply

Bookmarks

Tags
iproute2 rule startup


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2