LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Two-way NAT routing (https://www.linuxquestions.org/questions/linux-networking-3/two-way-nat-routing-336851/)

MPowers 06-24-2005 01:59 PM

Two-way NAT routing
 
Hello,

I have network like that:


(CLIENT1) (CLIENT2)

((( MY ROUTER)))

(Gateway-192.168.0.1) (Gateway-192.168.0.2)



Client 1 and 2 now is using an internet connection with iptables NAT from gateway-1. But the main idea is to make some ports (ex.6667) from client1 to be forwarded to gateway2's internet connection.

How I can do that?

SirGertrude 06-24-2005 02:24 PM

Depends... Are you saying that your router is the gateway with both IP addresses bound to a single or multiple interfaces, or are you saying that your router is a separate entity from the two gateways?

If your router is the gateway with two IP addresses you can use "iptables -j SNAT" to define what traffic leaves what IP.

If your router sends traffic to one of two external gateways you are looking at policy routing.

MPowers 06-24-2005 02:35 PM

The gateways is another computers on another interfaces

SirGertrude 06-24-2005 03:24 PM

This means you will need to do policy routing. I recommend using the firewall mark in iptables and routing packets based on this mark.

Here is a good reference site: http://www.compendium.com.ar/policy-routing.txt

Section 6 talks about the fwmark method.

Another good resource I found on Google: http://www.monkeynoodle.org/comp/net...ing-HOWTO.html

Hope this helps :)


All times are GMT -5. The time now is 02:25 PM.