Use iptables in RHEL 7 / CentOS 7
2015年7月23日发布
Reference: http://stackoverflow.com/questions/24756240/how-can-i-use-iptables-on-centos-7
It is possible to go back to a more classic iptables setup. First, stop and mask the firewalld service:
systemctl stop firewalld
systemctl mask firewalld
Then, install the iptables-services package:
yum install iptables-services
Enable the service at boot-time:
systemctl enable iptables
Managing the service
systemctl [stop|start|restart] iptables
Saving your firewall rules can be done as follows:
service iptables save
or
/usr/libexec/iptables/iptables.init save
그 외 자주 쓰는 명령어:
iptables -F //초기화
iptables -I INPUT -p tcp -m tcp --dport 22 -j ACCEPT // 22번 포트 오픈
iptables -D INPUT -p tcp -m tcp --dport 22 -j ACCETP // 삭제
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload