From: J Richard Glass <richard@mikeradford.org>
To: netfilter@lists.netfilter.org
Subject: Using iptables with marks, fwmarks and ip tables and routes
Date: Fri, 22 Sep 2006 10:55:47 -0700 [thread overview]
Message-ID: <cc2f7c40260241bbf8304b5c45fa29ef@localhost> (raw)
Hi,
I am hoping for some enlightenment
We have a dial-out server that will be establishing multiple ppp connections with remote ppp servers. In our case all the destination ip addresses are the same (same ips on different servers).
To make sure packets go out the appropriate interface, we assign a temporary destination address that is associated with an interface. In the OUTPUT hook mangle table we mark the packet with a flag that will route it to its interface. The packet destination address is then translated (DNAT) to its real ip address and we use the mark to routes the packet out the correct interface.
Here are the commands we issue to iptables and ip:
iptables -v -t mangle -A OUTPUT -d 10.9.0.1 -j MARK --set-mark 11
iptables -v -t nat -A OUTPUT -d 10.9.0.1 -j DNAT --to-destination 192.168.1.1
ip rule add fwmark 11 table 11
ip route add dev ppp0 table 11
Table of IP Addresses to Interface
10.9.0.1 => table 11 => ppp0
10.9.0.2 => table 12 => ppp1 etc.
We've gotten this to work with NICs using ethernet connections, but now we are starting with the modems and the ppp interfaces don't come up until connections are made. Since all the routing rules are static and determined beforehand, would it be possible to create placeholder ppp interfaces and then write iptables and ip rules using the placeholders? We'd prefer to have this set up independent of our software.
Thanks for the help.
-richard
reply other threads:[~2006-09-22 17:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cc2f7c40260241bbf8304b5c45fa29ef@localhost \
--to=richard@mikeradford.org \
--cc=netfilter@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.