Re: Forward port 80 (www) to other router..

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

 



UÅytkownik Marcin Giedz napisaÅ:

Hello..

Here is the problem: I have two routers connected to two different providers. Both routers have internal interfaces in my LAN.

router1
provider1<----------->eth0---------linux---------eth1<------------>LAN (192.168.49.101)
router2
provider2<----------->eth0---------linux---------eth1<------------>LAN (192.168.49.10)


Nowadays all clients in LAN have set up router1 as the default gateway so all traffic is forwarded to this router1 (www e.g.). Now I'd like to forward all www traffic to router2 from all my clients. I know this should be done on router1 with some iptables rules but I'm rather fresh in netfilter so if it possible please help me ;)

Thanks,
Marcin




Hello again ;)

I think my problem is solved with iptables and iproute2 (ip) - mainly taken from transparent proxy - THANKSSSS
And here is the solution:


on router1 put:
iptables -t mangle -A PREROUTING -j MARK --set-mark 3 -p tcp --dport 80 -s 192.168.49.9 (192.168.49.9 is my internal router, behind him there are all my clients)
ip rule add fwmark 3 table 2
ip route add default via router2_eth1_address dev eth1 table 2


That is all.
Now I have main router (router1) for other than port 80 traffic and router2 for port 80 traffic.


Thanks,
Marcin


[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux