欢迎来到山村网

Ubuntu10.10网卡配置文件重启失效

2019-03-09 10:17:49浏览:164 来源:山村网   
核心摘要:  环境:ubuntu 10.10  目标:配置网卡启动时加载iptables规则  网络上搜到的各种操作:  sh -c iptables-save/etc/ipta

  环境: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

(责任编辑:豆豆)
下一篇:

Tenda腾达路由器限速图解教程

上一篇:

华为路由器UPnP怎么开启

  • 信息二维码

    手机看新闻

  • 分享到
打赏
免责声明
• 
本文仅代表作者个人观点,本站未对其内容进行核实,请读者仅做参考,如若文中涉及有违公德、触犯法律的内容,一经发现,立即删除,作者需自行承担相应责任。涉及到版权或其他问题,请及时联系我们 xfptx@outlook.com