0

I created the rule

sudo iptables -t nat -A OUTPUT -d 64.182.208.181 -j DNAT --to-destination 127.0.0.1

Then, when I acess the site 64.182.208.181, instead of execute the normal page of this site, it will execute a script in my computer and return it. It's work. But, if I to create a hotspot in my computer and going to this site using my cellphone, this will not work. Execute a normal page of this site.

Why? How to fix it, to working in my cellphone.

3
  • use PREROUTING instead OUTPUT
    – Baba
    Jun 27 '16 at 1:21
  • @Babyy I tried using PREROUTING, but, not working. The cellphone can't load the page. Well... I think that I need use -t filter instead of -t nat, rigth? i.imgur.com/ufLpSqz.png
    – Macabeus
    Jun 27 '16 at 1:30
  • @Babyy But table filter can't use DNAT. I receive the error message "x_tables: ip_tables: DNAT target: only valid in nat table, not filter".
    – Macabeus
    Jun 27 '16 at 1:42
0

I resolved my problem.

sudo iptables -t nat -A PREROUTING -d 64.182.208.181 -j DNAT --to 10.42.0.1

I need use 10.42.0.1 instead of 127.0.0.1, becuse, for my cellphone, the hotspot's script is located in 10.42.0.1, not in localhost.

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.