centos6.5虚拟机安装后,没有iptables配置文件

Posted 散尽浮华

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos6.5虚拟机安装后,没有iptables配置文件相关的知识,希望对你有一定的参考价值。

 

openstack环境里安装centos6.5系统的虚拟机,安装好后,发现没有/etc/syscofig/iptables防火墙配置文件。

解决办法如下:

[[email protected] ~]# iptables -P OUTPUT ACCEPT
[[email protected] ~]# /etc/init.d/iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]

这样,/etc/sysconfig/iptables配置文件就有了
[[email protected] ~]# cat /etc/sysconfig/iptables
# Generated by iptables-save v1.4.7 on Wed Aug 31 01:14:57 2016
*filter
:INPUT ACCEPT [43:3196]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [23:2380]
COMMIT
# Completed on Wed Aug 31 01:14:57 2016


再补充点其他内容配置:
[[email protected] ~]# cat /etc/sysconfig/iptables
# Generated by iptables-save v1.4.7 on Wed Aug 31 01:14:57 2016
*filter
:INPUT ACCEPT [43:3196]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [23:2380]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -s 192.168.1.0/24 -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Wed Aug 31 01:14:57 2016
[[email protected] ~]# /etc/init.d/iptables restart
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]
[[email protected] ~]#

以上是关于centos6.5虚拟机安装后,没有iptables配置文件的主要内容,如果未能解决你的问题,请参考以下文章

虚拟机安装centos6.5

虚拟机下安装CentOS6.5系统教程

虚拟机上装的centos6怎么用

虚拟机装centos6.5,在xshell连接后。目录明明存在 为啥用CD跳转过去会显示没有这个目录或文件

虚拟机安装的centos6.5怎么升级到centos7

解决Centos6.5虚拟机上网问题