OSI Case Detailed

Case, Taobao to buy things

Application layer DNS, HTTP, HTTPS

1. We enter https://www.taobao.com URL in your browser, then press Return

2. The browser does not know the specific location https://www.taobao.com this URL, it will go as a DNS address book to find agreement, Taobao eventually return the IP address of the server, if is 122.123.34.21

3. The browser knows the destination address, it will start packing its request, for the average browser requests, often using the HTTP protocol, but more important for privacy requests shopping, select the HTTPS encryption protocol, to add data on the HTTP header

4. The request data package, and then the next layer to the transport layer

Transport Layer

Between the application layer and transport layer, a layer of abstracted layers socket, the socket layer corresponds to a transport layer encapsulates bit, the tcp / ip layer is a complex operation into several simple abstract interface to the application layer.

1. Data enters the transport layer, the transport layer protocol there are two, one is no protocol TCP connections and UDP connection-oriented protocol, because TCP is a reliable protocol, TCP protocol is selected, there are two ports TCP protocol, a own browser port, there is a port Taobao application, then add the data to the TCP header

2. The encapsulation layer data transmission is completed, the next layer to the network layer

Network layer

1. Network layer protocol is IP protocol, IP protocol in the IP browser and IP servers Taobao

2. IP header plus the data, the data link layer to the next layer

data link layer

1. Now that you know the destination IP address, you will be thinking about how to find the target machine, judging by IP address, that this machine is LAN or outside the network, if it is outside the network, they would ask the router gateway.

2. The default gateway IP address is 192.168.1.1, broadcast in the LAN mode whom is 192.168.1.1, the gateway will answer him, and told him gateway's MAC address (MAC address by looking for that IP ARP process protocol, ARP)

3. Now that the gateway's MAC address, the MAC header plus the data gave, then you can give up the physical layer transmission

Physical Layer

transfer data

Transfer process

1. The data finally set off from the computer, first of all it has been a switch, switch, switch data you going to ask it, the data answer, find a gateway MAC address, switch know, tell him how to go

2.找到了网关,网关一般是路由器,路由器问数据你去哪呀,数据拿出了淘宝的IP,说,你看,我要去这里,路由器回答说哦,去这里,先去路由器B吧,他会告诉你接下来怎么走的(路由器之间也经常沟通,知道怎么走,这种沟通就是路由协议,有OSPF开放式最短路径优先和BGP边界网关协议)

3.最后终于到了最后一个路由器,路由器就会向某一个网络广播,数据找到交换机问,谁是淘宝服务器,淘宝服务器收到后,回复一个带MAC地址的数据,最后成功找到了淘宝服务器

4.目标服务器发现MAC地址对上了,就脱下MAC头,IP也对上了,脱下了IP头,然后就是TCP头了,把数据交给传输层,由于是TCP协议,每收到一个数据都会告诉发送者,我收到了,不然的话,发送者会一直发送没有响应的数据的。最后根据端口号,把数据交给监听这个端口的进程。

5.终于到达了进程,这时候就剩下一层HTTP头了,通过解析淘宝进程知道发送者要买东西了,于是操作数据库等,最后返回一个响应。

6.最后,发送者的浏览器,弹出了购买成功,他开心的流出了眼泪!

自己学习总结,来自极客学院

Guess you like

Origin www.cnblogs.com/zx125/p/11680314.html