云服务器

1. 编辑ifcfg-eth0eth0是系统中的第一块网卡,1是第2块,以此类推,找到“ONBOOT=no”,修改为“ONBOOT=yes”。

#   vi   /etc/sysconfig/network-scripts/ifcfg-eth0  #编辑eth0的配置文件#

DEVICE=eth0

HWADDR=00:00:00:00:00:00

TYPE=Ethernet

UUID=00000000-0000-0000-0000-000000000000

ONBOOT=yes

NM_CONTROLLED=yes

BOOTPROTO=static

IPADDR=192.168.111.11

NETMASK=255.255.255.0

GATEWAY=192.168.111.1

DNS1=192.168.111.1

DNS2=222.172.200.68

2. 如果按照上面的配置都不起作用,开机后还是需要手动去激活,可以修改“rc.local”配置文件,在文件中增加入:“ifup eth0”或者“ifconfig eth0 up”。

说明:“rc.local”是Linux系统中的自启动服务

# vi /etc/rc.d/rc.local

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don't

# want to do the full Sys V style init stuff.

 

touch /var/lock/subsys/local

ifup eth0[root@******]# vi /etc/rc.d/rc.local

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don't

# want to do the full Sys V style init stuff.

 

touch /var/lock/subsys/local

ifup eth0  #加入eth0网卡启动项


提交成功!非常感谢您的反馈,我们会继续努力做到更好!

这条文档是否有帮助解决问题?

非常抱歉未能帮助到您。为了给您提供更好的服务,我们很需要您进一步的反馈信息:

在文档使用中是否遇到以下问题: