1

How can I correctly configure LVS to masqerade/NAT packets from virtual ip to/from clients?

Currently I have:

UDP  10.47.1.80:domain rr
  -> 10.47.1.51:domain            Masq    10     0          5
  -> 10.47.1.52:domain            Masq    10     0          9

Problem I'm seeing:

dig my.test.domain @10.47.1.80
;; reply from unexpected source: 10.47.1.51#53, expected 10.47.1.80#53

I would expect NAT/Masq to rewrite the ip, but aparently the server responds directly to the client.

womble
  • 95,029
  • 29
  • 173
  • 228
Jon Skarpeteig
  • 941
  • 2
  • 14
  • 28

1 Answers1

2

When not setting the director as gateway, I had to enable some additional options:

sysctl -w net.ipv4.ip_forward=1
sysctl -w net.ipv4.vs.conntrack=1
iptables -t nat -A POSTROUTING -j MASQUERADE

Now it works as expected

Jon Skarpeteig
  • 941
  • 2
  • 14
  • 28