您的位置:首页 > 运维架构 > Linux

Linux nslookup命令

2016-04-06 14:59 465 查看
nslookup命令功能说明
nslookup命令,在Windows、Linux下常用的网络命令,可用来诊断域名系统(DNS)的信息。Centos7,由于使用最小安装,默认没有带该命令,下面是安装命令演示:
[root@c7 ~]# nslookup #提示没有找到命令-bash: nslookup: 未找到命令[root@c7 ~]# yum provides */nslookup#查询nslookup使用哪个软件包已加载插件:fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.neusoft.edu.cn * extras: mirrors.tuna.tsinghua.edu.cn * updates: mirrors.tuna.tsinghua.edu.cn #查询到是使用bind-utils软件包32:bind-utils-9.9.4-29.el7.x86_64 : Utilities for querying DNS name servers源 :base匹配来源:文件名 :/usr/bin/nslookup[root@c7 ~]# yum -y install bind-utils #安装该bind-utils软件包[root@c7 ~]# nslookup> www.baidu.comServer: 219.141.140.10Address: 219.141.140.10#53
Non-authoritative answer:www.baidu.com canonical name = www.a.shifen.com.Name: www.a.shifen.comAddress: 220.181.112.244Name: www.a.shifen.comAddress: 220.181.111.188>
示例
截取其中服务器的IP地址

[root@rsync01 shell]# nslookup z.cn
Server: 114.114.114.114
Address: 114.114.114.114#53

Non-authoritative answer:
Name: z.cn
Address: 54.222.60.252

[root@rsync01 shell]# nslookup z.cn | tail -2 | head -1 | awk '{print $2}'
54.222.60.252
[root@rsync01 shell]#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nslookup命令