File: setmap.nft

package info (click to toggle)
rust-nftables 0.6.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 564 kB
  • sloc: sh: 11; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 367 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/sbin/nft -f

# https://wiki.nftables.org/wiki-nftables/index.php/Maps

flush ruleset

table ip nat {
	map porttoip {
		type inet_service : ipv4_addr
		elements = { 80 : 192.168.1.100, 8888 : 192.168.1.101 }
	}

	chain prerouting {
		dnat to tcp dport map { 80 : 192.168.1.100, 8888 : 192.168.1.101 }
	}

	chain postrouting {
		snat to tcp dport map @porttoip
	}
}