首页 最新文章网站服务器正文

关于liunx系统DNS服务

  内网通,外网不同,判断是DNS解析的问题

  [root@localhost ~]# ping 172.100.101.1

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

  64 bytes from 172.100.101.1: icmp_seq=1 ttl=255 time=0.658 ms

  64 bytes from 172.100.101.1: icmp_seq=2 ttl=255 time=0.695 ms

  64 bytes from 172.100.101.1: icmp_seq=3 ttl=255 time=0.701 ms

  ^Z

  [4]+ 已停止 ping 172.100.101.1

  [root@localhost ~]# wget www.baidu.com

  --2018-01-19 15:56:53-- http://www.baidu.com/

  正在解析主机 www.baidu.com (www.baidu.com)... ^Z

  [5]+ 已停止 wget www.baidu.com

  [root@localhost ~]#

  Centos系统查看网卡信息:

  [root@localhost ~]# ip add

  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1

  link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

  inet 127.0.0.1/8 scope host lo

  valid_lft forever preferred_lft forever

  inet6 ::1/128 scope host

  valid_lft forever preferred_lft forever

  2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

  link/ether 98:ee:cb:3d:89:62 brd ff:ff:ff:ff:ff:ff

  inet 172.100.101.207/24 brd 172.100.101.255 scope global enp2s0

  valid_lft forever preferred_lft forever

  inet6 fe80::9aee:cbff:fe3d:8962/64 scope link

  valid_lft forever preferred_lft forever

  [root@localhost ~]#

  查看网络配置信息:

  [root@localhost network-scripts]# vi /etc/sysconfig/network-scripts/ifcfg-enp2s0

  HWADDR="98:EE:CB:3D:89:62"

  TYPE="Ethernet"

  BOOTPROTO="static"

  DEFROUTE="yes"

  PEERDNS="yes"

  PEERROUTES="yes"

  IPV4_FAILURE_FATAL="no"

  IPV6INIT="yes"

  IPV6_AUTOCONF="yes"

  IPV6_DEFROUTE="yes"

  IPV6_PEERDNS="yes"

  IPV6_PEERROUTES="yes"

  IPV6_FAILURE_FATAL="no"

  NAME="enp2s0"

  UUID="d3d7f05c-5c4b-460c-ac82-1919cec1ae10"

  IPADDR=172.100.101.207

  GATEWAY=172.100.101.1

  NETMASK=255.255.255.0

  NM_CONTROLLED=no

  ONBOOT="yes"

  DNS1=8.8.8.8 → 114.114.114.114

  DNS2=4.2.2.2 → 114.114.115.115

  [root@localhost network-scripts]#

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

  # Generated by NetworkManager

  # No nameservers found; try putting DNS servers into your

  # ifcfg files in /etc/sysconfig/network-scripts like so:

  #

  # DNS1=xxx.xxx.xxx.xxx

  # DNS2=xxx.xxx.xxx.xxx

  # DOMAIN=lab.foo.com bar.foo.com

  nameserver 8.8.8.8 → 114.114.114.114

  nameserver 4.2.2.2 → 114.114.114.114

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

  Restarting network (via systemctl): [ 确定 ]

  [root@localhost network-scripts]# wget www.baidu.com

  --2018-01-19 16:13:16-- http://www.baidu.com/

  正在解析主机 www.baidu.com (www.baidu.com)... 111.13.100.91, 111.13.100.92

  正在连接 www.baidu.com (www.baidu.com)|111.13.100.91|:80... 已连接。

  已发出 HTTP 请求,正在等待回应... 200 OK

  长度:2381 (2.3K) [text/html]

  正在保存至: “index.html”

  100%[======================================================================================================================================================================================>] 2,381 --.-K/s 用时 0s

  2018-01-19 16:13:16 (89.5 MB/s) - 已保存 “index.html” [2381/2381])

  [root@localhost network-scripts]#

  dns外网访问恢复

  扫码关注博主微信公众号:

  blob.png

©️公众号:思考者文刀

评论

精彩评论

百度搜索

站点信息

  • 文章总数:436
  • 页面总数:9
  • 分类总数:30
  • 标签总数:924
  • 评论总数:517
  • 浏览总数:1804753
觉得有用就打赏吧
关注本站公众号,享受更多服务!
联系方式
合作微信:itker0110
新媒体:Excel加油站(抖音/小红书/哔哩/头条)
公众号:左手Excel右手VBA
知乎:Excel其实很简单
Copyright2015-2024.Powered by ©️云水客 | 网站地图 | 辽ICP备14000512号-5
您是本站第1970名访客 今日有0篇新文章