0
点赞
收藏
分享

微信扫一扫

CentOS的IP地址配置

米小格儿 2022-02-20 阅读 86

1. 说明

给刚装好的 CentOS 的电脑配置 IP 地址,比较简单就是总也记不住,记录一下。

2. 设置步骤


1. 打开配置文件

vim /etc/sysconfig/network-scripts/ifcfg-eth0 

2. 写入项

  • i 进行编辑
  • [ESC] 后输入 :wq 为保存退出
DEVICE=eth0             # 网卡对应的设备别名,如ifcfg-eth0第一块网卡
BOOTPROTO=static        # 配置静态IP地址
ONBOOT=yes    	        # 系统启动时是否设置此网络接口

IPADDR=192.168.xxx.xxx  # IP地址
NETMSK=255.255.255.0    # 子网掩码
GATEWAY=192.168.xxx.xxx # 网关
DNS1=119.29.29.29 	    # DNS
DNS2=8.8.8.8

3. 重启网卡设置

systemctl start network.service
或者
service network restart

4. 查看网络信息(IP地址)

ip addr
或者
ifconfig

4. PING测试

ping 192.168.xxx.xxx

3. 参考

参考了如下博客。

[1]. centos linux 7 IP配置,CentOS 7 配置IP
https://blog.csdn.net/weixin_39968655/article/details/116854509
[2]. centos7 配置ip地址
https://blog.csdn.net/JineD/article/details/115254227
[3]. Centos如何设置IP地址
https://blog.csdn.net/yanghaitao5000/article/details/119926342

举报

相关推荐

0 条评论