First, check whether the firewall is installed
1. whereis iptables
2. apt-get install iptables # If not, run the command
3. Check the firewall configuration
iptables -L
Second, add and configure iptables.rules
1. Add Rule
we /etc/iptables.rules
2. the rules take effect
iptables-restore < /etc/iptables.rules
Third, create a firewall boot file
1. Create a iptables
we /etc/network/if-pre-up.d/iptables
2. Add execute permissions
chmod +x /etc/network/if-pre-up.d/iptables
3. Check whether the rules take effect
iptables -L –n