CentOS iptables and Firewall firewalls open, close, view status, basic settings, etc.

Source: Internet
Author: User
Tags iptables

iptables Firewall

1, basic operation # View firewall status service iptables status # Stop Firewall service iptables Stop # Start Firewall service iptables start # Reboot Firewall Service iptables Restart # permanently shut down firewall chkconfig iptables off # After permanent shutdown chkconfig iptables on

2, view the firewall status, the firewall is turned on and only 22 ports open

3. Open 80 ports

Vim/etc/sysconfig/iptables
# Add the following code, than the two gourd painting scoop:)
-A input-m State--state new-m tcp-p TCP--dport 80-j ACCEPT

Reboot firewall after save exit

Service Iptables Restart

Firewall Firewall

1. View Firewall Service Status

Systemctl Status Firewalld

2, view the status of firewall

Firewall-cmd--state

3, open, restart, close, Firewalld.service service

# Open Service
firewalld start
# Restart
service firewalld Restart
# close
service Firewalld stop

4. View Firewall rules

5, query, open, close the port

# Query Port open
firewall-cmd--query-port=8080/tcp
# Open 80 port
firewall-cmd--permanent--add-port=80/tcp
# Remove Port
firewall-cmd--permanent--remove-port=8080/tcp
#重启防火墙 (reboot firewall after modifying configuration)
firewall-cmd--reload

# parameter explanation
1, Firwall-cmd: is a tool for Linux to operate firewall;
2,- -permanent: Indicates set to persistent;
3 、--Add-port: Identifies the added port;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.