Giter Site home page Giter Site logo

rampagex / dnsmasq-chinadns Goto Github PK

View Code? Open in Web Editor NEW

This project forked from styxyang/dnsmasq-chinadns

0.0 1.0 0.0 2.53 MB

A patched version of dnsmasq which filters out some suspicious IP

License: GNU General Public License v2.0

Makefile 0.68% Python 0.55% Shell 1.37% CSS 0.07% Perl 3.13% Roff 0.19% C 92.37% HTML 1.64%

dnsmasq-chinadns's Introduction

dnsmasq-chinadns

A patched version of dnsmasq which filters out some suspicious IP

Install

  • Linux / OS X

      git clone https://github.com/styx-hy/dnsmasq-chinadns.git
      cd dnsmasq-chinadns.git
      # Edit Makefile to change install PREFIX.
      make
    

    I suggest you use the system default settings for dnsmasq.

    For example, on Debian GNU/Linux, simply change DAEMON variable in /etc/init.d/dnsmasq to the /path/of/dnsmasq-chinadns/src/dnsmasq. Then use command sudo service dnsmasq restart to restart the service. Other distributions may have similar configurations.

Configuration

Here's a simple configuration to use, you can save it as /etc/dnsmasq.conf.

# File containing name server list.
resolv-file=/etc/dnsmasq.resolv.conf

# Listen the following address, repeat to specify more.
listen-address=127.0.0.1

# File listing spurious IP.
spurious-ip-file=/etc/spurious_ips.conf
# Or specify IP address one by one.
#spurious-ip = 64.33.99.47
#spurious-ip = 4.36.66.178

# Important for CDN to work correctly.
strict-order

cache-size=512

Without explicitly specifing spurious-ip or spurious-ip-file, the filter function will not be enabled.

Example files:

Usage

After you have correctly configure your dnsmasq as your DNS cache server, you can test it with command

› nslookup www.youtube.com
Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
www.youtube.com canonical name = youtube-ui.l.google.com.
youtube-ui.l.google.com canonical name = youtube-ui-china.l.google.com.
Name:   youtube-ui-china.l.google.com
Address: 74.125.31.139
Name:   youtube-ui-china.l.google.com
Address: 74.125.31.138
Name:   youtube-ui-china.l.google.com
Address: 74.125.31.101
Name:   youtube-ui-china.l.google.com
Address: 74.125.31.100
Name:   youtube-ui-china.l.google.com
Address: 74.125.31.102
Name:   youtube-ui-china.l.google.com
Address: 74.125.31.113

To examine the query process (use Debian as the example), uncommnent log-queries in /etc/dnsmasq.conf and watch syslog with command:

sudo tail -f /var/log/syslog

Or manually start dnsmasq with the following options:

sudo dnsmasq -q -d

and you may observe logs like

using nameserver 8.8.8.8#53
using nameserver 114.114.114.114#53
read /etc/hosts - 7 addresses
query[A] www.youtube.com from 127.0.0.1
forwarded www.youtube.com to 8.8.8.8
forwarded www.youtube.com to 114.114.114.114
reply www.youtube.com is <CNAME>
reply youtube-ui.l.google.com is <CNAME>
possible DNS-rebind attack detected: youtube-ui-china.l.google.com
possible DNS-rebind attack detected: www.youtube.com
possible DNS-rebind attack detected: www.youtube.com
reply www.youtube.com is <CNAME>
reply youtube-ui.l.google.com is <CNAME>
reply youtube-ui-china.l.google.com is 173.194.72.100
reply youtube-ui-china.l.google.com is 173.194.72.101
reply youtube-ui-china.l.google.com is 173.194.72.139
reply youtube-ui-china.l.google.com is 173.194.72.102
reply youtube-ui-china.l.google.com is 173.194.72.138
reply youtube-ui-china.l.google.com is 173.194.72.113

dnsmasq-chinadns's People

Contributors

aa65535 avatar andy-padavan avatar brad0 avatar curvedmark avatar cyfdecyf avatar danners avatar dedeckeh avatar falconindy avatar giact avatar iamben avatar jglick avatar kanjimonster avatar karlvogel avatar ldir-edb0 avatar mandree avatar matthewjohn avatar mestery avatar mwarning avatar nerdling avatar rasky avatar rgenoud avatar rsmarples avatar rudis avatar simonkelley avatar styxyang avatar themiron avatar thozza avatar vdorst avatar yousong avatar zx2c4 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.