How to Whitelist VergeCloud’s IP Addresses in Your Firewall

How to Whitelist VergeCloud’s IP Addresses in Your Firewall

Why You Need Whitelist VergeCloud’s IP Addresses in Your Firewall

To ensure smooth and uninterrupted communication between VergeCloud’s edge servers and your main host server, it's crucial to whitelist VergeCloud’s IP addresses in your firewall settings. This step will configure the firewall to allow connections from a list of approved IPs attempting to access your platform. Below, two different methods are outlined for adding VergeCloud’s IPs to IPtables.

Method 1: Individual Entries for Each IP Range

In this approach, you will need to add a separate line for each IP range listed on VergeCloud’s IP addresses page. The placeholder $ip should be replaced with an actual VergeCloud IP address in each line.

iptables -I INPUT -p tcp -m multiport --dports http,https -s "$ip" -j ACCEPT

Method 2: Using ipset

Another option is to use ipset, which allows you to avoid manually entering each IP address individually. If ipset is not already installed on your host server, you can install it with the following commands:

  • For Ubuntu: sudo apt-get install ipset
  • For CentOS: yum install ipset

Once ipset is installed, you can create a list of authorized IPs (in this case, VergeCloud’s IP addresses). The following command adds each IP from VergeCloud’s list:

ipset create example hash:net
for x in $(curl https://www.vergecloud.com/ips.txt); do ipset add example $x; done

Please note, after running this command, the list of IP addresses will be stored temporarily in memory. However, by default, this data will be cleared after a system reboot. To preserve this list, you should save and re-run the command after the system restarts.

After creating the list of authorized IPs using ipset, you can apply it in your iptables rule like this:

iptables -A INPUT -m set --match-set example src -p tcp -m multiport --dports http,https -j ACCEPT

Final Step: Save the Iptables Configuration

After applying the changes, don’t forget to save the modified iptables rules. You can do this with the following commands:

  • For Debian-based systems: iptables-save > /etc/iptables/rules.v4
  • For CentOS-based systems: iptables-save > /etc/sysconfig/iptables

This ensures that the changes persist across system reboots.



    • Related Articles

    • Web Application Firewall

      Web Application Firewall | VergeCloud Introduction VergeCloud’s Web Application Firewall (WAF) employs Regex rules to block malicious requests using the Anomaly Scoring method. This method accurately recognizes threats by assigning values to every ...
    • Steps to Activate Cloud Icon for VergeCloud

      Checks Before Activating Cloud Icon For Domain Once you've transferred your website to VergeCloud and updated your DNS settings, there are a few steps to complete before activating the Cloud icon for the records in the VergeCloud user panel. These ...
    • VergeCloud HTTP Headers

      Headers Sent by CDN to User and Origin Server When a website utilizes VergeCloud CDN, visitor requests are directed to VergeCloud CDN servers rather than the original server that hosts the site. In reply to these requests, the CDN edge server ...
    • Essential Steps Before Changing Nameservers to VergeCloud

      Considerations Verify A Records and Their IP Addresses: After registering your domain in the VergeCloud User Panel, the first action is to confirm that the A records have been transferred correctly and that the associated IP address is accurate. ...
    • DDoS Mitigation

      VergeCloud DDoS Protection VergeCloud offers robust protection against DDoS attacks, designed in four stages to safeguard your website from malicious intrusions. This guide will help you understand how to implement and manage DDoS protection ...