Allowlist formatter
Paste IP addresses, ranges or CIDR blocks and get them as ready-to-paste rules for Postfix, nginx, Apache, iptables, nftables, AWS, SPF and more.
Postfix mynetworks
4 blocks from 4 itemsExample: paste your own list above.
mynetworks =
192.0.2.0/24
198.51.100.7/32
198.51.100.8/32
[2001:db8:a::]/48This replaces mynetworks. Keep 127.0.0.0/8 and [::1]/128 in the list if Postfix should still accept mail from the server itself.
How it works
An allowlist is a list of addresses that may connect to a service, like the servers allowed to relay mail through Postfix or the office network allowed to reach an admin page. Every product writes it differently. This tool writes the same list in each product's own syntax.
Ranges like 198.51.100.10-198.51.100.40 are turned into CIDR blocks first, because most products only accept blocks. With merging on, overlapping and neighbouring blocks become the shortest list that allows exactly the same addresses.
For SPF (the DNS record that lists the servers allowed to send email for your domain), the output is a set of ip4: and ip6: mechanisms. A TXT string holds at most 255 characters, and the whole record should stay under about 450 bytes, so the tool warns when a list gets that long.
Firewall rules here allow all traffic from the listed addresses. Narrow them to the port you need, and test them before you rely on them. To merge or tidy a list on its own, use the CIDR aggregator. To check a server's SPF record, use the SPF IP check.