Skip to content


Subversion checkout URL

You can clone with
Download ZIP
108 lines (83 sloc) 4.43 KB
=== BUILDING ===
These packages supply an Iptables plugin and kernel module and that
allow rewriting of the destination IP address for IPv4 and IPv6.
To build the packages (RPMs) for your OS, type:
$ make
RPMs will be in:
$ ls -l build-*/RPMS/* build-src/SRPMS
In this release, RHEL4, RHEL5, RHEL6, and Fedora 17 are directly
supported. When typing "make" on one of these systems, the build
environment should just (hopefully) do the right thing for you.
Even if on different system, but closely related, it should still
work for you. You may want to read further though if you need to
tune or alter the build environment or if you're on a different
build system than one of the supported and tested ones and your
build breaks.
When building natively (the binary RPMs are built in the host
environment), the script "config-native" will be invoked to create
a "" file for you with its best guess at how to
configure the build environment for your system.
The script firest determines what operating system to build for
by setting the PLATFORMS, OSMACRO_* and OSMACROVER_* macros. The
values of these macros correspond to the same settings used by the
OpenSUSE Build Service. See:
You'll see the values of these macros passed to rpmbuild and are
used by the "iptables-daddr.spec" spec file to control which sources
are selected to build based on which versions of iptables and kernel
are in use by the selected OS.
The script also examines the currently installed kernel devel
packages for the kernel variants (kvariants) to build by setting the
KVARIANTS_* macro. If you want to change which kernel it looks for,
use the -r option. If you want to limit which kvariants it looks
for, use the -k option. For example:
$ uname -r
$ rpm -qa | grep kernel | grep devel
By default using "uname -r", config-native would select the
kvariants for 2.6.9-101.EL which are '"" smp xenU".
If invoking "./config-native -r 2.6.9-100.EL", it would only select
kvariants for 'largesmp' since kernel-largesmp-devel is only
installed for that kernel (and would also add an additional macro
Kverrel_* for selecting that kernel to build for).
If invoking "./config-native -k '"" xenU'", it would only select the
kvariants for '"" xenU' ignoring smp.
You can control the arguments to config-native when calling "make"
by setting the CONFIG_ARGS variable. For example:
$ make CONFIG_ARGS="-r 2.6.9-101.EL -k '\"\" xenU'
If you change "config-native" to support a system other than the
ones listed above, please send me your patches.
For systems not using yum and rpm, porting will be more complex,
primarily changing the "mk/" and "mk/Makefile.sub"
files. If you make changes to port to other systems that can be
folded back into the existing build system, please send me your
patchset for review.
=== USING ===
A practical application of this software is to do L3DSR (Level 3
Direct Server Return). For an overview, see Jan Schaumann's slides,
For example, to use iptables-daddr you have two Load Balancers (LBs)
with two VIPs (e.g. and and several
servers behind them. The LBs must be able to rewrite the DSCP field
of incoming, forwarded packets (or in some way mark the packets such
that an iptables match rule on the servers can identify them).
For example, the first VIP will set the DSCP field to 1 for its
packets going to the servers, where the second VIP will set the
DSCP field to 2. This will allow the servers to know what to set
the destination address to in reply packets they send directly
to client machines.
On each server, create lookback interfaces corresponding to the VIPs
and iptables rules to set the return address on the packets:
# ifconfig lo:1 netmask
# ifconfig lo:2 netmask
# iptables -t mangle -A INPUT -m dscp --dscp 1 -j DADDR --set-daddr=
# iptables -t mangle -A INPUT -m dscp --dscp 2 -j DADDR --set-daddr=
An example for IPv6:
# ifconfig lo:3 add fc00:1000:0:6::10/128
# ifconfig lo:4 add fc00:1000:0:6::21/128
# ip6tables -t mangle -A INPUT -m dscp --dscp 10 -j DADDR --set-daddr=fc00:1000:0:6::10
# ip6tables -t mangle -A INPUT -m dscp --dscp 11 -j DADDR --set-daddr=fc00:1000:0:6::21
Jump to Line
Something went wrong with that request. Please try again.