0

This question already has an answer here:

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?

marked as duplicate by sebasth, user88036, RalfFriedl, Isaac, G-Man Oct 1 '18 at 3:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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.

  • 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 2 '18 at 3: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 2 '18 at 9:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.