How to modify Iptables open port 80 under Linux

Source: Internet
Author: User

Under Linux How to modify iptables open 80 port   recently in the environment of the local server, found that the site localhost can access the normal, with IP access can not access, often using CentOS friends, you may encounter the same problems with me. The firewall is turned on and the 80 port is inaccessible, and the friend who just started learning CentOS can refer to it.   www.2cto.com   Friends who often use CentOS may encounter the same problems as me. When I recently installed the ORACLE   database under the Linux CentOS Firewall, it was always shown that the EM installation caused by the network port failed, so I intend to shut down the CentOS firewall first. Accidentally see the configuration of the CentOS firewall operation instructions, feel good. The    "Setup" command launches the text mode configuration utility, selects "Firewall Configuration" in "Select a tool", then selects the "Run Tool" button, the CentOS firewall configuration Interface,  "Security level" to "disabled", and then select " OK ".   www.2cto.com   After restarting the computer, the CentOS firewall defaults to 80 and 22 ports    Introduction: CentOS is a branch of the Linux family.   centos firewall in the virtual machine CentOS installed Apache can not be used, depressed, the solution is as follows   /sbin/iptables-i input-p TCP--dport 80-j accept& Nbsp;/sbin/iptables-i input-p TCP--dport 22-j accept   then Save:   /etc/rc.d/init.d/iptables Save  centos 5.3, more than 5.4 of the version needs to be saved to the configuration file using  service iptables save .   After restarting the computer, the CentOS firewall has already opened 80 and 22 ports by default.    here should also not restart the computer:   /etc/init.d/iptables Restart  centos firewall off, shut down its services can be:   View the CentOS Firewall information:/etc/init.d/iptables status   off the CentOS Firewall service:/etc/init.d/iptables stop   permanently shut down? Do not know how a permanent method:   chkconfig–level iptables off   above the content is for the old version of CentOS, the following content is based on the new version.   iptables-p INPUT drop   This denies all access to CentOS 5.3 system data except for Chain rh-firewall-1-input (2 references) rules Oh.    configured with a command iptables must also be service iptables save to save to the configuration file.   cat/etc/sysconfig/iptables can view firewall iptables configuration file contents   # Generated by Iptables-save v1.3.5 on Sat Apr 07:51:07 2001 *filter :input DROP [0:0] :forward Accept [0:0] :output accept [1513:149,055]  :rh-firewall-1-input-[0:0] -a input-j rh-firewall-1-input -a forward-j RH-Firewall-1-INPUT -A Rh-firewall-1-input-i lo-j accept -a rh-firewall-1-input-p icmp-m ICMP--icmp-type any-j ACCEPT -A RH-Firew All-1-input-p esp-j accept -a rh-firewall-1-input-p ah-j accept -a rh-firewall-1-input-d 224.0.0.251-p UDP -m UDP--dport 5353-j accept -A rh-firewall-1-input-p udp-m UDP--dport 631-j accept -a rh-firewall-1-input-p tcp-m tcp--dport 631-j ACCEPT  -a rh-firewall-1-input-m State--state related,established-j accept -a rh-firewall-1-input-p tcp-m State-- State new-m TCP--dport 22-j accept -a rh-firewall-1-input-j REJECT--reject-with icmp-host-prohibited commit  # completed on Sat Apr 07:51:07 2001   Additional:  centos firewall configuration 80 port   looked at several page contents are wrong, the following is the correct method:  # /sbin/iptables-i input-p TCP--dport 80-j accept #/sbin/iptables-i input-p tcp--dport 22-j accept   After Save:  #/etc/rc.d/init.d/iptables save   again to see if there are already:  [[email protected]vcentos ~]#/etc/ Init.d/iptables Status table:filter chain INPUT (policy ACCEPT)  num target prot opt source destination& Nbsp;1 Accept UDP--0.0.0.0/0 0.0.0.0/0 UDP dpt:80 2 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 TCP dpt:80 3 Rh-firewall -1-input All--0.0.0.0/0 0.0.0.0/0 &NBsp Chain FORWARD (Policy ACCEPT)  num target prot opt source destination 1 rh-firewall-1-input All-0.0.0.0/0 0.0. 0.0/0  * set Iptables to Auto-start  chkconfig--level 2345 iptables on   Probably because everyone is using a different version, all of the methods are used slightly differently.    If you need to manage MySQL remotely, use the following command to open it temporarily, close   * Open command  iptables-a input-p tcp-s xxx.xxx.xxx.xxx--dport 3306-j Accept   * Close command  iptables-d input-p tcp-s xxx.xxx.xxx.xxx--dport 3306-j Accept

How to modify iptables to open port 80 under Linux

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.