How to evaluating a software engineer computer network knowledge and network programming skills? Finishing incidental personal papers.

First, network programming Course Summary section

First, from the whole user mode, kernel mode and the corresponding relationship between the client and server interaction (including the corresponding protocol layer),

img

 

Second, make the following summary of the courses in the order:

 

1.Socket

The core part of the curriculum in order to expand the actual Socket programming, you can view specific sections: the Java Socket programming SocketAPI relationship of operating systems and exploration.

img

Socket communication process can be described as:

1. The server socket is bound port, and has been listening to the port, waiting for client connections

2. The client bind a port and waiting for service over a socket connection to the server-side port

3. After successful connection, the server and client to communicate through the established connection

4. One end closed and the other end to capture the end of the abnormal traffic.

Socket Summary:

From the socket level, it is located in the application layer, it is the operating system API provides application programmers through which applications can access the transport layer protocol.

Socket features:

1.socket located above the transport layer protocol, the differences between the shield network protocols

2.socket entrance is network programming, it provides a number of system calls, constitute the main network program

3. In the Linux system, a portion of the socket belonging to the file system, the communication network can be seen as the reading of the file, so that we control and control of the network as easy to file.

Socket system call on the Linux kernel source code to explore the job reference: in-depth analysis and Socket system call .

 

2.TCP agreement

In focusing on the transport layer TCP protocol to explore, through building the Linux kernel networking code debugging environment MenuOS system, and after a three-way handshake to send and receive data behind Linux has been focused on exploration, specifically refer to: in-depth understanding of the TCP protocol and its source code.

 

 

img

Three-way handshake described in detail

First of all server-side calls socket () to create a server-side socket calls after bind () bind to create a socket is the socket file descriptor get, after calling acppet () blocking yourself waiting for client connections.

客户端同样调用socket()创建客户端的套接字,之后调用connect()去连接服务器【根据服务器端的套接字锁定服务器】,此时TCP报文段中SYN=1,seq为一随机数字x,且客户端的连接状态置为SYS_SEND。

服务器端的accept()的阻塞收到该报文段之后被打断,置连接状态为SYN_RECV,并发送TCP报文段,SYN=1,ACK=1,seq为随机数字y,ack=x+1。

客户端收到该报文段后置状态为ESTABLISED,ACK=1,seq=x+1,ack=y+1。

服务器端接收到后置自己状态为ESTABLISED。此时三次握手已经结束。

之后便可调用read与write实现客户端与服务器端的通信。

关于源码部分的探究参考链接:TCP源码探究。

环境搭建参考作业:Linux内核代码调试环境搭建

 

3.IP层

网络层的主要任务:

1.进行路由处理,即选择下一跳

2.完成IP与MAC地址映射

其中关于路由转发部分

路由表的转发过程:

img

 

ARP解析

ARP是根据IP地址获取物理地址的一个TCP/IP协议。 每个在运行的时候,都会有个arp表,在这个表里面有IP地址和mac地址的对应关系。在网络底层数据交换过程中,每一个终端都会有一个固定的mac地址,这个地址是全世界唯一的,出厂的时候就固化到硬件里面了。网络访问的时候实际上是通过这个唯一的地址来确定数据包的流向的。所以,任何一次数据传输,都需要先访问arp表,从而获得对应的mac地址,才知道传输的对象在哪里。

img

 

4.二层交换网络

课程讲授了关于以太网的一些基础知识,其中重点讲述了交换机的工作原理。

交换机实质就是一个多端口的网桥,具备学习能力与转发能力,那么到底是如何实现的呢?

其工作原理如下:

工作总体流程如下:

  1. 从某个端口收到的二层报文,解析二层报文的源MAC和目的MAC

  2. 根据源MAC学习形成MAC表

  3. 根据目的MAC,将该报文转发到出端口,从而保证最终目的设备能收到这个报文。

 

5.DNS

个人理解:DNS就是IP地址不好记,把IP地址与一个好记忆的东西对应(即域名),之后访问通过好记忆的访问。

具体DNS解析过程参考:DNS解析过程

最后对网络安全以及互联网的架构设计进行了简要的介绍。

 

部分知识老师课上只是启发性的传授,若想更好的理解网络协议以及网络编程整个过程,还是需要自己再多下点功夫吧!

 

 

 

 

 

 

 

 

 

二、网络程序设计试卷部分:

一、单选题

1.()完成域名到 IP 地址的映射

A、DNS B、ARP C、RARP D、ICMP

参考答案:A

解析:

概念题,DNS就是IP地址不好记,把IP地址与一个好记忆的东西对应(即域名),之后访问通过好记忆的访问。

来源:个人出题

 

2.网络管理员配置公司网关路由器时,为了减少路由记录需要把多部门的网络地址进行汇聚,166.100.32.0/22可以汇聚的网段有( )

A、166.100.35.0/24 B、166.100.36.0/24 C、166.100.37.0/24 D、166.100.38.0/24

参考答案:A

解析:

考察CIDR聚合。

需要前22位相同,选项前16位均相同,再比较后6位即可

题目:32:001000//00

A:35:001000//11,匹配

B:36:001001//00,不匹配

C:37:001001//01,不匹配

D:38 :001001//10,不匹配

来源:个人出题

 

3.在实现基于TCP的网络应用程序时,服务器端正确的处理流程是( C )

[A] socket() -> bind() -> listen() -> connect() -> read()/write() -> close()

[B] socket() -> bind() -> listen() -> read()/write() -> close()

[C] socket() -> bind() -> listen() -> accept() -> read()/write() -> close()

[D] socket() -> connect() -> read()/write() -> close()

参考答案:C

解析:见上知识点总结Socket部分。

