iptables: No config file. [WARNING]!

欢迎访问我的个人博客网站:http://www.yanmin99.com/

iptables开启警告 iptables: No config file. [WARNING]!

  • 1、查看是/etc/sysconfig/iptables否存在

    [root@iZ2ze3nze2sw4quaa8xor9Z sysconfig]# cd /etc/sysconfig/ && ls
    atd         clock      grub              iptables-config  modules     network-scripts  ntpdate        sandbox    sysstat                     udev
    auditd      console    i18n              irqbalance       netconsole  nginx            raid-check     saslauthd  sysstat.ioconf
    authconfig  crond      init              kernel           network     nginx-debug      readonly-root  selinux    system-config-firewall
    cbq         firstboot  ip6tables-config  keyboard         networking  ntpd             rsyslog        sshd       system-config-firewall.old

    出现上面错误,应该就是iptables不存在,如果不存在就生成iptables文件

  • 2、随便写一条iptables命令配置个防火墙规则,生成iptables文件
    。如:iptables -P OUTPUT ACCEPT

    iptables -P OUTPUT ACCEPT
  • 3、service iptables save保存

    [root@iZ2ze3nze2sw4quaa8xor9Z sysconfig]# service iptables save
    iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
    
    [root@iZ2ze3nze2sw4quaa8xor9Z sysconfig]# ls
    atd         console    init              kernel      networking       ntpdate        saslauthd       system-config-firewall
    auditd      crond      ip6tables-config  keyboard    network-scripts  raid-check     selinux         system-config-firewall.old
    authconfig  firstboot  iptables          modules     nginx            readonly-root  sshd            udev
    cbq         grub       iptables-config   netconsole  nginx-debug      rsyslog        sysstat
    clock       i18n       irqbalance        network     ntpd             sandbox        sysstat.ioconf
  • 4、启动防火墙

    service iptables start //启动
    service iptables restart//重启
    service iptables stop //停止
    service iptables status //查看状态

你可能感兴趣的:(mac)