Issue
I have a friend using an OVH Vps (Debian 7, 64 bits) and i want to open TCP and UDP ports but i dont know why. I try to access but i got a TIMED_OUT, so i think is a firewall blocking the connection. Tried on different computers but the same issue. is the vps firewall? please a command to forward ports or add firewall exception in Debian 7. Thanks.
Solution
Welcome to the wonderful world of iptables
The information you are interested in surrounds the iptables package, which is the default firewall logic for a number of Linux distributions.
To answer your question simply, the following should permit traffic through to port 80 from "anywhere", as an example. Modify this as you see fit, and see that your basic port opening requirements are met.
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
Similarly, if you needed to open UDP port 9987 (default Teamspeak), your command would look something like this.
sudo iptables -A INPUT -p udp --dport 9987 -j ACCEPT
Lastly, any iptables configuration commands are only saved in memory. To "commit" your changes to persist a reboot, you must save them.
sudo service iptables save
Here is some additional trustworthy resources on iptables for your educational pleasure.
- https://wiki.debian.org/iptables
- http://ubuntuforums.org/showthread.php?t=159661
- https://wiki.centos.org/HowTos/Network/IPTables
Answered By - nthieling