Skip to content

Instantly share code, notes, and snippets.

@kotborealis
Last active June 1, 2025 11:56
Show Gist options
  • Save kotborealis/fc7fe6c9ba18d1e3fdee739aa5d9ab62 to your computer and use it in GitHub Desktop.
Save kotborealis/fc7fe6c9ba18d1e3fdee739aa5d9ab62 to your computer and use it in GitHub Desktop.

Revisions

  1. kotborealis revised this gist Apr 19, 2017. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,14 @@ Part of tor-i2p-openvpn configuration.
    * .i2p domains uses i2p as proxy
    * Everything else uses vpn ip adress

    For some reason, ``push dhcp-option dns`` not working, neither in Network Manager nor in openvpn cli. Workaround is to manually set ``nameserver 10.8.0.1`` (where 10.8.0.1 is the openvpn's server tunnel adress) in ``/etc/resolv.conf``
    For some reason, ``push dhcp-option dns`` not working, neither in Network Manager nor in openvpn cli. Workaround is to manually set ``nameserver 10.8.0.1`` (where 10.8.0.1 is the openvpn's server tunnel adress) in ``/etc/resolv.conf``

    ### How it works?

    DNS server on 10.8.0.1 (vpn server) redirects .onion and .i2p domains to 10.8.0.1.

    Following iptables rule on server routes all traffic from tunnel to tinyproxy on 8888:

    ``iptables -t nat -I PREROUTING -i tun0 -p tcp --dport 80 -j REDIRECT --to-ports 8888``

    When client requests specific domain, it goes to TinyProxy, and then tinyproxy decides, what to do: send it to tor, i2p, or to use internet.
  2. kotborealis revised this gist Apr 19, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    Part of tor-i2p-openvpn configuration.

    .onion domains use tor as proxy
    .i2p domains use i2p as proxy
    Everything else uses vpn
    * .onion domains uses tor as proxy
    * .i2p domains uses i2p as proxy
    * Everything else uses vpn ip adress

    For some reason, ``push dhcp-option dns`` not working, neither in Network Manager nor in openvpn cli. Workaround is to manually set ``nameserver 10.8.0.1`` (where 10.8.0.1 is the openvpn's server tunnel adress) in ``/etc/resolv.conf``
  3. kotborealis created this gist Apr 19, 2017.
    4 changes: 4 additions & 0 deletions openvpn_server.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    # Why the hell its not working?
    # Maybe you'll have to change dns manually in /etc/resolv.conf

    push "dhcp-option DNS 10.8.0.1"
    7 changes: 7 additions & 0 deletions polipo_config
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    # We need polipo to proxy tor's proxy ._.

    proxyPort = 8124

    # Tor's socks5 proxy running on 9050
    socksParentProxy = "localhost:9050"
    socksProxyType = socks5
    7 changes: 7 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    Part of tor-i2p-openvpn configuration.

    .onion domains use tor as proxy
    .i2p domains use i2p as proxy
    Everything else uses vpn

    For some reason, ``push dhcp-option dns`` not working, neither in Network Manager nor in openvpn cli. Workaround is to manually set ``nameserver 10.8.0.1`` (where 10.8.0.1 is the openvpn's server tunnel adress) in ``/etc/resolv.conf``
    10 changes: 10 additions & 0 deletions tinyproxy_conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    # I use tinyproxy to route .onion domain traffic to polipo
    # and to route .i2p domain traffic right to the i2p

    Port 8888

    # Polipo running on :8124
    upstream 127.0.0.1:8124 ".onion"

    # i2p running on :4444
    upstream 127.0.0.1:4444 ".i2p"
    16 changes: 16 additions & 0 deletions unbound.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    interface-automatic: yes
    interface: 10.8.0.1

    # Allow connections

    access-control: 10.0.0.0/8 allow
    access-control: 10.0.0.0/16 allow
    access-control: 127.0.0.0/8 allow

    # Redirect .onion and .tor to openvpn server

    local-zone: "onion" redirect
    local-data: "onion A 10.8.0.1"

    local-zone: "i2p" redirect
    local-data: "i2p A 10.8.0.1"