Jump to content

iptables NAT help needed


digininja
 Share

Recommended Posts

I've got the following iptables rule


iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 8008

[/CODE]

and I need it to ignore requests where the destination is either localhost or the IP of the local machine. I know it can be done but to save me digging out my iptables references can anyone give me the answer?

Link to comment
Share on other sites

So, looks like I got the wrong rule anyway, that one doesn't work.

What I'm doing is trying to set up the Pineapple to pass all HTTP traffic that goes through it through my proxy. When I access port 80 on the pineapple from a client the rule works but when I access web traffic through it it doesn't.

What do I need to do to modify traffic going over the bridge?

Link to comment
Share on other sites

Did you use the correct port numbers?

iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 8008
[/CODE]


[code]iptables -t nat -A PREROUTING -p tcp --destination-port 80 ! -d 127.0.0.1 ! -d <local-IP> -j REDIRECT --to-port 8080

You said port 8008 and sitwon said 8080 ( wich is mostly used )

Link to comment
Share on other sites

  • 2 weeks later...

I haven't been able to test this yet, but could give it a run and see if it works for you. I used DNAT because it gives you more flexibility on where you want to send the traffic. Not sure if it'd make a difference or not.

iptables -t nat -A PREROUTING -p tcp --dport 80 ! -d <local-IP> -j DNAT --to 172.16.42.1:8080

Hope this helps!

Edited by ShadowBlade72
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...