CentOS 安装后的网络设置

一。在安装minimalCentOS后,启动后输入  root 与密码 

 

二。cd 进入/etc/sysconfig/network-scripts 文件夹

 

三。vi 编辑 文件  ifcfg-enp4sp0     我看网上其它是  ifcfg-eth0,因为我的网卡名是  enp4sp0

 四。修改内容

BOOTPROTO="static" #dhcp改为static
ONBOOT="yes" #开机启用本配置
IPADDR=192.168.7.106 #静态IP
GATEWAY=192.168.7.1 #默认网关

NETMASK=255.255.255.0 #子网掩码

DNS1=192.168.7.1 #DNS 配置 

 

五。修改  ONBOOT=no     -->   ONBOOT = yes       按esc   输入  :(英文冒号) wq 保存退出

 

六。yum -y install net-tools  安装网络工具  (ipconfg)

 

七。service network restart # 重启网络服务

 

posted @ 2023-06-07 09:16  Wangbo10482479  阅读(39)  评论(0)    收藏  举报