今天学习进度还是 鸟哥的 Linux 私房菜 -- DNS Server
/etc/nsswitch.conf
:设定查询主机名称的顺序,像我的就是 passwd 优先
test@test:~$ cat /etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: files systemd
group: files systemd
shadow: files
gshadow: files
hosts: files dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
名称检吸器/etc/hosts
,可以知道为何 localhost 对应 127.0.0.1 这个IP
test@test:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 test
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
鸟哥建议 DNS 服务器的 IP 可以设定 2 个,但不要超过 3 个
可以在 /etc/resolv.conf
做设定
test@test:~$ cat /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
options edns0
search mshome.net
测试 DNS 方式
test@test:~$ host yahoo.com.tw
yahoo.com.tw has address 212.82.100.150
yahoo.com.tw has address 98.136.103.23
yahoo.com.tw has address 74.6.136.150
yahoo.com.tw mail is handled by 10 mx-tw.mail.gm0.yahoodns.net.
host -a 方式
test@test:~$ host -a yahoo.com.tw
Trying "yahoo.com.tw"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26368
;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;yahoo.com.tw. IN ANY
;; ANSWER SECTION:
yahoo.com.tw. 0 IN A 98.136.103.23
yahoo.com.tw. 0 IN A 74.6.136.150
yahoo.com.tw. 0 IN A 212.82.100.150
yahoo.com.tw. 0 IN NS ns2.yahoo.com.
yahoo.com.tw. 0 IN NS ns3.yahoo.com.
yahoo.com.tw. 0 IN NS ns1.yahoo.com.
yahoo.com.tw. 0 IN NS ns5.yahoo.com.
yahoo.com.tw. 0 IN NS ns4.yahoo.com.
yahoo.com.tw. 0 IN SOA hidden-master.yahoo.com. hostmaster.yahoo-inc.com. 2020081800 3600 900 604800 600
yahoo.com.tw. 0 IN MX 10 mx-tw.mail.gm0.yahoodns.net.
yahoo.com.tw. 0 IN TXT "v=spf1 redirect=_spf.mail.yahoo.com"
Received 339 bytes from 127.0.0.53#53 in 312 ms
test@test:~$ nslookup yahoo.com.tw
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: yahoo.com.tw
Address: 212.82.100.150
Name: yahoo.com.tw
Address: 98.136.103.23
Name: yahoo.com.tw
Address: 74.6.136.150
反解、正解测试
# 反解
test@test:~$ nslookup
> 120.114.100.20
20.100.114.120.in-addr.arpa name = mail-out-r2.ksu.edu.tw.
20.100.114.120.in-addr.arpa name = mail.ksu.edu.tw.
20.100.114.120.in-addr.arpa name = mail-smtp-proxy.ksu.edu.tw.
# 正解
> mail.ksu.edu.tw
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: mail.ksu.edu.tw
Address: 120.114.100.20
纪录 : 下一篇学习 鸟哥的 Linux 私房菜 -- DNS Server - 从 dig 指令开始
>>: [今晚我想来点 Express 佐 MVC 分层架构] DAY 30 - 是结束,也是开始
在上一篇中介绍了如何透过 router 传递参数,也介绍了怎麽建立嵌套的 route 等等,在本篇中...
在 Day 21 显示 Google Translate 网页翻译内容时,画面呈现的作法是很单纯的新...
在[day 7]使用form tag 来进行submit的时候,不知道大家心里会不会有个疑问? 我要...
今日练习档 ԅ( ¯་། ¯ԅ) 今天要与大家介绍Excel的if判断式,并且在其中也有运用到AND...
Junior engineer(初级工程师) 开发项目一段时间後,会开始慢慢发现, 上头交代的任务...