首页>>帮助中心>>香港云服务器Linux如何开机自动连接网络

香港云服务器Linux如何开机自动连接网络

2025/4/4 48次

香港云服务器Linux如何开机自动连接网络

1. 编辑ifcfg-eth0,eth0是系统中的第一块网卡,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
# 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网卡启动项

一诺网络香港免备案专区,提供「香港增强云服务器」和「香港特惠云服务器」两种类型的高可用弹性计算服务,搭载新一代英特尔®至强®铂金处理器,接入CN2低延时高速回国带宽线路,网络访问顺滑、流畅。机房网络架构采用了BGP协议的解决方案可提供多线路互联融合网络,使得不同网络运营商线路的用户都能通过最佳路由实现快速访问。香港云服务器低至29元/月,购买链接:https://www.enuoidc.com/vps.html?typeid=2