<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://leo.leung.xyz/wiki/index.php?action=history&amp;feed=atom&amp;title=Tor_Transparent_Proxy_with_OpenWRT</id>
	<title>Tor Transparent Proxy with OpenWRT - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://leo.leung.xyz/wiki/index.php?action=history&amp;feed=atom&amp;title=Tor_Transparent_Proxy_with_OpenWRT"/>
	<link rel="alternate" type="text/html" href="https://leo.leung.xyz/wiki/index.php?title=Tor_Transparent_Proxy_with_OpenWRT&amp;action=history"/>
	<updated>2026-11-17T02:09:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://leo.leung.xyz/wiki/index.php?title=Tor_Transparent_Proxy_with_OpenWRT&amp;diff=5249&amp;oldid=prev</id>
		<title>Leo: Created page with &quot;This page will go over the steps required to set up OpenWRT as a transparent Tor proxy.  == Setup == Install OpenWRT. Ensure that the WAN and LAN networks are set up appropria...&quot;</title>
		<link rel="alternate" type="text/html" href="https://leo.leung.xyz/wiki/index.php?title=Tor_Transparent_Proxy_with_OpenWRT&amp;diff=5249&amp;oldid=prev"/>
		<updated>2020-07-02T05:13:58Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This page will go over the steps required to set up OpenWRT as a transparent Tor proxy.  == Setup == Install OpenWRT. Ensure that the WAN and LAN networks are set up appropria...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This page will go over the steps required to set up OpenWRT as a transparent Tor proxy.&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
Install OpenWRT. Ensure that the WAN and LAN networks are set up appropriately. The LAN segment should have DHCP forced with IPv6 disabled.&lt;br /&gt;
&lt;br /&gt;
The /etc/config/dhcp for LAN:&lt;br /&gt;
{{Highlight&lt;br /&gt;
| code = config dhcp &amp;#039;lan&amp;#039;&lt;br /&gt;
        option interface &amp;#039;lan&amp;#039;&lt;br /&gt;
        option start &amp;#039;100&amp;#039;&lt;br /&gt;
        option limit &amp;#039;150&amp;#039;&lt;br /&gt;
        option leasetime &amp;#039;12h&amp;#039;&lt;br /&gt;
        option dhcpv6 &amp;#039;server&amp;#039;&lt;br /&gt;
        option ra &amp;#039;server&amp;#039;&lt;br /&gt;
        option ra_management &amp;#039;1&amp;#039;&lt;br /&gt;
        option force &amp;#039;1&amp;#039;&lt;br /&gt;
| lang = text&lt;br /&gt;
}}&lt;br /&gt;
To stop LAN segment traffic from being forwarded out (to prevent accidental leaking of traffic), block it with the firewall config.&lt;br /&gt;
&lt;br /&gt;
/etc/config/firewall should have:&lt;br /&gt;
{{Highlight&lt;br /&gt;
| code = config zone&lt;br /&gt;
        option name &amp;#039;lan&amp;#039;&lt;br /&gt;
        option network &amp;#039;lan&amp;#039;&lt;br /&gt;
        option input &amp;#039;ACCEPT&amp;#039;&lt;br /&gt;
        option output &amp;#039;ACCEPT&amp;#039;&lt;br /&gt;
        option forward &amp;#039;REJECT&amp;#039;&lt;br /&gt;
&lt;br /&gt;
config rule&lt;br /&gt;
        option dest &amp;#039;wan&amp;#039;&lt;br /&gt;
        option src &amp;#039;lan&amp;#039;&lt;br /&gt;
        option name &amp;#039;Drop All from Lan to Wan&amp;#039;&lt;br /&gt;
        option target &amp;#039;REJECT&amp;#039;&lt;br /&gt;
        list proto &amp;#039;all&amp;#039;&lt;br /&gt;
| lang = text&lt;br /&gt;
}}&lt;br /&gt;
Install and configure Tor:&lt;br /&gt;
{{Highlight&lt;br /&gt;
| code = # opkg update&lt;br /&gt;
# opkg install tor&lt;br /&gt;
&lt;br /&gt;
## listen on 5353 for dns, 9040 for socks&lt;br /&gt;
# TorListenIP=`uci get network.lan2.ipaddr`&lt;br /&gt;
&lt;br /&gt;
# cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/tor/torrc&lt;br /&gt;
# tor runs as &amp;#039;tor&amp;#039; already by init.d script, so this is not necessary&lt;br /&gt;
# User tor&lt;br /&gt;
&lt;br /&gt;
# DataDirectory /var/lib/tor/data&lt;br /&gt;
Log notice file /var/log/tor/notices.log&lt;br /&gt;
&lt;br /&gt;
# Use any unverified nodes for middle, rendezvous&lt;br /&gt;
AllowUnverifiedNodes middle,rendezvous&lt;br /&gt;
&lt;br /&gt;
# Map onion addresses to a virtual IP&lt;br /&gt;
VirtualAddrNetworkIPv4 10.192.0.0/11&lt;br /&gt;
AutomapHostsSuffixes .onion,.exit&lt;br /&gt;
AutomapHostsOnResolve 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Listen on 9050 (socks), 9040 (transparent proxy), 5353 (dns)&lt;br /&gt;
SocksPort   $TorListenIP:9050&lt;br /&gt;
TransPort   $TorListenIP:9040&lt;br /&gt;
DNSPort     $TorListenIP:5353&lt;br /&gt;
&lt;br /&gt;
# Control port can also be enabled:&lt;br /&gt;
ControlPort 127.0.0.1:9051&lt;br /&gt;
HashedControlPassword `/usr/sbin/tor --quiet --hash-password password 2&amp;gt;/dev/null`&lt;br /&gt;
&lt;br /&gt;
# Not an exit node&lt;br /&gt;
ExitPolicy reject *:*&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# chown -R tor:tor /etc/tor&lt;br /&gt;
| lang = terminal&lt;br /&gt;
}}&lt;br /&gt;
Add the following /etc/firewall.user rules:&lt;br /&gt;
{{Highlight&lt;br /&gt;
| code = # create new chain in /etc/firewall.user&lt;br /&gt;
iptables -t nat -X tor_client_dnat&lt;br /&gt;
iptables -t nat -N tor_client_dnat&lt;br /&gt;
iptables -t nat -A prerouting_lan_rule  -j tor_client_dnat&lt;br /&gt;
&lt;br /&gt;
iptables -t nat -A tor_client_dnat -m mac --mac-source 00:50:56:C0:00:08 -j ACCEPT&lt;br /&gt;
# or iptables -t nat -A tor_client_dnat -s 192.168.35.200 -j RETURN&lt;br /&gt;
&lt;br /&gt;
# When you add a new client, you do so by mac address&lt;br /&gt;
iptables -t nat -A tor_client_dnat -p tcp -m mac --mac-source  00:0C:29:42:9D:45  --syn -j DNAT --to-destination 192.168.35.10:9040&lt;br /&gt;
iptables -t nat -A tor_client_dnat -p udp -m mac --mac-source  00:0C:29:42:9D:45  --dport 53 -j DNAT --to-destination 192.168.35.10:5353&lt;br /&gt;
&lt;br /&gt;
iptables -t nat -A tor_client_dnat -p tcp  --syn -j DNAT --to-destination 192.168.35.10:9040&lt;br /&gt;
iptables -t nat -A tor_client_dnat -p udp  --dport 53 -j DNAT --to-destination 192.168.35.10:5353&lt;br /&gt;
| lang = bash&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Leo</name></author>
	</entry>
</feed>