Debian Codegraph @

tests/054_dnat_ipv4_all_sip_ports/output.nft

raw
1 table ip nftlb {
2 ct helper sip-udp {
3 type "sip" protocol udp
4 l3proto ip
5 }
6
7 map filter-services {
8 type inet_proto . ipv4_addr : verdict
9 elements = { udp . 192.168.0.100 : goto filter-lb01 }
10 }
11
12 map nat-services {
13 type inet_proto . ipv4_addr : verdict
14 elements = { udp . 192.168.0.100 : goto nat-lb01 }
15 }
16
17 map services-back-m {
18 type mark : ipv4_addr
19 }
20
21 chain filter {
22 type filter hook prerouting priority mangle; policy accept;
23 meta mark 0x00000000 meta mark set ct mark
24 ip protocol . ip daddr vmap @filter-services
25 }
26
27 chain filter-lb01 {
28 ip protocol udp ct helper set "sip-udp"
29 ct state new ct mark 0x00000000 ct mark set numgen inc mod 10 map { 0-4 : 0x00000001, 5-9 : 0x00000002 }
30 }
31
32 chain prerouting {
33 type nat hook prerouting priority dstnat; policy accept;
34 ct state new meta mark 0x00000000 meta mark set ct mark
35 ip protocol . ip daddr vmap @nat-services
36 }
37
38 chain postrouting {
39 type nat hook postrouting priority srcnat; policy accept;
40 ct mark 0x00000000 ct mark set meta mark
41 ct mark 0x80000000/1 masquerade
42 snat to ct mark map @services-back-m
43 }
44
45 chain nat-lb01 {
46 ip protocol udp dnat to ct mark map { 0x00000001 : 192.168.0.10, 0x00000002 : 192.168.0.11 }
47 }
48 }