Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Ubuntu (and Debian) offer the package iptables-persistent (Debian: , Ubuntu: , which does exactly what you want.
Don't worry about understanding everything here now, but remember to come back and look at this list as you encounter new options later on.If you don't allow them to talk, you could break those programs!If you were to reboot your machine right now, your iptables configuration would disappear.To save iptables rules on shutdown, and to restore them on startup, we are going to create such a script.To begin, press Alt F2 and enter this command: The above steps go over how to setup your firewall rules and presume they will be relatively static (and for most people they should be).Please follow the steps in the next section instead. configuration file to apply the rules automatically.
NOTE: It appears on Hardy, Network Manager has an issue with properly on saving and restoring the iptable rules when using the method in the next section. You will need to know the interface that you are using in order to apply the rules - if you do not know, you are probably using the interface eth0, although you should check with the following command first to see if there are any wireless cards: Network Manager includes the ability to run scripts when it activates or deactivates an interface.
The automatic loading of the configured iptables rules can be done by using the following methods: Since Ubuntu 10.04 LTS (Lucid) and Debian 6.0 (Squeeze) there is a package with the name "iptables-persistent" which takes over the automatic loading of the saved iptables rules.
To do this, the rules must be saved in the file If the installation fails, please check whether systemd has already had failures before the installation of iptables-persisent.
When you install Ubuntu, iptables is there, but it allows all traffic by default.
Ubuntu 8.04 Comes with ufw - a program for managing the iptables firewall easily.
Iptables aims to keep any questionable network traffic out.