I'm playing around with iptables in my home lab. My first goal is to take my active directory communication into one load balancing virtual IP. I used prerouting chain to do that. For testing purposes, I started only with the DNS service. My rules looks like:
-A PREROUTING -d 10.0.0.1 -p udp --dport 53 -j DNAT --to-destination 192.168.2.1:53 -A PREROUTING -d 10.0.0.1 -p udp --dport 53 -j DNAT --to-destination 192.168.2.2:53 10.0.0.1is the desired VIP address.192.168.2.1and192.168.2.2are the DC servers.
The VIP itself works, I get DNS response. However, If I detach the first DC's network card, DNS response times out. I checked it, from 192.168.2.2 itself works, so it isn't the server's failure.
I know it's because my rules technically don't do load balancing, neither it is failover. It fails because it passes only the first rule. I tried to set IP range in a singe rule, but didn't help either.
Also, tried things, like statistic probability and nth or socket, but none of them worked.
Is there any module in iptables to solve this case?