-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
>>>>> Björn Keil writes:
Björn> Hello,
Björn> I am having a slight problem with a service that needs to reserve IP
Björn> addresses the host doesn't have at the time the service starts (It is
Björn> supposed to operate in backup mode).
Björn> I've been trying to actually use loopback addresses for theservice and
Björn> then route the external address to the loopback address, but this
Björn> doesn't seem to work properly.
Björn> #!/bin/bash
Björn> iptables -t nat -A POSTROUTING --source 127.0.1.3 \
Björn> -j SNAT --to-source 10.120.1.3
Björn> iptables -t nat -A PREROUTING --destination 10.120.1.3 \
Björn> -j DNAT --to-destination 127.0.1.3
Björn> echo 1 > /proc/sys/net/ipv4/ip_forward
Björn> #End sample
- ---- Quoting from iptables(8):
REDIRECT
This target is only valid in the nat table, in the PREROUTING
and OUTPUT chains, and user-defined chains which are only called from
those chains. It redirects the packet to the machine itself by
changing the destination IP to the primary address of the incoming
interface (locally-generated packets are mapped to the 127.0.0.1
address). It takes one option:
--to-ports port[-port]
This specifies a destination port or range of ports to
use: without this, the destination port is never altered.
This is only valid if the rule also specifies -p tcp or -p
udp.
--random
If option --random is used then port mapping will be
randomized (kernel >= 2.6.22).
- ---- End Quote
HTH
- --
Ashish Shukla आशीष शुक्ल
http://wahjava.wordpress.com/
·-- ·- ···· ·--- ·- ···- ·- ·--·-· --· -- ·- ·· ·-·· ·-·-·- -·-· --- --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
iEYEARECAAYFAkgu11cACgkQHy+EEHYuXnQOWQCgoarQpaYlF0 s87X2RPvSB9xJU
muAAnA+8wESkvRQxbu+5dgb92zcMGF9u
=41ch
-----END PGP SIGNATURE-----