Redirect - IPtables

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I want to be redirected to page 192.168.1.1 when the user enters the www.google.com site.



So I add the following iptables rules on the router:



iptables -t nat -I PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:80
iptables -t nat -I PREROUTING -p tcp --dport 443 -j DNAT --to-destination 192.168.1.1:80
iptables -t nat -I OUTPUT -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:80
iptables -t nat -I OUTPUT -p tcp --dport 443 -j DNAT --to-destination 192.168.1.1:80


But it does not work properly.



When the user enters the Yahoo site, it is redirected to page 192.168.1.1 as expected

But when the user enters the Google site, they are not redirected to page 192.168.1.1



Also, when the user enters the connectivitycheck.gstatic.com/generate_204 site :




Not Found
the requested url /generate_204 was not found on this
server






Can anyone suggest why this isn't working?










share|improve this question



















  • 1




    Redirecting HTTPS traffic to port 80 will fail because the browser expects to "talk" SSL but gets plain HTTP, which probably explains your google fail. As for the generate_204 thing, do you have that on your server on 192.168.1.1? If not, why are you surprised to get a 404?
    – wurtel
    Sep 25 at 8:58














up vote
0
down vote

favorite












I want to be redirected to page 192.168.1.1 when the user enters the www.google.com site.



So I add the following iptables rules on the router:



iptables -t nat -I PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:80
iptables -t nat -I PREROUTING -p tcp --dport 443 -j DNAT --to-destination 192.168.1.1:80
iptables -t nat -I OUTPUT -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:80
iptables -t nat -I OUTPUT -p tcp --dport 443 -j DNAT --to-destination 192.168.1.1:80


But it does not work properly.



When the user enters the Yahoo site, it is redirected to page 192.168.1.1 as expected

But when the user enters the Google site, they are not redirected to page 192.168.1.1



Also, when the user enters the connectivitycheck.gstatic.com/generate_204 site :




Not Found
the requested url /generate_204 was not found on this
server






Can anyone suggest why this isn't working?










share|improve this question



















  • 1




    Redirecting HTTPS traffic to port 80 will fail because the browser expects to "talk" SSL but gets plain HTTP, which probably explains your google fail. As for the generate_204 thing, do you have that on your server on 192.168.1.1? If not, why are you surprised to get a 404?
    – wurtel
    Sep 25 at 8:58












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I want to be redirected to page 192.168.1.1 when the user enters the www.google.com site.



So I add the following iptables rules on the router:



iptables -t nat -I PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:80
iptables -t nat -I PREROUTING -p tcp --dport 443 -j DNAT --to-destination 192.168.1.1:80
iptables -t nat -I OUTPUT -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:80
iptables -t nat -I OUTPUT -p tcp --dport 443 -j DNAT --to-destination 192.168.1.1:80


But it does not work properly.



When the user enters the Yahoo site, it is redirected to page 192.168.1.1 as expected

But when the user enters the Google site, they are not redirected to page 192.168.1.1



Also, when the user enters the connectivitycheck.gstatic.com/generate_204 site :




Not Found
the requested url /generate_204 was not found on this
server






Can anyone suggest why this isn't working?










share|improve this question















I want to be redirected to page 192.168.1.1 when the user enters the www.google.com site.



So I add the following iptables rules on the router:



iptables -t nat -I PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:80
iptables -t nat -I PREROUTING -p tcp --dport 443 -j DNAT --to-destination 192.168.1.1:80
iptables -t nat -I OUTPUT -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:80
iptables -t nat -I OUTPUT -p tcp --dport 443 -j DNAT --to-destination 192.168.1.1:80


But it does not work properly.



When the user enters the Yahoo site, it is redirected to page 192.168.1.1 as expected

But when the user enters the Google site, they are not redirected to page 192.168.1.1



Also, when the user enters the connectivitycheck.gstatic.com/generate_204 site :




Not Found
the requested url /generate_204 was not found on this
server






Can anyone suggest why this isn't working?







iptables






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 25 at 8:53









RobotJohnny

708216




708216










asked Sep 25 at 8:08









Minion

11




11







  • 1




    Redirecting HTTPS traffic to port 80 will fail because the browser expects to "talk" SSL but gets plain HTTP, which probably explains your google fail. As for the generate_204 thing, do you have that on your server on 192.168.1.1? If not, why are you surprised to get a 404?
    – wurtel
    Sep 25 at 8:58












  • 1




    Redirecting HTTPS traffic to port 80 will fail because the browser expects to "talk" SSL but gets plain HTTP, which probably explains your google fail. As for the generate_204 thing, do you have that on your server on 192.168.1.1? If not, why are you surprised to get a 404?
    – wurtel
    Sep 25 at 8:58







1




1




Redirecting HTTPS traffic to port 80 will fail because the browser expects to "talk" SSL but gets plain HTTP, which probably explains your google fail. As for the generate_204 thing, do you have that on your server on 192.168.1.1? If not, why are you surprised to get a 404?
– wurtel
Sep 25 at 8:58




Redirecting HTTPS traffic to port 80 will fail because the browser expects to "talk" SSL but gets plain HTTP, which probably explains your google fail. As for the generate_204 thing, do you have that on your server on 192.168.1.1? If not, why are you surprised to get a 404?
– wurtel
Sep 25 at 8:58















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471256%2fredirect-iptables%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471256%2fredirect-iptables%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay