3
1
I would like to change source ip address according to ip address and interface it came in. Let's consider following example:
-----------------------------
| |
| host 1 |
| |
| application |
| |
| eth0 |
-----------------------------
|
| IP0-IP47
|
-----------------------------
| eth0 |
| host 2 |
| |
| NAT |
| |
| eth1.1 eth1.2 eth1.3 |
-----------------------------
| | |
| | |
IP0-IP15 IP0-IP15 IP0-IP15
Host 2 is receiving messages on interfaces eth1.1, eth1.2, eth1.3. On each interface there are 16 hosts with 16 unique ip addresses, but these 16 ip addresses are the same on all interfaces. I need to do NAT so the source ip is altered based on src ip and interface it came in in order to have 48 unique source ip addresses for messages going to application.
Application running on the most-down hosts and their ip cannot be changed. That's why i decided to put them into VLANs.
I searched through various tutorials and HOWTOs but I was unable to find what I am looking for. The problem is: SNAT is usable only in POSTROUTING chain, but in POSTROUTING I do not have information about the interface it came in.
Am I right with my assumption? I am new to this network stuff so any help and advice would be helpful.
Thanks for your help.
This solution works fine for NAT with multiple external interfaces and one or multiple internal interfaces. – scai – 2016-11-17T13:41:39.817