0

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?

user314299
  • 31
  • 2

1 Answers1

0

You can use A as gateway. Enable IP forwarding on machine A and configure it NAT outgoing traffic.

Quick overview:

  1. Configure addresses interfaces connecting A and B on (both hosts). Verify by pinging between both hosts using these addresses.

  2. Enable routing:

    sysctl net.ipv4.ip_forward=1
    

    (also check there are no limiting rules in FORWARD chain of filter table)

  3. Add NAT rules on host A (assuming eth0 connects to internet):

    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    
  4. Configure 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