I have configured my router to route some of connections to my raspberry pi. Raspberry pi runs an openvpn client and has ip_forward and masquerade enabled in IP Tables so any incoming TCP/IP connection on ethernet port will be forwarded to tun0 which belongs to openvpn.
Here's the commands I use to setup raspberry pi to route incoming connections to tun0:
iptables -A FORWARD -o tun0 -i eth0 -m conntrack --ctstate NEW -j ACCEPT iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE echo "1" | sudo tee /proc/sys/net/ipv4/ip_forward
Now what I want to do is to use Tor instead of openvpn, I mean forwarding traffic to the Tor network not openvpn connection. How can I do this?
Edit 1: Access to some domains and IP address are blocked by my ISP, so I have to use VPN to access them. As using VPN with every domain and IP is not my desire, I decided to create a list of these domains and IPs in my router (RouterOS) and then route their traffic to my raspberry pi device (This link provides actual commands used in routerOS to make it work: https://forum.mikrotik.com/viewtopic.php?f=13&t=171665&p=839646#p839550) and then run an OpenVPN on RaspberryPi and forward these traffics through OpenVPN connection.
But now I don't want to use OpenVPN to unblock access to the specified domains anymore, instead I want to use Tor, but tor does not create a network interface like tun0 which is created by openvpn when established so I don't know how to configure iptables on raspberry pi to forward and masquerade the traffic the way I was doing it with openvpn running.
P.S. I don't care about leaks as my goal is only to access blocked websites and services.