Skip to contentSkip to conversation

netfilter-extensions-HOWTO.sgml updated for ROUTE target

PATCH Applied Cédric de Launois 2 participants 2 messages Jun 17, 2002 – Jun 18, 2002 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter-extensions-HOWTO.sgml updated for ROUTE target

Hi,

Here's a patch to update the netfilter-extensions-HOWTO.sgml (english version) for the new ROUTE target.

I'm planning to also update the french version of this HOWTO since it's my mother tongue.

The patch is to apply on

/cvsroot/netfilter/HOWTO/netfilter-extensions-HOWTO.sgml

Cedric de Launois

netfilter-extensions-HOWTO.sgml renamed from netfilter-extensions-HOWTO.sgml.orig +0 -0
@@ -1043,6 +1043,77 @@
 <url url="http://www.gnumonks.org/projects/ulogd" name="web page">

containing the proper documentation
for ULOG, so there is no point for me to explain this here..

+<sect1>ROUTE patch
+<p>
+This patch by Cédric de Launois &lt;[email protected]&gt; adds a new target
+which allows you to directly route a packet towards a specified interface,
+even and especially if the packet IP address is one of the router itself.
+Since the kernel locally delivers those packets, they cannot be forwarded to
+another computer using the standard routing mechanisms. +Sometimes, this is useful to do that, without modifying the packets. +
+<p>
+Options supported by the ROUTE target are :
+
+<descrip>
+<tag>--iface name</>
+Send the packet directly through the interface with the name specified. +<tag>--ifindex index</>
+Send the packet directly through the interface with the index specified.
+This is Useful when you want to remove a rule with an interface which doesn't
+exist anymore (e.g. a tunnel which has been destroyed). +</descrip>
+
+<p>
+For example, assume that you want to install a service, say ssh, on a +computer inside your network. But, you also want this service to appear +exactly as if it was located on the router itself, including the +fact that the packets remain unmodified. This prevents us using the +standard port forwarding mechanism.
+
+<p>
+A solution is to simply reroute packets with destination port 22 to the +computer having the same IP as the router and hosting the ssh service, +thanks to this ROUTE target and an ipip tunnel.
+
+<p>
+Time for ASCII art :
+<verb>
+ eth0 +------+ 192.168.0.1 192.168.0.2 +----+

+    ----------------|router|--------------------------------|host|
+    IP: 150.150.0.1 +------+                                +----+
+                       | | tunl1              IP: 150.150.0.1 | |
+                       | +------------------------------------+ |
+                       +----------------------------------------+

+ IPIP tunnel
+</verb>
+<p>
+It is not possible to reroute those packets using the standard routing +mechanisms, simply because the kernel thinks those packets should be +locally delivered (they contain the IP address of the router itself). +
+<p>
+The ROUTE target provides a way to do that. For our example above, we +would add the following rules :
+
+<tscreen><verb>
+# iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 22 -j ROUTE --iface tunl1
+# iptables -A PREROUTING -t nat -i tunl1 --j ROUTE --iface eth0 +
+# iptables -L PREROUTING -t nat
+Chain PREROUTING (policy ACCEPT)

+target     prot opt source               destination         
+ROUTE      tcp  --  anywhere             anywhere           tcp dpt:ssh

ROUTE iface tunl1(7)
+ROUTE all -- anywhere anywhere ROUTE iface
eth0(3)
+</verb></tscreen>
+
+<p>
+The first rule is for rerouting packet coming from the Internet, and the second
+one is for rerouting all packets coming from the host. The value shown inside parentheses
+after the interface name is the interface index. We use the nat table +because this table provides a PREROUTING hook, but this does not imply any packet
+alteration.
+
<sect>New connection tracking patches
<p>
In this sections, we will show the available connection tracking/nat
patches.

netfilter-extensions-HOWTO.sgml renamed from netfilter-extensions-HOWTO.sgml.orig +71 -0

77 lines not on this page · raw message

#1 lore raw

Salut Cédric,

Quoted 7 lines · Cédric de Launois

Hi,
Here's a patch to update the netfilter-extensions-HOWTO.sgml (english version) for the new ROUTE target.
I'm planning to also update the french version of this HOWTO since it's my mother tongue.
The patch is to apply on
/cvsroot/netfilter/HOWTO/netfilter-extensions-HOWTO.sgml

Applied both en/fr patches. Thank you very much.

Have a nice day,

Fabrice.
--
Fabrice MARIE
Senior R&D Engineer
Celestix Networks
http://www.celestix.com/

"Silly hacker, root is for administrators"
-Unknown