Hosting custom build apps in Vultr instances need changes in default configuration.
And, what if your app uses a custom port ?
Definitely, we need to open the port in Vultr instance too.
At Bobcares, we help customers to open server ports in Vultr instances as part of our Managed Cloud Services.
Today, we’ll discuss on how to open port in Vultr server, common errors and their fixes.
When do you need to open port in Vultr?
By default, certain ports like the mail port 25 are not open in Vultr server.
Often, certain server owners would like to make email server work on port 25 itself. In such cases, we need to manually open port 25 on the Vultr server.
Additionally, if your server has a custom app, that listens on specific port, say 2828, this also requires firewall modification.
Also, due to security reasons, our Support Engineers often configure SSH on ports other than 22. Here, we make SSH listen on custom port and make that port open in server.
How to open port in Vultr server?
Server traffic depends largely on the firewall policy. There are different methods to open custom ports on the server. Now, we’ll see how our Support Engineers open a port in Vultr server.
1. Using Vultr Firewall Service
Vultr offers a web-based firewall solution. This Firewall service can be managed from the Vultr control panel. In this, the packet filtering takes place at a higher level on the network and therefore reduce resource usage on the server.
To setup, we first login to Vultr control panel and create a firewall group. After creating the group, we add desired rules to it. There are separate rules for IPv4 and IPv6 address types.
For example, to open SSH port 22, our Support Engineers add the rule as shown in the picture.
Similarly, when we need to open port 25 for the mail service, we choose the protocol as TCP and add rule to allow port 25. Also, in some accounts, we need to get approval from Vultr Support to allow port 25 access on the server.
2. Using Iptables
Yet another way to open port in Vultr server is by modifying the iptables rules on the server. These rules take effect immediately. Therefore, any wrong rule can completely lock out your server.
To allow port 25 on a CentOS6 server, our Dedicated Engineers use the following command:
iptables -A INPUT -p tcp --dport 25 -j ACCEPT
After adding the rule, mail service will start listening on port 25 of the Vultr server.
Here, we take special care to ensure that port is open in Vultr firewall service too.
3. Using firewall utilities like UFW, CSF
Managing server ports using iptables requires some expertise in firewall rules.
That’s why, for server owners that require additional security, we often recommend firewall tools like UFW, CSF, etc. They allow finer rule customization and comes handy in managing Vultr server traffic.
In Ubuntu servers, UFW (Ubuntu firewall) is installed by default. The syntax to open a port is:
sudo ufw allow <port>/<optional: protocol>
Therefore, to open port 25, our Dedicated Engineers use the command:
sudo ufw allow 25/tcp
Similarly, when the Vultr server has CSF (Config Server Firewall), our Support Engineers modify the csf.conf inside /etc/csf directory. And, then configure the necessary ports in csf.conf file.
However, in Vultr server having CentOS 7, to make CSF work, we have to first disable the default firewall application called “firewalld“. Or else, it will conflict with the working of CSF.
Common problems with opening port
Till now, we saw the different ways to open port in Vultr server. However, often customers run into problems while modifying the firewall rules. Let’s have a look at them.
1. Port block in central firewall
At times, the services on the newly opened port may not work if there are additional firewall outside the server. For example, when a port is open in the server firewall, but Vultr firewall service totally block the port access on the server group, things will not work.
Here, to fix the problem, our Dedicated Engineers first check the packet route and see the position at which firewall blocks traffic. We, then make changes in the firewall at appropriate levels.
2. Wrong firewall edit
A rather common problem in Vultr servers is adding wrong firewall rules. When you have wrong rules in place, even the server access will be cut off.
Here, as the rules are already saved, normal access will not work. Therefore, our Dedicated Engineers log in to the server through the console from the Vultr website interface, and input “iptables -F” to flush all of the iptables rules. Then, we set up the correct rules again.
[Need help in opening port on Vultr server? We can help you.]
Conclusion
Opening port in Vultr server can be done using Vultr firewall service, iptables, etc. But, a wrong step can block all access to the server. Today, we’ve seen how our Dedicated Engineers open port in Vultr server without breaking server access.
0 Comments