CentOS 7 Installation Webmin boot Firewall failed----Applying firewall Rules:iptables-restore:line 2 failed

Source: Internet
Author: User

recently learning CentOS 7 system Management, using the "CentOS 6.X System Management Practical Treasure" a book------because the online purchase of CentOS 7 book has not been sent to O (' '!) o~

(1) First install the Webmin using the Yum method:

Webmin cannot be installed by default with Yum because the software is not stored on the official site. Although it was previously to be installed in tar, the RPM installation package was then compiled, so you have to configure the update site yourself. Create the Webmin.repo file in/ETC/YUM.REPO.D, save the exit after editing is complete, and then import the digital signature of the Webmin open source GPG:

vi /etc/yum. repos.d/webmin.repo[webmin]name=webmin distribution Neutralbaseurl =http://download.webmin.com/download/yum    // Configure Webmin Install Source site enabled= 1  /]# rpm--import http://WWW.WEBMIN.COM/JCAMERON-KEY.ASC

Then install it using the Yum method,

Yum Install Webmin

(2) Install Apache software:

Yum Install httpd-y

(3) To install the Webmin System Management tool, you need to reconfigure the firewall, webmin the default port is 10000, according to the book tutorial set up the/etc/sysconfig/iptables file:

[Email protected]/]#VI/etc/sysconfig/Iptables#firewall configuration written by System-config-firewall#manual Customization of thisfileis not recommanded.*filter:input ACCEPT [0:0]:forward ACCEPT [0:0]:output ACCEPT [0:0]-A input-m state--state established,related-J ACCEPT-A input-p ICMP-J ACCEPT-A input-i lo-J ACCEPT-A input-m state--state new-m tcp-p TCP--dport A-J ACCEPT-A input-m state--state new-m udp-p TCP--dport10000-J ACCEPT-A input-j REJECT--reject-with icmp-host-prohibited-A forward-j REJECT--reject-with icmp-host-Prohibitedcommit

Follow the book tutorial to execute the service iptables restart command, but failed to assume that the CentOS 6.X command and the CentOS 7 command incompatibility issue, online search CentOS 7 to start the firewall method, find this page:

CentOS7 under Firewall firewall configuration usage

Follow the instruction, as shown in the area, to configure:

----------------------------------------the picture below---------------------------------------------

-----------------------------------------above is a picture----------------------------------------------

(i) Yum install iptables-services, no problem

(ii) Systemctl mask firewalld.service, no problem

(iii) SYSTEMCTL enable Iptables.servie, no problem

In order to improve the speed, I disabled the IPv6, so did not execute Systemctl start Ip6tables.service

(iv) Systemctl stop firewalld.service, no problem

(v) systemctl start iptables.service------a problem!

  

Using Cat/var/log/messages | grep iptables command to view related errors:

By Applying firewall Rules:iptables-restore:line 2 failed learned that the second line of the Iptables file was by mistake, so cat/etc/sysconfig/iptables:

A look, it turns out that Manual configurationof this file was not recommended. That sentence is not preceded by the # # comment out!

Hence the note ~

Systemctl start Iptables.service again, results:

Said to be upd match:only valid for protocol 17

Finally get a hint from this page: Http://stackoverflow.com/questions/25144598/failed-to-apply-firewall-rules-with-iptables-restore

Enter Iptables-restore </etc/sysconfig/iptables:

There is a problem with the 14th line, but as with the friend of the Stackflow website, my 14th line is COMMIT:

And he modifies the way is to change the-P udp-m TCP to-P udp-m UDP, and I check I follow the book instruction write iptables, also have such a line-M udp-p TCP, should be mismatched problem. Think of Webmin to use the browser to manage the server, should be the TCP protocol, and then change it to-M tcp-p TCP:

Re-enter Systemctl start Iptables.service, no problem.

Enter the service httpd restart command to restart the Apache server, the browser login Webmin Manager:

You can see the login interface, indicating that the iptables configuration is successful!

Installing Webmin under CentOS 7 failed to start the firewall----applying Firewall Rules:iptables-restore:line 2 failed

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.