Gentoo Archives: gentoo-user

From: Grant Edwards <grant.b.edwards@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: Where to put advanced routing configuration?
Date: Sun, 06 Oct 2013 16:17:13
Message-Id: l2s2cq$e8k$1@ger.gmane.org
In Reply to: [gentoo-user] Where to put advanced routing configuration? by Grant Edwards
1 On 2013-10-03, Grant Edwards <grant.b.edwards@×××××.com> wrote:
2
3 > Let's say you wanted to configure routing of TCP packets based on destination
4 > port like in this example:
5 >
6 > http://www.tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.netfilter.html
7 >
8 > [which contains a series of 'ip' and 'iptables' commands to get packets
9 > destined for port 25 to use a specific gateway.]
10 >
11 > How do do this the "right" way on a Gentoo system?
12 >
13 > Based on reading http://www.gentoo.org/doc/en/home-router-howto.xml, I think
14 > I've figured out how to do the iptables part: you enter the 'iptables'
15 > commands by hand to get the iptables set up the way you want, then you do
16 > this:
17 >
18 > # /etc/init.d/iptables save
19 > # rc-update add iptables default
20
21 FWIW, it turns out using that facility wasn't appropriate. The
22 iptables rules were dependent on info that's only available after the
23 interface comes up and obtains its configuration via DHCP. So
24 everyting (both 'ip' commands and 'iptables' commands ended up in
25 /etc/conf.d.net in the postup() function for setup and the predown()
26 function for teardown.
27
28 --
29 Grant