Blame SOURCES/nat.nft

195495
# Sample configuration snippet for nftables service.
195495
# Meant to be included by main.nft, not for direct use.
195495
195495
# dedicated table for IPv4
195495
table ip nftables_svc {
195495
195495
	# interfaces to masquerade traffic from
195495
	set masq_interfaces {
195495
		type ifname
195495
		elements = { "virbr0" }
195495
	}
195495
195495
	# networks to masquerade traffic from
195495
	# 'interval' flag is required to support subnets
195495
	set masq_ips {
195495
		type ipv4_addr
195495
		flags interval
195495
		elements = { 192.168.122.0/24 }
195495
	}
195495
1d03cd
	# force port randomization for non-locally originated connections using
1d03cd
	# suspicious port values to prevent port-shadow attacks, i.e.
1d03cd
	# accidental matching of new inbound connections vs. existing ones
1d03cd
	chain do_masquerade {
1d03cd
		meta iif > 0 th sport < 16384 th dport >= 32768 masquerade random
1d03cd
		masquerade
1d03cd
	}
1d03cd
195495
	# base-chain to manipulate conntrack in postrouting,
195495
	# will see packets for new or related traffic only
195495
	chain POSTROUTING {
195495
		type nat hook postrouting priority srcnat + 20
195495
		policy accept
195495
1d03cd
		iifname @masq_interfaces oifname != @masq_interfaces jump do_masquerade
1d03cd
		ip saddr @masq_ips jump do_masquerade
195495
	}
195495
}