Let Tor Listen on the Correct Address
There are a few ways to do this depending on your setup. The easiest way as someone else mentioned would be to edit your
torrc config file (probably located at
/etc/tor/torrc/), look for the
SocksPort config option and modify it with the values you want:
SocksPort 10.42.0.1:9100 # or whatever port the client should connect on
then issue a HUP or otherwise restart the Tor process. This will cause it to start listening on port 9100 on the given LAN address.
Alternatively, you can forward any port using a firewall. This is useful if you want more fine grained controll over how the external system accesses Tor (eg. you could also limit traffic, or only allow a certain machine to access Tor) On Ubuntu you probably have iptables, so you can create a rule like this:
-t nat -A PREROUTING -i enp0s20 -p tcp --dport 9100 -j REDIRECT --to-port 9150
(changing the interface name, enp0s20 in this example, to whatever your interface is called and the destination port from 9150 to wherever Tor is listening).
How you actually set the rule depends on your setup; you can always test it using the iptables binary:
# iptables -t nat -A PREROUTING -i enp0s20 -p tcp --dport 9100 -j REDIRECT --to-port 9150
And then persist it either using
or you may have a rules file located in
/etc/iptables or somewhere similar which needs to be modified.
If you're on a system that has
pf such as OS X or OpenBSD, you can add something like this to one of your anchor files (probably under
pass in on enp0s20 proto tcp from 10.42.0.2/32 to any port 9100 rdr-to 127.0.0.1 port 9050