1-to-1 nat mapping over IP in the same subnet.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hello,

This is my first post to that mailing list, therefore if I do something wrong 
please correct me privately (through my email and not the mailing list).

I am attempting to do the following, using iproute2

Linux box
eth0 192.168.1.2 netmask 255.255.255.0 gw 192.168.1.1
eth0:1 192.168.1.3 netmask 255.255.255.0
eth1 192.168.2.1

client #1
eth0 192.168.2.2

client #2
eth0 192.168.2.3

My goal is to have packets of client #1 exiting the Linux box with the src 
address of 192.168.1.2 and the client #2 with the source address of 
192.168.1.3.

Therefore I added this to my setup

ip rule add pref 39 table 5
ip rule add pref 40 from 192.168.2.3 nat 192.168.1.3
ip route add nat 192.168.1.3 via 192.168.2.3 table 5
ip route flush cache

This didn't work even thought that is what is described over the net on how to 
do 1-to-1 nat mapping.  I have compiled my kernel with CONFIG_IP_ROUTE_NAT 
and other ADVANCE_ROUTER flag in but still had no success.

Also the behavior is not always the same, sometimes the packet will go out 
with 192.168.1.2 but when it get back, it doesn't get sent to the 
192.168.2.3.  I have not yet found what difference in entering my rule make 
the packet actually use 192.168.1.3 instead of 1.2.

I'd really appreciate some help in this area.
		
- -- 

Yannick Koehler
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9SDl9fuKOJNEyL1URAv3lAJ4lMf3+N1Eu6bb2bILNz5e0oroR3QCfSKXb
uf0tbxPzOrC3h1qKCEG1S7o=
=TERr
-----END PGP SIGNATURE-----

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux