Linux 每次启动时 ifup eth0

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14565110/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 18:49:45  来源:igfitidea点击:

ifup eth0 on every boot

linuxubuntu-11.04

提问by CSJ

04 and the network card is not supported by default kernel. So, I upgrade kernel to 3.2 and it support it. However, every time I reboot machine, need to sudo ifup eth0to bring up it.

04 并且默认内核不支持网卡。所以,我将内核升级到 3.2 并且它支持它。但是,每次我重新启动机器时,都需要sudo ifup eth0启动它。

How can I modify some config to auto bring up eht0? (not write in /etc/rc.local, cause I mount NFS on /etc/fstab, it need to mount first than rc.local).

如何修改一些配置以自动启动 eht0?(不写/etc/rc.local,因为我在 上挂载 NFS /etc/fstab,它需要先挂载rc.local)。

采纳答案by Davide Berra

In Ubuntu you have to edit /etc/network/interfacesand set default configuration data for every network interface on your system.

在 Ubuntu 中,您必须为/etc/network/interfaces系统上的每个网络接口编辑和设置默认配置数据。

Put both autoand your interface name on a separate line before your interface configuration in order to bring it up at startup.

将两者auto和您的接口名称放在您的接口配置之前的单独一行中,以便在启动时启动它。

Example: When your configuration is like this

例子:当你的配置是这样的

iface eth0 inet static
address 192.168.1.5
netmask 255.255.255.0
gateway 192.168.1.254

You have to change it to this

你必须把它改成这个

auto eth0
iface eth0 inet static
address 192.168.1.5
netmask 255.255.255.0
gateway 192.168.1.254

Network card configuration

网卡配置

回答by Davide Berra

you can eidt /etc/sysconfig/network-scripts/ifcfg-eth0file. serach ONBOOTwith file content. and change ONBOOT=noto ONBOOT=yes.

你可以eidt/etc/sysconfig/network-scripts/ifcfg-eth0文件。搜索ONBOOT文件内容。并更改ONBOOT=noONBOOT=yes.