没有合适的资源?快使用搜索试试~ 我知道了~
Based on the programming practice of previous experimental classes, complete a prototype of DNS system based on Linux command line terminal (including client and server).
资源推荐
资源详情
资源评论
1. Overview
1.1 Experiment targets
▪ Learn the relevant knowledge of DNS (Domain Name System) protocol.
▪ Based on the programming practice of previous experimental classes, complete a
prototype of DNS system based on Linux command line terminal (including client and
server).
▪ Complete the implementation of English domain name resolution.
1.2 Experiment requirements
Basic requirements:
▪ Implement English domain name resolution like: www.bupt.edu.cn.com;
Example database records:
www.bupt.edu.cn, 86400, IN, A, 192.168.1.25
bupt.edu.cn, 86400, IN, MX, mx.bupt.edu.cn
mx.bupt.edu.cn, 86400, IN, A, 192.168.1.37
▪ Support at least 4 top-level domains, at least three - level domain name resolution. The
program needs to implement entities: client, at least 6 DNS servers (including local DNS
server).
4 top-level domains:.cn,.org,.com, and.us
secondary and tertiary domains: custom (e.g. Edu.cn, bupt.edu.cn, etc.)
The deployment architecture of DNS server can be seen in the following example:
Figure.1-1
▪ Supported Resource Record types: A, MX, CNAME; For MX type queries, ask for the
corresponding IP address in the Additional Section.
▪ Supported parsing methods like iterative parsing.
▪ Transport layer protocol:
Between client and local DNS server: TCP.
Between DNS server: UDP.
▪ Application layer protocol: DNS:
Require all DNS messages used in the communication process must be correctly
resolved with Wireshark.
▪ Server data maintenance method can use files.
▪ Write a complete design document, refer to Sample-Project-Report.doc.
▪ The program should include detailed code comments in a good programming style.
▪ The program runs stably and supports error handling, such as invalid command, missing
parameter, parameter error, query failure, etc.
Extension requirements:
▪ Support for Resource Record of type PTR.
▪ Support cache.
▪ Print the trace of the query (query path, server response time).
2. Requirements Analysis
2.1 Experiment Environment
In one virtual machine, clients and individual DNS servers use different IP addresses, and
each server USES port 53 to provide its services.
1) available IP address: 127.x.y.z (X and Y value range [0, 255], Z value range [1,254])
2) An example of an iterative query environment:
Figure.2-1
▪ C language and related function libraries.
▪ GCC compiler, GDB debugging tool, Wireshark capture package analysis tool.
▪ Linux operating system, nslookup command and help under Linux.
2.2 Experiment Methods
The hierarchical structure:
Figure.2-2
▪ Analyze the working principle of DNS protocol by using Wireshark packet capturing
tool.
▪ Analyze the demand, propose the solution and divide the functional modules.
▪ Implement the socket program framework based on UDP and TCP, and realize the
domain name resolution service in English.
3. Preliminary Design
3.1 Decomposition of functional modules
The basic running process is set as follows:
1. the client receives the message and compiles it and sends it to the local DNS server.
2. local DNS server will receive and analysis the query, checking its cache or do iteration
and recursion query by sending message into next level server.
3. The subordinate DS server will compare the message with the memory and reply different
corresponding messages according to the result.
4. Upon waiting the response, local DNS server will analysis and refresh its cache. If found,
local DNS server will terminate the loop and send the final result to the client, otherwise
the loop continues.
5. The client receives the message and tells the user if it has been found.
Therefore, according to the process, we set the file as follows:
Figure.3-1
I'll explain each of these C files in turn.
Figure.3-2
3.1.1 Client. c
Client is used to get search command from user and answer final response.
The basic theory process of client is set as follows:
1. Process user’s command.
User can search by typing running command and adding the domain name and searching
type like ‘sudo ./client.o www.baidu.com A ’. What’s more, users can also input domain
names and types for multiple domain name type queries.
2. Construct a header based on user input.
A random allocated transaction ID will be given first. Then the query number will be
given followed by answer number, authority number and additional number all set to 0 in
header part.
3. Construct content based on user input.
According to the number of domain name, client will generate its query parts. By using
function to split each domain name by dot and then replacing each dot into sub domain’s
length. For example,’www.baidu.com’ will become ‘3www5baidu3com0’. The query
type is then added after this process.
4. Sending the packet and waiting.
剩余75页未读,继续阅读
资源评论
qq_43172653
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功