Skip to content

weiyanhua100/containerdns-c

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chinese

ContainerDNS-C

Introduction

ContainerDNS-C is a high-performance DNS Server based on DPDK. Do not rely on the database, the user updates the data through the RESTful API.

How to use

1. Compilation

Required OS release: Centos-7.2 or Centos-7.4. Make all for the first time, after that make kdns if you just change the DNS code.

tar -xf kdns.tar.gz
cd kdns
make all

2. Startup

The default configuration path for ContainerDNS-C is /etc/kdns/kdns.cfg. An example for kdns.cfg as follows :

EAL configuration reference DPDK document.

[EAL]
cores = 1,3,5,7
memory = 1024,1024
mem-channels = 4
 
[NETDEV]
name-prefix = kdns
mode = rss
mbuf-num = 50000
kni-mbuf-num = 10000
rxqueue-len = 1024
txqueue-len = 2048
    
rxqueue-num = 4
txqueue-num = 5

kni-ipv4 = 2.2.2.240
kni-vip = 10.17.9.100

[COMMON]

log-file = /export/log/kdns/kdns.log
fwd-def-addrs = 114.114.114.114:53,8.8.8.8:53
fwd-thread-num = 4
web-port = 5500
ssl-enable = no
cert-pem-file = /etc/kdns/server1.pem
key-pem-file = /etc/kdns/server1-key.pem
zones = tst.local,example.com

Reserve huge pages memory:

mkdir -p /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
echo 4096 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages

Load igb_uio module:

modprobe uio
insmod ./bin/igb_uio.ko
./bin/dpdk-devbind.py --bind=igb_uio kdns

Load rte_kni module:

insmod ./bin/rte_kni.ko

Start kdns:

./bin/kdns 

API

1. Add domain datas

curl -H "Content-Type:application/json;charset=UTF-8" -X POST -d '{"type":"A","zoneName":"example.com","domainName":"chen.example.com","host":"192.168.2.2"}'  'http://127.0.0.1:5500/kdns/domain' 

curl -H "Content-Type:application/json;charset=UTF-8" -X POST -d '{"type":"CNAME","zoneName":"example.com","domainName":"chen.cname.example.com","host":"chen.example.com"}' 'http://127.0.0.1:5500/kdns/domain' 

curl -H "Content-Type:application/json;charset=UTF-8" -X POST -d '{"type":"SRV","zoneName":"example.com","domainName":"_srvtcp._tcp.example.com","host":"chen.example.com","priority":20,"weight":50,"port":8800}'  'http://127.0.0.1:5500/kdns/domain'

2. query domain datas

curl -H "Content-Type:application/json;charset=UTF-8" -X GET   'http://127.0.0.1:5500/kdns/perdomain/chen.example.com' 
curl -H "Content-Type:application/json;charset=UTF-8" -X GET   'http://127.0.0.1:5500/kdns/domain' 

3. statistics api

curl -H "Content-Type:application/json;charset=UTF-8" -X GET   'http://127.0.0.1:5500/kdns/statistics/get'

Performance

CPU model: Intel(R) Xeon(R) CPU E5-2698 v4 @ 2.20GHz

NIC model: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection

Jmeter version: apache-jmeter-3.1

Test sample: single domain --- kubernetes.default.svc.skydns.local(10.0.0.1) 50,000 domains --- random domain name with suffix skydns.local. Among them, 30,000 with one IP, 10,000 with two IPs, and 10,000 with 3-10 IPs (random).

performance data:

performance

About

A high-performance DNS Server based on DPDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 94.3%
  • Makefile 2.3%
  • C++ 2.1%
  • Python 0.6%
  • Shell 0.3%
  • Objective-C 0.3%
  • Other 0.1%