Problem 1 :nslookup,dig,host及网络相关命令
网络基础命令
[root@localhost sysconfig]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.88.0 0.0.0.0 255.255.255.0 U eth0 #DHCP服务器及submask
0.0.0.0 192.168.88.2 0.0.0.0 UG eth0 #网关,DNSserver [root@localhost network-scripts]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.88.0 0.0.0.0 255.255.255.0 U eth0
0.0.0.0 192.168.88.2 0.0.0.0 UG eth0 Flags标志说明:
U Up表示此路由当前为启动状态
H Host,表示此网关为一主机
G Gateway,表示此网关为一路由器
R Reinstate Route,使用动态路由重新初始化的路由
D Dynamically,此路由是动态性地写入
M Modified,此路由是由路由守护程序或导向器动态修改 [root@localhost sysconfig]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="00:0C:29:D0:52:CC"
IPV6INIT="yes"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="2ea6c705-ac16-4ef5-8185-52d8ab5f9569" [root@www.ctohome.com]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Intel Corporation 82567V- Gigabit Network Connection
DEVICE=eth0
BOOTPROTO=none
HWADDR=:1c:c0:f8:a1:ac
ONBOOT=yes
NETMASK=255.255.255.248
IPADDR=184.82.152.98
GATEWAY=184.82.152.97
TYPE=Ethernet 修改hostnmae
[root@localhost profiles]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain traceroute baidu.com #第一行就是自己的网关 [root@localhost network-scripts]# ip route show
192.168.88.0/ dev eth0 proto kernel scope link src 192.168.88.133 metric
default via 192.168.88.2 dev eth0 proto static
说明:
# 192.168.88.133:本地IP
# 192.168.88.0/:网段
# 192.168.88.2:网关
安装nslookup,以及dig工具(dig一般默认被安装,nslookup则没有,Windows下默认提供)
yum provides */nslookup
yum install bind-utils
域名解析基础配置文件:
ifconfig -a:查看ip/netmask /etc/hosts :记录hostname对应的ip地址 /etc/resolv.conf :设置DNS服务器的ip地址
[root@localhost sysconfig]# cat /etc/resolv.conf
# Generated by NetworkManager
domain localdomain
search localdomain
nameserver 192.168.88.2 /etc/host.conf :域名解析配置文件(Resolver configuration file)
DNS的查询指令:host、nslookup、dig
host 语法:
Host [-a] [FQDN] [server]
Host -l [domain] [server]
参数说明:
-a :asking host to make a query of type ANY
-C :display the SOA records for zone name from all the listed authoritative name servers for that zone.
-t :CNAME, NS, SOA, SIG, KEY, AXFR, etc.By default, it looks for A, AAAA, and MX records, but if the -C option was given, queries will be made for SOA records,
-l :若后面接的那个domain设定允许allow-transfer时,则列出该domain所管理的所有主机名称对应资料。
Server: 这个参数可有可无,当想要利用非/etc/resolv.conf内的主机来查询主机名称与ip的对应时,就可以利用这个参数了。 [root@localhost network-scripts]# host -a qq.com
Trying "qq.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id:
;; flags: qr rd ra; QUERY: , ANSWER: , AUTHORITY: , ADDITIONAL: ;; QUESTION SECTION:
;qq.com. IN ANY ;; ANSWER SECTION:
qq.com. IN A 61.135.157.156
qq.com. IN A 125.39.240.113
qq.com. IN MX mx1.qq.com.
qq.com. IN MX mx3.qq.com.
qq.com. IN MX mx2.qq.com. ;; ADDITIONAL SECTION:
mx1.qq.com. IN A 103.7.30.40 Received bytes from 192.168.88.2# in ms
[root@localhost network-scripts]#
[root@localhost network-scripts]#
[root@localhost network-scripts]# host -l qq.com
; Transfer failed.
Host qq.com.localdomain not found: (NOTIMP)
; Transfer failed.
[root@localhost ~]# host -t any qq.com
qq.com has address 61.135.157.156
qq.com has address 125.39.240.113
qq.com name server ns1.qq.com.
qq.com name server ns2.qq.com.
qq.com name server ns3.qq.com.
qq.com name server ns4.qq.com.
qq.com has SOA record ns1.qq.com. webmaster.qq.com.
qq.com mail is handled by mx2.qq.com.
qq.com mail is handled by mx1.qq.com.
qq.com mail is handled by mx3.qq.com.
nslookup和windows下的nslookup使用方法很像。
Nslookup [FQDN] [server]
nslookup -type=any qq.com
nslookup -query=mx qq.com
或者
nslookup #进入nslookup命令
然后
set q=mx OR set type=mx
set q=a,mx,ptr,etc.
dig
Dig [@server] [FQDN] [type]
参数说明:
@server :如果不想以/etc/resolv.conf来作为dns主机,则可以在此填入其他的ip
Type :预设是查询A记录,你可以在这里写入其他的记录,如:MX,NS等。
此功能亦可使用[-t type]来处理。
下面是 dig 的一些比较常用的命令:
dig qq.com A
dig qq.com MX
dig -x 210.176.50.140 @8.8.8.8
dig baidu.com +nssearch # 查找一个域的授权 dns 服务器
dig bandainamcoasia.com +trace # 从根服务器开始追踪一个域名的解析过程
dig +norec @F.ROOT-SERVERS.NET HOSTNAME.BIND CHAOS TXT # 查看你使用的是那个 F root dns server
Problem 1 :nslookup,dig,host及网络相关命令的更多相关文章
- dos命令:网络相关命令
网络相关命令 一.Arp命令 1.介绍 显示和修改地址解析协议(ARP)使用的“IP 到物理”地址转换表. 2.语法 ARP -s inet_addr eth_addr [if_addr] ARP ...
- 网络相关命令-netstat
网络相关命令 netstat显示网络状态 usage: netstat [-vWeenNcCF] [<Af>] -r netstat {-V|--version|-h|--help} ne ...
- Linux 网络相关命令 Cheat Sheet
以下漫画形式呈现的常用 Linux 网络相关命令速查表来自 twitter -
- Linux网络相关命令小结
# ifconfig # ifup/ifdown # route -n # ip link show //显示本机所有接口信息 # traceroute # netstat //查看本机网络连接与后门 ...
- 『学了就忘』Linux基础命令 — 34、配置网络相关命令
目录 1.配置网络常用命令 2.ifconfig命令 3.ping命令 4.netstat 命令 使用1:查看本机开启的端口 使用2:查看本机有哪些程序开启的端口 使用3:查看所有连接 使用4:查看网 ...
- 域名DNS解析工具ping/nslookup/dig/host
常见 DNS 记录的类型 类型 目的 A 地址记录,用来指定域名的 IPv4 地址,如果需要将域名指向一个 IP 地址,就需要添加 A 记录. AAAA 用来指定主机名(或域名)对应的 IPv6 地址 ...
- LINUX网络相关命令(转)
网络连通性 Ping:发送一个 ICMP 回声请求消息给主机,一直持续到到你按下 Ctrl+C .Ping 表示一个包通过 ICMP 从你的机器发送出去,然后在IP层得到回应.Ping 可以检测你与另 ...
- Linux 网络相关命令
1.修改ip,dns相关:sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0 2.ifconfig 查找ip,mac地址 3.重启网络:sudo ser ...
- linux网络相关命令使用
A,iptables使用示例 1,将请求80端口的包发送给本机8180端口(这样,别的机器访问本机的80端口时会被转发到8180端口去) iptables -t nat -A PREROUTING - ...
随机推荐
- jsp-servlet(1)环境搭建(Tomcat和myeclipse)和基本概念
1 Tomcat安装 下载并解压: 点击bin目录下的start.bat文件启动(这里可能会报错,initinternal failed ,检查8080端口是不是被占用了,然后重新启动); 访问loc ...
- 【c++基础】字符数组和string相互转换
字符数组转化成string类型char ch [] = "ABCDEFG";string str(ch);//也可string str = ch;或者char ch [] = &q ...
- 双向重定向tee命令详解
vim一般在训练网络的时候需要保存log文件,同时需要在屏幕上网络的输出信息,在shell文件中常常会看到如下代码 执行的命令 2>&1 | tee log.txt tee是linux中 ...
- [LeetCode&Python] Problem 762. Prime Number of Set Bits in Binary Representation
Given two integers L and R, find the count of numbers in the range [L, R](inclusive) having a prime ...
- 利用Git hub创建博客
1.准备工作 到Git官网 下载Git,并且配置环境变量 2.注册Git Hub账号 到Git Hub官网注册相关账号,比如本文的账号为13627225740L,并至New repository创建仓 ...
- HDU 1171 Big Event in HDU dp背包
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s ...
- 高斯消元 o(n^3) 取摸和不取摸
#include<bits/stdc++.h> using namespace std; ; int a[MAXN][MAXN];//增广矩阵 int x[MAXN];//解集 bool ...
- Linux交叉工具链安装
这篇博文http://blog.csdn.net/u010957054/article/details/58056863 提到了一个好的百度网盘,里面有各个版本的交叉工具链. http://www.3 ...
- ElasticSearch安装部署,基本配置(Ubuntu14.04)
ElasticSearch部署文档(Ubuntu 14.04) 安装java sudo add-apt-repository ppa:webupd8team/java sudo apt-get upd ...
- mysql自增主键
MariaDB [test]> create table test1(id int primary key auto_increment,name varchar(20))auto_increm ...