Linux firewall and port switch settings

Source: Internet
Author: User

I. Open/Close firewall command under Linux

1) Permanent, no recovery after reboot

Open: Chkconfig iptables on off: chkconfig iptables off2) immediate effect, restart after recovery on: Service iptables start off: Service iptables stop need to explain is the Other services under Linux can be turned on and off using the commands above. When the firewall is turned on, do the following settings, open the relevant port, modify the/etc/sysconfig/iptables file, add the following:-a rh-firewall-1-input-m State--state new-m tcp-p TCP--DP ORT 80-j accept-a rh-firewall-1-input-m State--state new-m tcp-p TCP--dport 22-j ACCEPT

Two. Ubuntu off firewall
Iptables-a Input-i! Ppp0-j ACCEPT

Three. CentOS Linux firewall configuration and shutdown

Execute the "Setup" command to start the text mode configuration Utility, select "Firewall Configuration" in "Select a tool", then select the "Run Tool" button, the firewall configuration interface, "Security level" set to "disabled", and then choose OK.

or with a command:
#/sbin/iptables-i input-p tcp–dport 80-j ACCEPT
#/sbin/iptables-i input-p tcp–dport 22-j ACCEPT
#/etc/rc.d/init.d/iptables Save
When you restart your computer, the firewall defaults to 80 and 22 ports
This should also be done without restarting the computer:
#/etc/init.d/iptables restart

To turn off the Firewall service:

Linux firewall and port switch settings

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.