LVS for wildcard ip

From NuclearCat's homepage
Jump to: navigation, search

Few steps to accomplish:

A)Use fwmark:

virtual_server fwmark 4 {

iptables -t mangle -A PREROUTING ! -i eth0.16 -p tcp --dport 80 -j MARK --set-mark 0x4

In my case i am using also DR.

B)Linux Virtual Server are balancing only traffic that are sent to "local" server. If you want to make load balancer for transparent proxy, that means you need to "load-balance" almost all ip's. Solution is simple:

ip rule del pref 1000
ip rule add pref 1000 fwmark 0x4 table 111
ip route replace table 111 local 0.0.0.0/0 dev lo

That's it!

Personal tools