You are looking for TransparentProxy
Also, try to read manual, you can do this by typing:
# man torrc
There is such information about transport's options:
TransPort [address:]port|auto [isolation flags]
Open this port to listen for transparent proxy connections. Set this to 0 if you don’t want to allow transparent proxy
connections. Set the port to "auto" to have Tor pick a port for you.
This directive can be specified multiple times to bind to multiple
addresses/ports. If multiple entries of this
option are present in your configuration file, Tor will perform stream isolation between listeners by default. See SOCKSPort
for an explanation of isolation flags.
TransPort requires OS support for transparent proxies, such as BSDs' pf or Linux’s IPTables. If you’re planning to use Tor as a
transparent proxy for a network, you’ll want to examine and change
VirtualAddrNetwork from the default setting. (Default: 0)
Also, you would like to google for
Tor-middle-box, it shall be a little bit safer. In such scenario: lets suppose, there are little buggies inside linux kernel still && network stack && iptables.. and whatever.... So, in that way, your transparent proxy might blinks from time to time, there was such bad situation, earlier... And couple of your DNS requests, from-time-to-time goes right to google's DNS
18.104.22.168 in plain, from your real IP. Not fine, right?
Tor-middle-box - is a separate computer, often Raspberry-Pi based tiny tor-box, which convert all your traffic into Tor-network, like man-in-the-middle.
It is much easier to design really secure hardware isolated Tor-proxy, than construct something virtual with iptables or even LXC, etc...