来源:https://wenku.baidu.com/view/a5a64a9accbff121dd3683ba.html

 

4.在学校局域网上ping https://www.ustc.edu.cn/ 没有涉及到的网络协议是?()

A、TCP B、DNS C、ICMP D、ARP

参考答案:A

解析:首先我们需要dns协议,将网址转为IP地址,其次ping的原理是使用ICMP的回响机制,所以必然用到了网络层的ICMP协议,最后在到达对方局域网的时候需要使用RARP查找mac地址,在发送主机不知道自己IP的时候也会用到ARP协议,所以综上ping的过程中用到了 dns协议、ICMP协议、ARP协议、RARP协议。

来源:个人改编

 

5.网络层通过什么来查询路径?()

A、路由表 B、ARP表 C、MAC地址表 D、网桥表

参考答案:A

解析:考察路由器工作原理。路由器在网络层是一个极其重要的设备,每台路由器都由一张转发表。路由器检查到达分组首部中的一个字段的值,然后利用该值在路由器的转发表中进行查询,以决定该如何转发该分组。查询的结果是分组将被转发的路由器的链路接口。路由表可以用netstat -r 或route查看

其他的选项:

MAC表 记录着MAC地址与交换机接口的对应关系, ARP表 ip地址与mac地址的映射 。

来源:个人出题

 

6.下列哪种说法是正确的()

A、集线器可以对接收到的信号进行放大

B、集线器具有信息过滤功能

C、集线器具有路径检测功能

D、集线器具有交换功能

参考答案:A

解析:考察HUB的工作原理。HUB在网络中只起到 信号放大 和重发作用,其目的是扩大网络的传输范围,而不具备信号的定向传送能力。

来源:根据牛客网个人改编

 

7.存在以下三个CIDR地址块192.168.11.0/27、192.168.11.32/27和192.168.11.64/26聚合后的CIDR地址块应是( )

A、192.168.11.0/25

B、192.168.11.0/26

C、192.168.11.64/25

D、192.168.11.64/26

参考答案:A

解析:

考察CIDR聚合。存在3个CIDR地址块:192.168.11.0/27, 192.168.11.32/27, 192.168.11.64/26,聚合过程为:① 2个/27地址块之间进行聚合: 192.168.11.0 转化为2进制 11000000.10101000.00001011.00000000; 192.168.11.32转2进制 11000000.10101000.00001011.00100000; 共同前缀是前26位,即11000000.10101000.00001011.00,则聚合的CIDR地址块是192.168.11.0/26。 ② 将结果再与/26地址块之间进行聚合: 192.168.11.0转2进制11000000.10101000.00001011.00000000; 192.168.11.64转2进制11000000.10101000.00001011.01000000; 共同前缀是前25位,则最终的聚合CIDR地址块是192.168.11.0/25。

 来源:360公司笔试题

 

二、简答题【无解析         来源:实验部分与PPT

 

1.简述TCP的三次握手过程【结合Socket说明更好】

首先服务器端调用socket()创建服务器端的套接字之后调用bind()绑定创建socket是所拿到的socket文件描述符,之后调用acppet()阻塞自己等待客户端的连接。

客户端同样调用socket()创建客户端的套接字,之后调用connect()去连接服务器【根据服务器端的套接字锁定服务器】,此时TCP报文段中SYN=1,seq为一随机数字x。

服务器端的accept()的阻塞收到该报文段之后被打断,并发送TCP报文段,SYN=1,ACK=1,seq为随机数字y,ack=x+1。

客户端收到该报文段后置状态为ESTABLISED,ACK=1,seq=x+1,ack=y+1。

服务器端接收到后置自己状态为ESTABLISED。此时三次握手已经结束。

 

2.简述ARP的工作流程?

参考答案:首先主机A根据路由表找到IP地址,然后在自己的本地ARP缓存中检查主机B的匹配MAC地址。

如果主机A在ARP缓存中没有找到映射,将ARP请求帧【请求帧中的请求的MAC地址为IP地址对应的MAC地址】广播到本地网络上的所有主机。源主机A的IP地址和MAC地址都包括在ARP请求中。本地网络上的每台主机都接收到ARP请求并且检查是否与自己的IP地址匹配。

若主机B收到,发现匹配,则主机B将包含其MAC地址的ARP回复消息直接发送回主机A。

当主机A收到从主机B发来的ARP回复消息时,会用主机B的IP和MAC地址映射更新ARP缓存。这样即建立了新的IP与MAC的映射。

 

3.简述交换机是如何"学习"及工作的?

1. When it receives a frame, first check the source MAC address, the address to see a table of their own maintenance there is no such address. If so, then 2; if not, then the MAC address, enter the port, enter the time in that table [such switch will "learn" to the new forwarding MAC address]; 2. Check the destination MAC address, and then to the table to find if there is a match, then it is forwarded based on port number table entry; if not, then forwarded to all other ports except imports.

 

4. [DESCRIPTION Socket communication process only the server or client may be explained]

Service-Terminal:

1: load the socket library, creates a socket (socket ());

2: bind the socket to an IP address and a port (the bind ());

3: set socket for a connect request (the listen ()) for the monitoring mode;

4: After the request arrives, receives a connection request, returns a new socket connection corresponding to the (Accept ());

5: communication (send () / recv ()) returns a socket and a client;

6: return, wait for another connection request;

7: Close the socket, close-loaded socket library (closesocket ()).

Client:

1: load the socket library, creates a socket (socket ());

2: a connection request (Connect ()) to the server;

3: the server side communication (send () / recv ());

4: close the socket, close-loaded socket library (closesocket ()).

Guess you like

Origin www.cnblogs.com/tlxclmm/p/12173676.html