Bonding + NAT

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

 



Hello.

In my university dorm we've got a private net with two subnets: I'll call one of them the servers subnet (10.1.5.0/24) because there are some servers (ftp, web, streaming, etc) and a couple of routers: one is a cisco router which provide us with internet access and the other one is a linux system which acts as a router between this subnet and the other subnet (10.1.7.0/24), which I'll refer as the students subnet, where there are about 250 hosts. 

The linux router is doing NAT, and it is a dhcp, ddns and pdc (primary domain controller) server too. The traffic between this subnets is very heavy because of the ftp server, so we decided to add two more ethernet cards to the linux router (4 in total) and configure bonding. But only the switches at the students subnet supported bonding, so now we have two cards (eth1 and eth3) showing the same ip (10.1.7.1) with bonding and the other two cards (eth0 and eth2) with two ips (10.1.5.4 and 10.1.5.3). Then, our idea was to force the traffic between the subnets to leave the router over eth2, and to make the rest of the traffic leave the router over eth0. At first, I thought the following nat rules were enough to implement this,

# iptables -t nat -A POSTROUTING -o eth2 -s 10.1.7.0/24 -d 10.1.5.0/24 -j SNAT --to-source 10.1.5.3
# iptables -t nat -A POSTROUTING -o eth0 -s 10.1.7.0/24 -d ! 10.1.5.0/24 -j SNAT --to-source 10.1.5.4

but I was wrong: I was able to ping the internet from the students subnet, and the traffic left the router over the right interface, but I was unable to ping any host at the servers subnet. And the question is, am I wrong? Is it possible to implement what I've said via iptables? 

As a quick and dirty hack, we're using iproute2 to make all traffic between the students and the ftp leave the router over eth2, but what's bad on iproute2 is that you have to specify single hosts, not a whole network like 10.1.5.0/24. Moreover, you can't use rules of the kind -d ! 10.1.5.0/24, unlike with iptables. Is iptables the right approach to do this? Am i missing something?

Thank you very much in advance,

Eduardo Fernández



[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