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]#