Report this

What is the reason for this report?

How do I bulk add IP addresses to firewall?

Posted on February 11, 2018

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?



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!

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.

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/" 

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.