My computer A has two networks, one connects to internet. The other one connects to computer B. How can I setup A to route all the internet traffic from B through a proxy running on A without setting B too much, possibly acting like a transparent proxy?
Asked
Active
Viewed 528 times
1 Answers
0
You can use A as gateway. Enable IP forwarding on machine A and configure it NAT outgoing traffic.
Quick overview:
Configure addresses interfaces connecting A and B on (both hosts). Verify by pinging between both hosts using these addresses.
Enable routing:
sysctl net.ipv4.ip_forward=1(also check there are no limiting rules in
FORWARDchain offiltertable)Add NAT rules on host A (assuming
eth0connects to internet):iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADEConfigure DNS on host B.
sebasth
- 14,332
- 4
- 50
- 68
-
Not whole computer A is a proxy, just a software running on A provides the proxy, so there should be a proxy address and port somewhere in iptables when routing traffic into a proxy? – user314299 Oct 02 '18 at 03:11
-
Then you should them mention what proxy software/protocol you are using/want to use. When you configure Linux to do IP forwarding (and NATting) the Linux kernel is the software implementing routing. – sebasth Oct 02 '18 at 09:21