《Linux 高性能服务器编程》第1章学习笔记

《Linux 高性能服务器编程》第1章学习笔记,第1张

《Linux 高性能服务器编程》第1章学习笔记 《Linux 高性能服务器编程》第1章学习笔记 第一章:TPC/IP 协议族 以太网帧封装

目的物理地址: 源物理地址 :类型: 数据 : CRC
------6-----------------6---------------2—46~1500-----4–

类型:
0x800表示ip协议
0x806表示ARP协议
0x835表示RARP协议

ARP协议工作原理 使用tcpdump观察ARP通信过程(bug调试)
sudo arp -d 192.168.1.118
sudo arp -s 192.168.1.118 
sudo arp -d 192.168.1.108
sudo tcpdump -i wlo1 -ent '(dst 192.168.1.108 and src 192.168.1.118)or (dst 192.168.1.118 and src 192.168.108)'

telnet 192.168.1.108 
Trying 192.168.1.108...
Connected to 192.168.1.108.
Escape character is '^]'.
Ubuntu 18.04.6 LTS
Ubuntu login: 
telnet> quit
Connection closed.

反馈:

74:d8:3e:77:95:de > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Request who-has 192.168.1.108 tell 192.168.1.118, length 28
74:d8:3e:77:95:de > 84:ef:18:cc:ae:6b, ethertype ARP (0x0806), length 42: Reply 192.168.1.118 is-at 74:d8:3e:77:95:de, length 28
DNS工作原理 linux下访问DNS服务

Linux使用/etc/resolv.conf文件来存放DNS服务器的IP地址。
可以通过cat查询存放的DNS服务器信息

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 "systemd-resolve --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 scut.edu.cn
使用tcpdump观察DNS通信过程
sudo tcpdump -i wlo1 -nt -s 500 port domain
host -t A www.baidu.com
-----------------------------------------
IP 192.168.1.118.55485 > 192.168.1.1.53: 29928+ [1au] A? www.a.shifen.com. (45)
IP 192.168.1.1.53 > 192.168.1.118.55485: 29928 2/0/1 A 182.61.200.7, A 182.61.200.6 (77)


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/3990479.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-10-21
下一篇 2022-10-21

发表评论

登录后才能评论

评论列表(0条)

保存