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
ifup eth0 on every boot
提问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 eth0
to 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/interfaces
and set default configuration data for every network interface on your system.
在 Ubuntu 中,您必须为/etc/network/interfaces
系统上的每个网络接口编辑和设置默认配置数据。
Put both auto
and 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
回答by Davide Berra
you can eidt /etc/sysconfig/network-scripts/ifcfg-eth0
file.
serach ONBOOT
with file content.
and change ONBOOT=no
to ONBOOT=yes
.
你可以eidt/etc/sysconfig/network-scripts/ifcfg-eth0
文件。搜索ONBOOT
文件内容。并更改ONBOOT=no
为ONBOOT=yes
.