操作系统:CentOS Linux release 7.8

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

[root@localhost network-scripts]# vi /etc/resolv.conf 

# Generated by NetworkManager

nameserver 220.248.192.12

nameserver 220.248.192.13

nameserver 8.8.8.8

[root@localhost network-scripts]# cat /etc/resolv.conf 

# Generated by NetworkManager

nameserver 220.248.192.12

nameserver 220.248.192.13

nameserver 8.8.8.8

[root@localhost 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

[root@localhost network-scripts]# systemctl restart network

[root@localhost network-scripts]# cat /etc/resolv.conf 

# Generated by NetworkManager

nameserver 220.248.192.12

nameserver 220.248.192.13

[root@localhost network-scripts]# pwd

/etc/sysconfig/network-scripts

[root@localhost network-scripts]# vi ifcfg-eth0 

......

DNS1=220.248.192.12

DNS2=220.248.192.13

DNS3=8.8.8.8

......

[root@localhost network-scripts]#systemctl restart  network

[root@localhost ~]# cat  /etc/resolv.conf 

# Generated by NetworkManager

nameserver 220.248.192.12

nameserver 220.248.192.13

nameserver 8.8.8.8

©著作权归作者所有:来自51CTO博客作者sky9890的原创作品,如需转载,请注明出处,否则将追究法律责任

你的鼓励让我更有动力

赞赏

0人进行了赞赏支持

更多相关文章

  1. 新的一年对自己的希望
  2. (cat<<EOF)不使用反斜杠转义的技巧
  3. 谷歌浏览器无法保存密码
  4. MacOS 10导入信任证书
  5. tcping测试服务器TCP端口
  6. 一句话锁定MySQL数据占用元凶
  7. Android(安卓)Unable to resolve target 'android-8'
  8. Android中四大组件(四大天王)
  9. Unity之调用AndroidWebView

随机推荐

  1. 嘿,你知道新冠疫情现在什么样了吗?
  2. C#基础入门第十四天(MD5加密,WinForm)
  3. 啥是佩奇排名算法
  4. Python与Tableau相结合,万字长文搞定传统
  5. 图解LeetCode第 279 号问题: 完全平方数
  6. Android(安卓)- 引用计数(sp、wp、Refbase
  7. 时间序列&日期学习笔记大全(上)
  8. 图解LeetCode第 445 号问题: 两数相加 II
  9. 图解LeetCode第 199 号问题:二叉树的右视
  10. 使用RxJs WebSocket,HighCharts和Angular