How can i use iptables on centos 7?

简介: I installed CentOS 7 with minimal configuration (os + dev tools). I am trying to open 80 port for httpdservice, but something wrong with my iptables service .

I installed CentOS 7 with minimal configuration (os + dev tools). I am trying to open 80 port for httpdservice, but something wrong with my iptables service ... what's wrong with it? What am I doing wrong?


# ifconfig/sbin/service iptables save
bash: ifconfig/sbin/service: No such file or directory


# /sbin/service iptables save
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.

# sudo service iptables status
Redirecting to /bin/systemctl status  iptables.service
iptables.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

# /sbin/service iptables save
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.

# sudo service iptables start
Redirecting to /bin/systemctl start  iptables.service
Failed to issue method call: Unit iptables.service failed to load: No such file or directory.  




With RHEL 7 / CentOS 7, firewalld was introduced to manage iptables. IMHO, firewalld is more suited for workstations than for server environments.

 

It is possible to go back to a more classic iptables setup. First, stop and mask the firewalld service:

systemctl stop firewalld
systemctl mask firewalld
  

Then, install the iptables-services package:

 

yum install iptables-services
  

Enable the service at boot-time: IT网,http://www.it.net.cn

systemctl enable iptables
  

Managing the service

 

systemctl [stop|start|restart] iptables
  

Systemctl doesn't seem to manage the save action like you were able to do in the past with service:

 

/usr/libexec/iptables/iptables.init save  

 

This fixed it: Linux学习,http:// linux.it.net.cn

yum install iptables-services
systemctl mask firewalld
systemctl enable iptables
systemctl enable ip6tables
systemctl stop firewalld
systemctl start iptables
systemctl start ip6tables  
目录
相关文章
|
存储 安全 数据安全/隐私保护
Harbor私有镜像仓库搭建
Harbor是由VMware开发的开源镜像仓库管理系统,具有以下一些主要特点和功能: 1.镜像管理 Harbor可以存储、管理镜像,支持访问控制、镜像复制、镜像删除等功能。 2.角色访问控制 可以创建用户和设置角色控制镜像的访问权限,例如只读或读写权限。 3.镜像复制 支持在多个Harbor实例之间复制镜像,保证分布式部署可以访问相同镜像。 4.镜像安全扫描 可以配置镜像安全扫描,检测镜像中的漏洞或风险。 5.镜像签名与信任 支持内容信任机制,确保镜像来源可信的同时保护镜像内容不被篡改。 6.策略管理 可以对用户访问、镜像复制和其他操作设置灵活的策略。
320 1
|
消息中间件 Java Kafka
集群环境下zookeeper和kafka详细安装教程
集群环境下zookeeper和kafka详细安装教程
358 0
集群环境下zookeeper和kafka详细安装教程
|
编译器 Linux C语言
C语言进阶-自定义类型:结构体、枚举、联合(上)
C语言进阶-自定义类型:结构体、枚举、联合(上)
150 0
|
机器学习/深度学习 API TensorFlow
|
8天前
|
人工智能 运维 安全
|
6天前
|
人工智能 异构计算
敬请锁定《C位面对面》,洞察通用计算如何在AI时代持续赋能企业创新,助力业务发展!
敬请锁定《C位面对面》,洞察通用计算如何在AI时代持续赋能企业创新,助力业务发展!
|
7天前
|
机器学习/深度学习 人工智能 自然语言处理
B站开源IndexTTS2,用极致表现力颠覆听觉体验
在语音合成技术不断演进的背景下,早期版本的IndexTTS虽然在多场景应用中展现出良好的表现,但在情感表达的细腻度与时长控制的精准性方面仍存在提升空间。为了解决这些问题,并进一步推动零样本语音合成在实际场景中的落地能力,B站语音团队对模型架构与训练策略进行了深度优化,推出了全新一代语音合成模型——IndexTTS2 。
643 22
|
7天前
|
人工智能 测试技术 API
智能体(AI Agent)搭建全攻略:从概念到实践的终极指南
在人工智能浪潮中,智能体(AI Agent)正成为变革性技术。它们具备自主决策、环境感知、任务执行等能力,广泛应用于日常任务与商业流程。本文详解智能体概念、架构及七步搭建指南,助你打造专属智能体,迎接智能自动化新时代。
|
13天前
|
人工智能 JavaScript 测试技术
Qwen3-Coder入门教程|10分钟搞定安装配置
Qwen3-Coder 挑战赛简介:无论你是编程小白还是办公达人,都能通过本教程快速上手 Qwen-Code CLI,利用 AI 轻松实现代码编写、文档处理等任务。内容涵盖 API 配置、CLI 安装及多种实用案例,助你提升效率,体验智能编码的乐趣。
1045 110