您当前的位置: 首页 > 网络技术  > 服务器教程 浏览
Ubuntu10.10网卡配置文件重启失效
发布时间:2015-12-11    点击率:次    来源:www.sytcke.com    作者:电脑技术学习网

   环境:ubuntu 10.10

  目标:配置网卡启动时加载iptables规则

  网络上搜到的各种操作:

  sh -c "iptables-save > /etc/iptables.rules"

  vi /etc/network/interfaces

  ## 目标网卡下增加一条命令

  ## pre-up iptables-restore < /etc/iptables.rules

  但是,经测试发现。重启后这些配置会丢失,查看这个文件头会发现。

  # This configuration file is auto-generated.

  # WARNING: Do not edit this file, your changes will be lost.

  # Please create/edit /etc/network/interfaces.head and /etc/network/interfaces.tail instead,

  # their contents will be inserted at the beginning and at the end

  # of this file, respectively.

  #

  # NOTE: it is NOT guaranteed that the contents of /etc/network/interfaces.tail

  # will be at the very end of this file.

  文件写得很明确,/etc/network/interfaces是自动生成的。如果我们需要自定义配置,那就创建/etc/network/interfaces.head或/etc/network/interfaces.tail。其中/etc/network/interfaces.tail并不推荐。

  以下是一个示例:

  auto venet0:0

  iface venet0:0 inet static

  address 184.22.224.125

  netmask 255.255.255.0

  pre-up iptables-restore < /etc/iptables.rules

来源 电脑技术网 www.sytcke.com
发表留言
发表留言请先登录!
免责声明:本站发布的信息和评论纯属网民个人行为,并不代表本站立场,如发现有违法信息或侵权行为,请直接与本站管理员联系,我们将在收到您的信息后24小时内作出处理!