Outgoing DNAT, incoming SNAT?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



(I posted this in .general earlier, but maybe this is better? I'm not
sure what the significance of _web is, but this question is
network-related.)

I know it's possible to perform SNAT on outgoing packets and DNAT on
incoming ones, for purposes of IP masquerading, but is it possible to
perform DNAT on outgoing packets and SNAT on incoming packets that
match specific IP addresses, or specific IP addresses and ports? If so,
what do I need to do that, and how do I do it?

I have a client program which doesn't allow me to alter the IP/ports to
which it connects, and seeing as I can't compile from source, this
would allow me to connect to a different IP which is accessible and
that in turn connects to the server through port forwarding.

Using iptables in Linux I can accomplish this easily with rules
resembling:

iptables -t nat -A OUTPUT -p tcp -o eth0 -d 64.233.161.99 -dport 80 -j
DNAT --to-destination 216.155.200.155
iptables -t nat -A POSTROUTING -p tcp -s 216.155.200.155 -sport 80 -j
SNAT --to-source 64.233.161.99

which is what I would type to make it so that whenever I tried to
connect out to Google's web server, I would be connected to Altavista
instead. (This is just an example, my client isn't a web client.)

Right now my connection to the internet is through the LAN, behind a
router. I'm assigned an IP address over DHCP.

Thanks,
Matt

.



Relevant Pages

  • Re: persistent connection
    ... see when i first gets connected to the web server on port 80 the web ... the client now see when web server accept this incoming connection ... his port gets bussy till it closes that connection. ...
    (comp.unix.programmer)
  • Re: Data flow when downloading a document from a library
    ... This means that the front end web server needs a lot of network IO. ... best to have 2 network cards, one with a direct connection to the SQL server ... until the transfer to the client is complete. ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: persistent connection
    ... see when i first gets connected to the web server on port 80 the web ... the client now see when web server accept this incoming connection ... his port gets bussy till it closes that connection. ...
    (comp.unix.programmer)
  • Re: "Remote SSH Client Via Web SSL"?
    ... Essentially, I'm trying to get access to a shell host on the same networks as the web server via an SSL'd web page using an SSH client provided by the web server, such that the web server is making the connection on behalf ...
    (comp.unix.bsd.openbsd.misc)
  • [PATCH 0/5] [RFC] AF_RXRPC socket family implementation [try #3]
    ... These patches together supply secure client-side RxRPC connectivity as a Linux ... kernel socket family. ... presentation side is left to the client. ... Each connection goes to a particular "service". ...
    (Linux-Kernel)