《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)


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

少年沛

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值