Description:

In modern versions of Windows operating systems ipv6 have priority over ipv4, the questions arose how I can:

  1. Assign static ipv6 addresses.
  2. For needed hostnames resolve ipv6 addresses. For all other hostnames return void ipv6 addresses (rest of the network traffic should flow through main router).
  3. Replace some data in http traffic for specific hostnames.

Diagram:

main

dnschef:

dnschef -6 --fakeipv6=:: -i fd99::1 --nameservers=::1#54 --truedomains=example.com


dnsmasq:

dnsmasq -p 54 -d -h -H ./dnsmasq.hosts --enable-ra -F eth0,fd99::0000,fd99::00ff,120,1h --dhcp-option=option6:dns-server,[fd99::1]


dnsmasq.hosts

fd99::1                 example.com
0.0.0.0                 example.com


Nginx:

server {
  listen   [::]:80 default_server;

  root www/;
  index index.html index.htm;

  server_name localhost;

  location / {
    resolver 8.8.8.8;
    proxy_pass http://$http_host$uri$is_args$args;
    proxy_set_header Accept-Encoding "";
    sub_filter_types "*" ;
    sub_filter 'search_keyword1' 'replace_keyword1';
    sub_filter 'search_keyword2' 'replace_keyword2';
  }
}