With the following setup:
#!/usr/sbin/nft -f
add table ip filter
add chain ip filter input { type filter hook input priority 0; }
add set ip filter nat-group-1 { type ipv4_addr; }
add set ip filter nat-group-2 { type ipv4_addr; }
add set ip filter nat-group-3 { type ipv4_addr; }
add set ip filter nat-group-4 { type ipv4_addr; }
add set ip filter nat-group-5 { type ipv4_addr; }
add rule ip filter input ip saddr @nat-group-1 tcp dport 22 drop
add table ip nat
add chain ip nat postrouting {type nat hook postrouting priority srcnat; policy accept; }
add rule ip nat postrouting ip saddr @nat-group-1 snat to 192.168.1.0/24 persistent
add rule ip nat postrouting ip saddr @nat-group-2 snat to 192.168.2.0/24 persistent
I get the error message
Error: No such file or directory; did you mean set ‘nat-group-1’ in table ip ‘filter’?
I do not know how to reference a set from another table. Is this possible? Suspect one can get around this issue by duplicating the set in the two tables, but the error message makes me hopeful that there is some syntax that I'm not aware of.
I will be referencing the set in both tables.