Multiple IPs to 2 interfaces problem with default route

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

 



Hi,

I have set up a Fedora 11 NAT server to NAT outgoing traffic to 2 interfaces to 2 ISPs.

My internal interface is eth0, the 2 external interfaces are eth1 for ISP1 and eth2 for ISP2, each one with a pool of IP addresses.

I wrote a script who create for each internal server the corresponding NAT fonction :

interface= outgoing interface for the wanted ISP
public_ip= public IP address affected to this server on the ISP network
server_ip= internal server local ip address

/sbin/iptables -t nat -A PREROUTING -p tcp -i $interface -s $public_ip/32 -j DNAT --to-destination $server_ip /sbin/iptables -t nat -A POSTROUTING -s $server_ip/32 -j SNAT -o $interface --to-source $public_ip

It works very fine with one interface, but when I try to activate the second interface, I think I get a problem with the default route.

When I started the interfaces, eth1 got a public IP and a default gateway. This default gateway is the default gateway for all the server. eth2 has his own public IP, own gateway.

I tried to remove the default gateway, thinking the route will be according to the NAT setup, but no more packet can get out of the server.

But I need to split packets to interfaces eth1 and eth2 according to the public IP of the internal server, not according to a default route always pointing to eth1.

How can I set up these routes?

Patrick

--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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