In article <e15dj8$95c$***@orkan.itea.ntnu.no>,
=?ISO-8859-1?Q?Bj=F8rnar_Lib=E6k?= <***@gmail.com> wrote:
:Robert Nichols wrote:
:
:> Looking at the manpage for ip(8) on my FC-5 machine, I see, "Warning:
:> Route NAT is no longer supported in Linux 2.6."
:
:Ok.. that's why. I guess I could do a reboot using my old 2.4 kernel.
:But still, why removing this functionallity in 2.6? Beats me.
:
:> Thinking about this a bit, what bothers me is why packets arriving via
:> the ham0 tunnel haven't already had their source addresses translated to
:> one in the 5.0.0.0 network. If B thinks it is communicating with its
:> real address and you send back a reply to fake.addr.of.B, _something_
:> will have to translate that back to real.addr.of.B or else B won't
:> recognize the reply and associate it with the right connection.
:> Whatever is doing that translation should already have modified the
:> source address in the original packet received by A.
:
:No, I think maybe you forget about the concept of tunneling. Both real
:and fake addresses are in the 5.0.0.0 network. When a packet is destined
:to an address in this network, the packet is routed to the ham0 inteface
:(as normal). This "interface" will then encrypt the content, and
:encapsulate the original packet with a new IP header using the "really
:real" routable ip addresses of the computers (eth0). No "translation"
:necessary here, only adding and stripping IP headers.
The problem with not using actual IP address in these messages is that
it hides the information that the real address of B is in the ham0
tunnel. I was thinking it was not, and was guessing at what the heck
might be happening. Going back to the start of the thread I see that
the tunnel is really irrelevant to the problem.
:> You can force the translation on machine A by routing packets out the
:> loopback interface (policy routing based on source of real.addr.of.B)
:> and doing the SNAT translation on the way out. Deliver them to the
:> local process when they come back in. But, unless you arrange for reply
:> packets to follow that same loop back, you're going to end up with two
:> half-open UNREPLIED conntrack entries. That's likely to make
:> communication unreliable, if it even works at all.
:
:
:This is starting to get ugly, but I had to try:) Now there seems to bee
:som issues about the source based routing. I created a new routing table
:like this:
:
:[***@A] echo "100 hamsrc" >> /etc/iproute2/rt_tables
:[***@A] ip route add 5.0.0.0/8 dev lo table hamsrc
:
:and added the source routing policy entry like this:
:
:[***@A] ip rule add from real.addr.of.B table hamsrc
:[***@A] ip route flush cache
:
:finally, I added SNAT on POSTROUTING for lo interface
:
:[***@A] iptables -A POSTROUTING -t nat -o lo -s real.addr.of.B -j SNAT
:--to-source fake.addr.of.B
:
:But the packet still arrives to the application without being SNAT'ed,
:and "tcpdum -i lo" is quiet like a child on its mother's breast. Any
:obvious mistakes here? And yes, /proc/sys/net/ipv4/ip_forward is '1'.
:
:I will try the kernel 2.4 approach sometime soon, but I'm really
:starting get tired of this whole matter..
I'm giving up. This is beyond me.
--
Bob Nichols AT comcast.net I am "RNichols42"