Skip to content
TheE edited this page Apr 9, 2017 · 5 revisions

Local Setup

Local mode enables DNS-unblocking on a single device which can't handle SNI but only uses a single IP address and without using another server on the network.

Begin by cloning the repo: git clone https://github.com/jamiees2/dnsproxy.git.

Setting up config.json

Make sure that you have created config.json and it is correct. There is a sample, config-sample.json, which you can base your configuration on. Importantly, make sure public_ip, base_ip, and base_port are all correct. See here for more information: https://github.com/jamiees2/dnsproxy/wiki/Config.json

  • base_ip is the first local IP to use, and then it will incrementally use the next IP address.
  • base_port is the first port to use, after which it will use the next port incrementally.

Make sure to sync config.json across all the servers/devices, as these commands are intended to be run on different servers/devices.

Note: Instead of running multiple dnsproxy.py commands on different servers, you can instead run python dnsproxy.py -m local anywhere and copy the configuration files between the servers/devices.

Setting up HAproxy:

First, provision a server from any VPS provider, but make sure it is located in the country you would like your location to be. A 128 MB VPS is enough. Run these commands on that server.

Run the generator: python dnsproxy.py -o haproxy --dnat The generator will create the file output/haproxy.conf

Install HAproxy. On Ubuntu you can do the following (as root):

apt-get update -qq && apt-get install -y software-properties-common
add-apt-repository -y ppa:vbernat/haproxy-1.5
apt-get update -qq && apt-get install -y haproxy

Copy output/haproxy.conf to /etc/haproxy.cfg.

Restart HAproxy. sudo service haproxy restart.

Setting up the hosts file

Generate the hosts file with python dnsproxy.py -o hosts --dnat. Append the contents of output/hosts-haproxy.txt to /etc/hosts or to %SystemRoot%\system32\drivers\etc\hosts, depending if your local computer is Linux or Windows.

To reset: Clean out appended entries of the hosts file. On Linux you can run sudo sed -i '/### GENERATED/d' /etc/hosts

Setting up netsh (Windows)

Generate with python dnsproxy.py -o netsh --dnat. Run output/netsh-haproxy.cmd as administrator. To reset: Run netsh interface portproxy reset as administrator.

Setting up rinetd (Linux)

Generate with python dnsproxy.py -o rinetd --dnat.

Install rinetd. On Debian based systems you can install with sudo apt-get install rinetd.

Then run sudo cp output/rinetd-haproxy.conf /etc/rinetd.conf && sudo service rinetd start.

To reset: Run sudo service rinetd stop && sudo rm /etc/rinetd.conf.

Testing

Test your new setup here: http://dnsproxy-test.fleck.pw/