Gentoo Archives: gentoo-user

From: thegeezer <thegeezer@×××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Where to put advanced routing configuration?
Date: Sat, 05 Oct 2013 21:01:24
Message-Id: 52507E0E.7080708@thegeezer.net
In Reply to: [gentoo-user] Where to put advanced routing configuration? by Grant Edwards
1 On 10/03/2013 08:27 PM, Grant Edwards wrote:
2 > Let's say you wanted to configure routing of TCP packets based on destination
3 > port like in this example:
4 >
5 > http://www.tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.netfilter.html
6 >
7 > [which contains a series of 'ip' and 'iptables' commands to get packets
8 > destined for port 25 to use a specific gateway.]
9 >
10 > How do do this the "right" way on a Gentoo system?
11 >
12 > Based on reading http://www.gentoo.org/doc/en/home-router-howto.xml, I think
13 > I've figured out how to do the iptables part: you enter the 'iptables'
14 > commands by hand to get the iptables set up the way you want, then you do
15 > this:
16 >
17 > # /etc/init.d/iptables save
18 > # rc-update add iptables default
19 >
20 > What about the 'ip' commands required to set up the tables, routes, and
21 > rules? Do those go in a startup script somewhere? Does one just edit
22 > /etc/iproute2/rt_tables by hand? One would assume route configuration belongs
23 > in /etc/conf.d/net -- I've read through the advanced networking stuff in the
24 > handbook, but it's not apparent to me where those 'ip' command belong.
25 >
26 in /etc/conf.d/net just add the following (adjust as appropriate)
27
28 rules_eth1=(
29 "from all to 8.8.8.8/24 lookup 101"
30 )