Configuring Firewall Rules for Vultr Load Balancer allows you to control the traffic that can reach your load-balanced applications. By setting up firewall rules, you can specify which IP addresses and ports are allowed or blocked, enhancing the security of your services. This feature helps protect your backend servers from unauthorized access and potential threats by filtering incoming traffic based on your defined criteria.
Follow the steps below to configure firewall rules for your Vultr Load Balancer using the Vultr Customer Portal, API, or CLI.
Navigate to Products and click Load Balancer.
Click your target Load Balancer to open its management page.
Click Configuration.
Click Networking.
Add a firewall rule, provide Port, IP Type and a Source.
Click Save Changes.
Send a GET
request to the List Load Balancer endpoint and note the target Load Balancer's ID.
$ curl "https://api.vultr.com/v2/load-balancers" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a PATCH
request to the Update Load Balancer endpoint to add a firewall rule to the target Load Balancer's algorithm.
$ curl "https://api.vultr.com/v2/load-balancers/<loadbalancer-id>" \
-X PATCH \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"firewall_rules": [
{
"port": 80,
"source": "0.0.0.0/0",
"ip_type": "v4"
}
]
}'
List the available Load Balancers and note the target Load Balancer's ID.
$ vultr-cli load-balancer list
Add firewall rule to the target Load Balancer.
$ vultr-cli load-balancer update <loadbalancer-id> --firewall-rules="port:80,ip_type:v4,source:0.0.0.0/0"