Managing Linux VPS Firewall Rules
Adding an allow rule to a Linux VPS Firewall
You want to open up a custom TCP or UDP port on your VPS, but want to restrict it such that only a specific IP address can connect on that port.
You will need to create an allow rule for your server's firewall. For example, you want to open TCP port 6201, but you only want the address 22.214.171.124 to have access. The rule would look like this:
- tcp|in|d=6201|s=126.96.36.199 #Some useful description
Let's discuss each part of this sample rule. The first part is the protocol: tcp. The next part is the direction, which is inbound traffic. The next part is the port, 6201. The next part is the source IP address that you want the rule to apply to, 188.8.131.52. And finally, you can put some short worthwhile comment on the end to remind yourself later what the rule is for.
Now, let's say for example that you want to allow inbound UDP port 6203, but you only want IP address 184.108.40.206 to have access. The appropriate command would look like this:
- udp|in|d=6203|s=220.127.116.11 #Another useful description.
Steps for adding firewall allow rules
- Log into WHM on your server at https://your_server_IP:2087
- Once logged in, scroll down and click on ConfigServer Security&Firewall
- Click on the Fireawll Allow IPs button
- Add the rule you created