From: "Gáspár Lajos" <swifty@freemail.hu>
To: Matevz Langus <matevz.langus@borea.si>
Cc: netfilter@lists.netfilter.org
Subject: Re: how to change ip source address of incoming packets
Date: Wed, 15 Nov 2006 09:13:07 +0100 [thread overview]
Message-ID: <455ACC13.2070801@freemail.hu> (raw)
In-Reply-To: <20768C3A-7F88-4816-8B52-2DE7A6910C64@borea.si>
Matevz Langus írta:
> Does anyone know how to change ip source address when entering Linux
> interface to something else and when leaving out the same interface
> (backwards) changing it back.
>
> The problem is this:
>
> I have 10 devices with the same IP address, 192.168.1.1. They are
> connected to ethernet switch, which adds VLAN TAG to packets from each
> device. Linux box is connected to the switch. It is possible to create
> 10 VLAN interfaces on the Linux box and only one 192.168.1.1 address
> will be seen per interface. In order to establish TCP connections to
> all devices at the same time, source address must be altered.
>
> on eth0.10, INPUT SRC 192.168.1.1 -> 192.168.10.1
> on eth0.10, OUTPUT DST 192.168.10.1 -> 192.168.1.1
> on eth0.11, INPUT SRC 192.168.1.1 -> 192.168.11.1
> on eth0.11, OUTPUT DST 192.168.11.1 -> 192.168.1.1
> ...
>
Try this :
iptables -t nat -A POSTROUTING -j SNAT -i eth0.10 -s 192.168.1.1
--to-source 192.168.10.1
iptables -t nat -A PREROUTING -j DNAT -o eth0.10 -d 192.168.10.1
--to-destination 192.168.1.1
> thanks,
> Matevz Langus
>
>
Swifty
next prev parent reply other threads:[~2006-11-15 8:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-15 7:15 how to change ip source address of incoming packets Matevz Langus
2006-11-15 8:13 ` Gáspár Lajos [this message]
2006-11-15 8:25 ` Matevz Langus
2006-11-15 9:31 ` Gáspár Lajos
2006-11-15 9:35 ` Gáspár Lajos
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=455ACC13.2070801@freemail.hu \
--to=swifty@freemail.hu \
--cc=matevz.langus@borea.si \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox