运维开发网
广告位招商联系QQ:123077622
 
广告位招商联系QQ:123077622

CentOS中的"resolv.conf"文件被重置的解决方案

运维开发网 https://www.qedev.com 2021-01-31 14:41 出处:51CTO 作者:sky9890
操作系统:CentOS Linux release 7.8实战任务:当配置resolv文件之后,如果重启了CentOS操作系统或者重启了网络服务,将在resolv文件中丁丁配置的将会丢失,下面将列出了解决此问题的操作步骤。[[email protected] network-scripts]# vi /etc/resolv.conf # Generated by NetworkManagernamese

操作系统:CentOS Linux release 7.8

实战任务:当配置resolv文件之后,如果重启了CentOS操作系统或者重启了网络服务,将在resolv文件中丁丁配置的将会丢失,下面将列出了解决此问题的操作步骤。

[[email protected] network-scripts]# vi /etc/resolv.conf 

# Generated by NetworkManager

nameserver 220.248.192.12

nameserver 220.248.192.13

nameserver 8.8.8.8

[[email protected] network-scripts]# cat /etc/resolv.conf 

# Generated by NetworkManager

nameserver 220.248.192.12

nameserver 220.248.192.13

nameserver 8.8.8.8

[[email protected] network-scripts]# ping 8.8.8.8

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.

64 bytes from 8.8.8.8: icmp_seq=1 ttl=111 time=346 ms

64 bytes from 8.8.8.8: icmp_seq=2 ttl=111 time=349 ms

64 bytes from 8.8.8.8: icmp_seq=3 ttl=111 time=346 ms

[[email protected] network-scripts]# systemctl restart network

[[email protected] network-scripts]# cat /etc/resolv.conf 

# Generated by NetworkManager

nameserver 220.248.192.12

nameserver 220.248.192.13

[[email protected] network-scripts]# pwd

/etc/sysconfig/network-scripts

[[email protected] network-scripts]# vi ifcfg-eth0 

......

DNS1=220.248.192.12

DNS2=220.248.192.13

DNS3=8.8.8.8

......

[[email protected] network-scripts]#systemctl restart  network

[[email protected] ~]# cat  /etc/resolv.conf 

# Generated by NetworkManager

nameserver 220.248.192.12

nameserver 220.248.192.13

nameserver 8.8.8.8

扫码领视频副本.gif

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号