Question

How do I bulk add IP addresses to firewall?

I have ~60 IPs to whitelist and would like to paste the entire list into each of the rules but can’t. It seems to only allow single IP entry at a time. is there a way to to add the entire list with a copy and paste?

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

It doesn’t look like the cloud control panel UI allows you to paste in multiple IP Addresses at once. That’s a good idea for a UI improvement.

In the meantime you can definitely do it via the API

Here is a curl command you can run to create a new Firewall with multiple IP addresses allowed on an inbound rule TCP port 22 rule on a specific droplet:

curl -X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_DIGITALOCEAN_API_TOKEN" \
-d '{"name":"My-Firewall", "inbound_rules":[{"droplet_ids":[DROPLETID], "protocol":"tcp", "ports":22, "sources":{"addresses":["JSON.ARRAY.OF", "ALL.THE.IP.ADDRESSES", "YOU.WANT.TO.ADD"] } } ] }' \
"https://api.digitalocean.com/v2/firewalls/"