29 Oct 2010 Ferado

Cloud Servers & iptables

When working with Rackspace Cloud Servers you’re given a vanilla box with nothing on it. This is known to anyone with experience using Rackspace’s Cloud Servers.Which means, when you create a cloud server that hasn’t been spun from your default cloud image, you need to setup a few things. You need to install Apache, MySQL, PHP, etc. All of this depending on how you’re going to use your cloud server. In this article, I’ll be talking to Linux servers instead of Windows (for Windows, contact me).

One thing that many people forget to do is open up the firewall and then finally, save the firewall settings.

iptables

The most basic thing you need to do is open up port 80 (the WWW port):

[cc lang=”ini”]
iptables -I INPUT 1 -p tcp –dport 80 -j ACCEPT
[/cc]

For those using SSL, you’ll need to open up port 443:

[cc lang=”ini”]
iptables -I INPUT 1 -p tcp –dport 443 -j ACCEPT
[/cc]

Finally, when you’re done making all your iptable changes, be sure to SAVE what you’ve done:

CentOS and Fedora

[cc lang=”ini”]
/etc/init.d/iptables save
# as ROOT
# service iptables save
[/cc]

Ubuntu

[cc lang=”ini”]
iptables-save > /etc/iptables.rules
[/cc]

All other Distros

[cc lang=”ini”]
iptables-save > /etc/sysconfig/iptables
[/cc]

Conclusion

Remember, with Rackspace Cloud Servers, you need to install all your software because you’re given by default, an empty server. After you’ve installed all your software, you need to open up your firewall ports (using iptables) and then finally, save what you’ve done.