CCNP必备: Linux网络及0SI7层模型深入讲解
Internet
1、Intemet Protoce (IP)
假设有一个应用程序在这台电脑上,它想访问这台电脑上的另一个应用程序,然后到运用层再到传输层。
原IP地址,目标IP地址。数据电路层
让ARP来找到MAC
ARP广播找到3.2
到达目标
处理ARP请求
会填入表格
回应(单播)
在自己的ARP表里把对方电脑的IP地址和MAC地址的对应关系填到一个表里
填入SYN
处理每一层的信息
响应之后
三次握手结束
考虑发数据
最终数据
2、Intemet Control Message Protocol (ICMP )
用来实现pin命令
可以用来判断网络状态(根据不同的网络状态会返回不同的信息)
ICMP数据包大小默认64字节
PING 172.20.0.1 (172.20.0.1) 56(84) bytes of data.
64 bytes from 172.20.0.1: icmp seq=1 tt1=64 time=3.20 ms 64 bytes from 172.20.0.1: icmp seq=2 tt1=64 time=0.547 ms
64 bytes from 172.20.0.1: icmp seq=3 tt1=64 time0.390 ms
172.20.0.1 ping stati stics
3 packets tr ansmitted, 3 received, 0% packet loss, time 2002ms rtt min/avg/max/mdev = 0.390/1.381/3.208/1.293 ms
[root@centos7 ~]#ping 172.20.0.12
PING 172.20.0.12 (172.20.0.12) 56(84) bytes of data .
From 172.20.102.77 icmp seq=1 Destination HostUnreachable
From 172.20.102.77 icmp seq=2 Destination Host Unreachab le
From 172. 20.102.77 icmp seq=3 Destination Host Unreachab 1e
From 172. 20.102.77 icmp seq=4 Destination Host Unreachab le
From 172. 20.102.77 icmp seq=5 Destination Host Unreachab le
From 172. 20.102.77 icmp seq=6 Destination Host Unreachab le
From 172. 20.102.77 icmp seq=7 Destination Host Unreachab le
From 172.20.102.77 icmp_ seq=8 Destination Host Unreachabl
172.20.0.12 ping statistics
9 packets transmitted, 0 received, +8 errors, 100% packet loss, ti me 8003ms pipe 4
[root@centos7 ~]#ping 172.20.0.12 -s 65508
Error: packet size 65508 is too large. Maximum is 65507
[root@centos7 ~] #pir 172.20.0.12 -s 65507
PING 172.20.0.12 (172.20.0.12) 65507(65535) bytes of data.
172.20.0.12 ping statistics
4 packets transmitted, 0 received, 100% packet loss, ti me 3000ms
[root@centos7 ~]#ping 192.168.30.128 -S 65507
PING 192.168.30.128 (192.168.30.128) 65507(65535) bytes of data.
65515 bytes from 192.168.30.128: icmp seq=1 tt1=64 time=4.48 ms
65515 bytes from 192.168. 30.128: icmp_ seq=2 tt1=64 time=1.19 ms
65515 bytes from 192.168. 30.128: icmp_ seq=3 tt1=64 time=1.08 ms
192.168.30.128 ping statistics ---
3 packets transmitted, 3 received , 0% packet loss, time 2004ms rtt min/avg/max/mdev = 1. 083/2.25214.482/1.577 ms
[root@centos7 ~]#ping 192.168. 30.128
PING 192.168. 30.128 (192.168. 30.128) 56(84) bytes of data .64 bytes from 192.168. 30.128: icmp_ seq=1 tt]=64 time=2.81 ms
64 bytes from 192.168. 30.128: icmp seq=2 tt]=64 time=0.585
ms
64 bytes from 192.168. 30.128: icmp_ seq=3 tt 1=64 ti me=0.217ms
64 bytes from 192.168. 30.128: icmp_ seq=4 tt1=64 time=0. 335ms
64 bytesfrom 192.168. 30.128: icmp_ seq=5 tt1=64 time=0.340 s
64 bytesfrom 192.168. 30.128: icmp_ seq=6 tt1=64 time=0. 302ms
64 bytes from 192.168. 30.128: icmp_ seq=7 tt1=64 time0.260 ms
64 bytes from 192.168.30.128: icmp_ seq=8 tt1=64 time0.260 ms
192.168.30.128 ping statistics ---
8 packets tr ansmitted, 8received 0% packet loss, time 7007 ms rtt mi n/avg/max/mdev = 0.217 /0.639/2.814/0.828 ms
[root@centos7 ~]#ping 192.168.30.128 -s 65507
PING 192.168.30.128 (192.168.30.128) 65507(65535) bytes of data .
65515 bytes from 192.168.30.128: icmp seq=1 tt]=64 time=1.68 ms
65515 bytes from 192.168. 30.128: icmp_ seq=2 tt1=64 time1.39 ms
65515bytes from 192.168.30.128: icmp_ seq=3 tt1=64 ti me=1.50 ms
65515 bytes from 192.168.30.128: icmp_ seq=4 tt1=64 time=1.44 ms
65515 bytes from 197.168.30.128: icmp_ seq=5 tt 1=64 time=1.48 ms
65515 bytes from 192.168.30.128: icmp seq=6 tt]=64 time=1.46 ms
65515 bytes from 192.168. 30.128: icmp_ seq=7 tt1=64 time=1.39 ms
65515bytes from 192.168. 30.128: icmp_ seq=8 tt]=64 time=1. 47 ms
65515 bytes from 192.168. 30.128: icmp_ seq=9 tt1=64 time=1. 88 ms
65515 bytes from 192.168. 30.128: icmp_ seq=10 tt]=64 time=1. 38ms
65515 bytes from 192.168. 30.128: icmp_ seq=11 tt1=64 time=1. 34ms
nC
192.168.30.128 ping statistics
11 packets transmitted, 11 received 0% packet loss, time 10019ms rtt min/avg/max/mdev = 1. 346/1 496/1. 882/0.154ms
3、Address Resolut on Protocol (ARP)
地址解析协议
把IP地址映射成Ethernet地址
如何寻找IP地址
[ root@centos7 ~]#arp -n
Address HWtype HWaddress Flags MaskC
192.168.30.1 ether 00:50:56:c0:00:01 C
192.168.30.254 ether 00:50:56:f6:f5:40 C
172.20.0.1 ether 08:57:00:f0:aa:d7 C
172. 20.109.98 ether 00:0c:29:13:bb:9e C
192.168.30.128 ether 0:0c:29:e1:f7:aa C
172.20.0.12 ether (incomplete)
Flags MaskC
C
Iface ens33 ;ens33ens37ens37ens33ens37
演示
4、Reverse Address Resolution Protocol (RARP)
无盘工作站(电脑上由CPU内存没有硬盘),没办法装系统,需要向网络中发送请求(请给我一个IP 地址),由MAC转换为IP。得到的地址是固定的。