1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# 由于使用 ping 等命令 本地好像需要 root 权限,先切一个 root 用户
su root
ping xuegod.cn -c 1
# 发一个数据包
:<<EOF
ping baidu.com
PING baidu.com (220.181.38.251) 56(84) bytes of data.
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=1 ttl=47 time=42.3 ms
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=2 ttl=47 time=141 ms
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=3 ttl=47 time=141 ms
EOF
# 由上面就知道 ping 是用的 icmp协议的
nslookup www.baidu.com
:<<EOF
# 使用 nslookup 查看命令
Server: 172.28.16.1 #DNS 服务器
Address: 172.28.16.1# DNS 服务器地址
Non-authoritative answer:
Name: baidu.com # 我们解析到的域名
Address: 220.181.38.148
Name: baidu.com
Address: 220.181.38.251 # 解析到 的 IP地址
EOF
# dig 命令,收集相关的信息
dig baidu.com
:<<EOF
; <<>> DiG 9.16.1-Ubuntu <<>> baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57661
;; flags: qr rd ad; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available
;; QUESTION SECTION:
;baidu.com. IN A
;; ANSWER SECTION:
baidu.com. 0 IN A 220.181.38.148
baidu.com. 0 IN A 220.181.38.251
;; Query time: 0 msec
;; SERVER: 172.28.16.1#53(172.28.16.1)
;; WHEN: Tue Sep 21 11:43:23 CST 2021
;; MSG SIZE rcvd: 68
EOF
dig www.xxx.com
:<<EOF
;; Query time: 10 msec
;; SERVER: 172.28.16.1#53(172.28.16.1) # 这就是DNS服务器地址
;; WHEN: Tue Sep 21 11:47:58 CST 2021
;; MSG SIZE rcvd: 66
EOF
|