xref: /linux-tools/misc/scripts/iptables/gen_vips_trie_iptablerules_batch.py (revision de922be4e919572d28577568db563e691d5e7702)
1# iptables -t nat -N services
2# iptables -t nat -A OUTPUT -d 10.10.0.0/16 -j services
3# iptables -t nat -N myservice
4# iptables -t nat -A myservice  -m statistic --mode random --probability 0.3333 -j DNAT --to-destination 172.18.1.3
5# iptables -t nat -A myservice  -m statistic --mode random --probability 0.5 -j DNAT --to-destination 172.18.1.4
6# iptables -t nat -A myservice  -j DNAT --to-destination 172.18.1.5
7
8
9
10# iptables -t nat -A OUTPUT -d 10.10.0.0/16 -j myservice
11
12print "*nat"
13for a in range(1, 101):
14    cc = "myservice_%d" % a
15    print ":%s - [0:0]" % cc
16
17for a in range(1, 101):
18    cc = "myservice_%d" % a
19    print "-A services -d 10.10.%d.0/24 -j %s" % (a, cc)
20    for b in range(1, 101):
21        print "-A %s -d 10.10.%d.%d/32 -j myservice" % (cc, a, b)
22
23print "COMMIT"
24
25