Ubuntu16.04 configure iptables

 

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

 

Guess you like

Origin www.cnblogs.com/bymingliang/p/12131651.html