The iptables file cannot be found in/etc/sysconfig /.

Source: Internet
Author: User
Tags i18n rsyslog

The iptables file cannot be found in/etc/sysconfig /.

I wanted to make some firewall policies. All firewall policies are written in the/etc/sysconfig/iptables file. But I don't have this file either.

[root@iZ23gx7o02aZ /]# cd /etc/sysconfig/[root@iZ23gx7o02aZ sysconfig]# lsatd         firstboot         irqbalance  network-scripts  rhn            sysstatauditd      grub              kdump       ntpd             rngd           sysstat.ioconfauthconfig  htcacheclean      kernel      ntpdate          rsyslog        system-config-firewallcbq         httpd             keyboard    prelink          sandbox        system-config-firewall.oldclock       i18n              modules     quota_nld        saslauthd      udevconsole     init              netconsole  raid-check       selinuxcpuspeed    ip6tables-config  network     readahead        smartmontoolscrond       iptables-config   networking  readonly-root    sshd[root@iZ23gx7o02aZ sysconfig]# 
Solution:

1. Write an iptables command to configure firewall rules. For example, iptables-p output accept.

[root@iZ23gx7o02aZ /]# cd /etc/sysconfig/[root@iZ23gx7o02aZ sysconfig]# iptables -P OUTPUT ACCEPT

2. save service iptables.

[root@iZ23gx7o02aZ sysconfig]# service iptables saveiptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ][root@iZ23gx7o02aZ sysconfig]# lsatd firstboot iptables-config networking readonly-root sshdauditd grub irqbalance network-scripts rhn sysstatauthconfig htcacheclean kdump ntpd rngd sysstat.ioconfcbq httpd kernel ntpdate rsyslog system-config-firewallclock i18n keyboard prelink sandbox system-config-firewall.oldconsole init modules quota_nld saslauthd udevcpuspeed ip6tables-config netconsole raid-check selinuxcrond iptables network readahead smartmontools[root@iZ23gx7o02aZ sysconfig]# 

3. restart the service iptables restart command:

[root@iZ23gx7o02aZ sysconfig]# service iptables restartiptables: Setting chains to policy ACCEPT: filter [ OK ]iptables: Flushing firewall rules: [ OK ]iptables: Unloading modules: [ OK ]iptables: Applying firewall rules: [ OK ][root@iZ23gx7o02aZ sysconfig]# 

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.