Linux off firewall, open port

Source: Internet
Author: User
Tags ssh access

Centos/redhat System:

Turn on the firewall

#systemctl Start Firewalld.service

Stop firewall

#systemctl Stop Firewalld.service

Disable firewall boot

#systemctl Disable Firewalld.service

View default firewall status (show not running after turn off, show running on when turned on)

#firewall-cmd--state

To configure iptables, you first need to install the Iptables service

#yum Install Iptables-services

Edit the firewall configuration file

#vim/etc/sysconfig/iptables

Add the following lines, 22 is the default

-A input-p tcp-m state--state new-m TCP--dport 80-jaccept

-A input-p tcp-m state--state new-m TCP--dport 8080-j ACCEPT

-A input-p tcp-m state--state new-m TCP--dport 443-j ACCEPT

Port 22 is for SSH access, the 80,8080 port is accessed by the HTTP service, later with HTTPS, you also need to open 443 port access rights.

Save, restart Iptables service

Finally reboot the firewall to make the configuration effective

#systemctl Restart Iptables.service

Setting up a firewall boot

#systemctl Enable Iptables.service

After reboot firewall is turned on again, so we want to set disable firewall boot from boot

Prohibit firewall boot from booting

Stop firewall

#systemctl Stop Firewalld.service

Disable firewall boot

#systemctl Disable Firewalld.service



Linux off firewall, open port

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.