Skip to content

mayuehit/CustomDNSServer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

DNS 64 binary

Use

Start SimpleDNS 64:

# 前台運行
$./main
# 後台運行
$nohup ./main 2>&1 >dns64.log &
Listening on port 5353.
$ dig @127.0.0.1 -p 5353 www.google.com AAAA

Install

# Ubuntu
apt install sqlite3
apt install libsqlite3-dev
# Centos
yum install sqlite
yum install sqlite-devel
---
sqlite3 database.sqlite
CREATE TABLE ARecords(domain_name text,ip1 integer,ip2 integer,ip3 integer,ip4 integer);
CREATE TABLE AAAARecords(domain_name text,ip1 integer,ip2 integer,ip3 integer,ip4 integer,ip5 integer,ip6 integer,ip7 integer,ip8 integer,ip9 integer,ip10 integer,ip11 integer,ip12 integer,ip13 integer,ip14 integer,ip15 integer,ip16 integer);
.tables
gcc -o main main.c -lsqlite3

ipv4->ipv6

237
284
378
418
1147

Performance testing

# test.sh
# !/bin/bash
num=$1
for((i=num;i<=num+100;i++))
do
dig @127.0.0.1 -p 53533 www.google.com$i AAAA &
done

$ bash -x test.sh 1

本项目使用单线程处理udp请求,recvfrom一次处理一个请求,如果udp请求过多,可能会导致缓冲区满,导致后面的请求失效。

1、开启两个窗口 分别执行 bash -x test.sh 100;bash -x test.sh 200 服务端产生了段错误 2、开启一个窗口 执行 bash -x test.sh 300 很多请求发生超时

About

Making a caching DNS server purely on C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 100.0%