0

In normal mode i can get site content with proxy server (tinyproxy):

curl https://anysite.any/

or

curl -x 127.0.0.1:8888 https://anysite.any/

BUT, i want enable iptable masquerading for some reason, after enable it i can not access any website with proxy!!

iptables -t nat -A POSTROUTING -j MASQUERADE

curl -x 127.0.0.1:8888 https://anysite.any/

return:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
<title>403 Access denied</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>

<body>

<h1>Access denied</h1>

<p>The administrator of this proxy has not configured it to service requests from your host.</p>

<hr />

<p><em>Generated by <a href="https://www.banu.com/tinyproxy/">tinyproxy</a> version 1.8.1.</em></p>

</body>

</html>

but this command work fine without problem:

curl https://anysite.any/

what is my problem??

  • could if please post the output of the command "ifconfig -a"? – Rui F Ribeiro Dec 21 '15 at 10:32
  • @RuiFRibeiro : paste.ubuntu.com/14126762 – Baba Dec 21 '15 at 11:00
  • It seems you have no longer authorisation as the requests arrive with the NAT IP and not the original IP. You would have to make an exception to what is NAT(ed). I requested the interfaces to see if you could change the interface of the NAT to the outside, however it seems you only have one ethernet interface. No idea why you are doing NAT at all, and in that respect not easy to help. iptables -t nat -A POSTROUTING ! -p tcp --dport 8888 -j MASQUERADE might help. you will have to do beforehand iptables -t nat -F to clean the current rule. – Rui F Ribeiro Dec 21 '15 at 11:06
  • @RuiFRibeiro : i nat all traffic because i install OCSERV and it want nat all traffic,, – Baba Dec 21 '15 at 18:26
0

i add -o eth0 to iptables command and solve my problem;

this option told to iptables only action when packets are going out..

iptables -t nat -I POSTROUTING -j MASQUERADE -o eth0

also we can use squid; squid hav'n this problem..

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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