Vultr Firewall rules enable traffic filtering using port numbers and source IP addresses for incoming network requests. A Vultr Firewall group contains multiple rules that define specific the flow of network traffic to attached instances.
Follow this guide to create Vultr Firewall rules using the Vultr Customer Portal, API, or CLI.
Navigate to Products, expand the Network drop-down and select Firewall from the list of options.
Select your target firewall group to manage it.
Click your target network type on the left navigation menu to modify the incoming traffic rules.
Click the Protocol drop-down to select a common network application profile or choose Custom from the list and enter your target network port in the Port (or range) field.
Click the Source drop-down, select your traffic source and enter the target source IP address.
Click Add note and enter a descriptive label to identify the new firewall rule.
Click Add Firewall Rule within the Action section to apply the new rule to your firewall group.
Send a GET
request to the List Firewall Groups endpoint and note the target firewall group ID in your output.
$ curl "https://api.vultr.com/v2/firewalls" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a GET
request to the List Firewall Rules endpoint to view all active rules in the firewall group.
$ curl "https://api.vultr.com/v2/firewalls/{firewall-group-id}/rules" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a POST
request to the Create Firewall Rules endpoint to create a new rule in the firewall group.
$ curl "https://api.vultr.com/v2/firewalls/{firewall-group-id}/rules" \
-X POST \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"ip_type" : "<network-type>",
"protocol" : "<protocol>",
"port" : "<target-instance-port>",
"source" : "<source-address>",
"notes" : "<label>"
}'
Visit the List Firewall Rules API page to view additional attributes to apply on the firewall rule.
List all firewall groups in your Vultr account and note the target firewall group ID.
$ vultr-cli firewall group list
List all rules in the firewall group.
$ vultr-cli firewall rule list <firewall-group-id>
Create a new firewall rule.
$ vultr-cli firewall rule create --id=<firewall-group-id> --ip-type=<network-type> --protocol=<protocol> --source=<source-address> --port=<target-instance-port>
Run vultr-cli firewall rule create --help
to view additional options to apply on the firewall rule.