[HOW TO] enable/ configure iptables in Fedora 22

In Fedora 22, firewall has no active. Here I'll learn how to enable the iptables firewall application and make sure that runtime rules persist after a reboot.

The iptables package is already installed, but to be enable, you need to install the iptables-services package.

sudo yum install iptables-services
sudo systemctl enable iptables.service
sudo systemctl start iptables.service

To view the rules, type:
sudo iptables -L

Example iptables rules:

-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 139 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
Thank you for reading this article, please a comment if you are interested.

Tiến Phan - R0039

Knowledge is Endless

Sharing for Success

0 nhận xét:

Post a Comment