AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 115723
In Process
luison
luison
Asked: 2010-02-24 02:51:26 +0800 CST2010-02-24 02:51:26 +0800 CST 2010-02-24 02:51:26 +0800 CST

Karmic iptables 在 OpenVZ 容器上缺少内核模块

  • 772

在将我的 Ubuntu 服务器 p2v 迁移到我与之堆叠的 OpenVZ 容器失败后,我想我会尝试基于 Ubuntu 9.10 的干净 OpenVZ 模板重新安装(来自 OpenVZ wiki)

当我尝试在 VM 机器上加载我的 iptables 规则时,我遇到了一些错误,我认为这些错误与未从 /vz/XXX.conf 模板模型加载到 VM 上的内核模块有关。

我一直在测试我发现的一些帖子,但我遇到了错误:

WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.
FATAL: Could not load /lib/modules/2.6.24-10-pve/modules.dep: No such file or directory
iptables-restore v1.4.4: iptables-restore: unable to initialize table 'raw'

Error occurred at line: 2
Try `iptables-restore -h' or 'iptables-restore --help' for more information.

我读到了模板没有加载所有 iptables 模块,所以我将模块添加到 VZ 虚拟机的 XXX.conf 中,如下所示:

IPTABLES="ip_tables iptable_filter iptable_mangle ipt_limit ipt_multiport ipt_tos ipt_TOS ipt_REJECT ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_LOG ipt_length ip_conntrack ip_conntrack_ftp ip_conntrack_irc ipt_conntrack ipt_state ipt_helper iptable_nat ip_nat_ftp ip_nat_irc"

由于错误仍然存​​在,我读到我应该在虚拟机上再次构建依赖项:

depmod -a but this returned an error:

WARNING: Couldn't open directory /lib/modules/2.6.24-10-pve: No such file or directory
FATAL: Could not open /lib/modules/2.6.24-10-pve/modules.dep.temp for writing: No such file or directory

因此,我再次阅读了有关创建空目录并重做“depmod -a”的内容。

我现在没有得到依赖项错误,但得到了这个,我不知道如何继续:

WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.
FATAL: Module ip_tables not found.
iptables-restore v1.4.4: iptables-restore: unable to initialize table 'raw'

Error occurred at line: 2
Try `iptables-restore -h' or 'iptables-restore --help' for more information.

我知道虚拟机上的 iptables 规则必须不同,也许我们尝试应用的一些规则(来自我们的物理服务器)不兼容,但这些只是我希望能够进行的源 IP 和目标端口检查有可用的。我听说在 CentOS 模板上没有问题,所以我理解是与 VM 配置有关。

任何帮助将不胜感激。

linux iptables openvz kernel-modules ubuntu-9.10
  • 3 3 个回答
  • 3116 Views

3 个回答

  • Voted
  1. poige
    2012-04-10T21:20:40+08:002012-04-10T21:20:40+08:00

    我曾经问过同样的问题:) 事实证明,VE 中的 RAW 似乎至少需要 2.6.32-ovz。

    • 1
  2. Kyle Brandt
    2010-02-24T05:13:26+08:002010-02-24T05:13:26+08:00

    不是直接的答案,但对于我的 openvz 机器,我将 iptables 规则放在主机上。然后他们在一个地方,无论如何都必须通过主机。您可能会发现这更容易和更清洁(但可能不是)。

    • 0
  3. Hamish Downer
    2010-05-26T05:45:56+08:002010-05-26T05:45:56+08:00

    根据这篇文章,需要在主机节点上进行一些设置。(以下文字大部分来自文章,但没有块引用,以使其更具可读性。)

    首先,主机节点应该转发所有流量。以下命令使默认的 FORWARD 操作为 ACCEPT,然后刷新 FORWARD 链上的所有规则。

    iptables -P FORWARD ACCEPT
    iptables -F FORWARD
    

    如果您想在容器内使用防火墙,请在启动容器之前加载这些模块:

    modprobe xt_tcpudp
    modprobe ip_conntrack
    

    如果不这样做,您将收到如下错误:“iptables: No chain/target/match by that name”

    如果你想使用状态防火墙规则(你应该这样做!),你还需要确保 'ipt_state' 在你的 vz.conf 文件的 'IPTABLES' 选项中:

    IPTABLES="ipt_REJECT ipt_tos ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state"
    

    还要确保在主机上加载了“xt_state”模块:

    modprobe xt_state
    
    • 0

相关问题

  • 多操作系统环境的首选电子邮件客户端

  • 你最喜欢的 Linux 发行版是什么?[关闭]

  • 更改 PHP 的默认配置设置?

  • 保护新的 Ubuntu 服务器 [关闭]

  • (软)Ubuntu 7.10 上的 RAID 6,我应该迁移到 8.10 吗?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    从 IP 地址解析主机名

    • 8 个回答
  • Marko Smith

    如何按大小对 du -h 输出进行排序

    • 30 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    MikeN 在 Nginx 中,如何在维护子域的同时将所有 http 请求重写为 https? 2009-09-22 06:04:43 +0800 CST
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    0x89 bash中的双方括号和单方括号有什么区别? 2009-08-10 13:11:51 +0800 CST
  • Martin Hope
    Kyle Brandt IPv4 子网如何工作? 2009-08-05 06:05:31 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve