LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 06-25-2009, 07:09 PM   #1
paziulek
Member
 
Registered: Mar 2009
Location: N.C.
Distribution: "gentoo|debian|arch"
Posts: 106

Rep: Reputation: 11
iptables PREROUTING on all hosts but a couple


Hello,

since I set up a box where all traffic is being redirected to port 80 (yeah) I am unable to connect to it at this moment, and at least try to figure out this myself. So please, if possible give me an idea on the following scenario:

i am using prerouting to forward ALL tcp traffic to port 80, and it works good.

I need to set up just a couple of systems ( source IP's known ) which will pass the NAT without any limits, without the prerouting rules.

Thank you for any suggestions,

paziu
 
Old 06-25-2009, 11:25 PM   #2
sanjay.linux
LQ Newbie
 
Registered: Jun 2009
Location: Mohali-Chandgarh
Posts: 2

Rep: Reputation: 0
How to break the "grub loader password" in RHEL 3.0
help me pls.
 
Old 06-26-2009, 12:08 AM   #3
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

Rep: Reputation: 148Reputation: 148
Dont use others..!! "sanjay.linux" please open a new thread for your problem
 
Old 06-26-2009, 04:28 AM   #4
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
sanjay.linux, don't hijack other people's threads. Additionally, LQ isn't the right place for getting help on breaking into systems. If you keep asking questions of that nature, you will risk losing your LQ privileges. kirukan, please use the Report button for these types of things in the future. All that being said, both of you should contact me via email if you need to further discuss any of this. For now, lets try and get the thread back on topic by ignoring the previous two posts. BTW, this thread might be moved to Networking soon unless it becomes evident that it's a security issue.

Last edited by win32sux; 06-26-2009 at 04:29 AM.
 
Old 06-26-2009, 09:27 AM   #5
paziulek
Member
 
Registered: Mar 2009
Location: N.C.
Distribution: "gentoo|debian|arch"
Posts: 106

Original Poster
Rep: Reputation: 11
Ok, I got this:

I would like to redirect ALL TCP to port 80 all hosts but two :

iptables -t nat -I PREROUTING -i eth0 -s ! 10.15.11.101 -p tcp -j REDIRECT --to-port 80
iptables -t nat -I PREROUTING -i eth0 -s ! 10.15.11.8 -p tcp -j REDIRECT --to-port 80

and redirect all dest 80 from these two hosts to proxy port 3128:

iptables -t nat -I PREROUTING -i eth0 -s 10.15.11.101 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -I PREROUTING -i eth0 -s 10.15.11.8 -p tcp --dport 80 -j REDIRECT --to-port 3128


now, if I have just 11.101 it works great all dest packets going trough 3128 and all other packets being forwarded. If I add the second 11.8 , all TCP is redirected to 80, incl ssh telnet etc.

my understanding is :
this should forward all traffic to 80 but from 11.101:
iptables -t nat -I PREROUTING -i eth0 -s ! 10.15.11.101 -p tcp -j REDIRECT --to-port 80
and this should redirect only dest 80 from 11.101 to port 3128:
iptables -t nat -I PREROUTING -i eth0 -s 10.15.11.101 -p tcp --dport 80 -j REDIRECT --to-port 3128

it is true and working great, if I have ONE source host, with multiples, i get all 80 dest redirected to 3128 ( which is great ) BUT all other traffic to port 80 ( which is NOT GOOD )



iptables -t nat -nvL:

Chain PREROUTING (policy ACCEPT 49942 packets, 8659K bytes)
pkts bytes target prot opt in out source destination
1 64 REDIRECT tcp -- eth0 * !10.15.11.8 0.0.0.0/0 redir ports 80
1 60 REDIRECT tcp -- eth0 * !10.15.11.101 0.0.0.0/0 redir ports 80
0 0 REDIRECT tcp -- eth0 * 10.15.11.8 0.0.0.0/0 tcp dpt:80 redir ports 3128
0 0 REDIRECT tcp -- eth0 * 10.15.11.101 0.0.0.0/0 tcp dpt:80 redir ports 3128

So what would be the way of specifying rules for multiple hosts, adding several ips to -s for source returns an error since the syntax is not correct,
I do not want to specify a range. just specific hosts,

Thanks a lot!

Last edited by paziulek; 06-26-2009 at 10:20 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
IPTables Prerouting Question ALInux Linux - Networking 3 06-11-2009 01:29 PM
IPTABLES prerouting - works sometimes czezz Linux - Networking 1 02-23-2009 06:00 AM
Prerouting ports with iptables on a firewall seraph-seph Linux - Networking 3 11-04-2006 12:51 PM
Iptables+prerouting niranjan_mr Linux - Networking 1 04-19-2005 12:23 PM
iptables PREROUTING and blocking question bakuretsu Linux - Security 3 09-12-2002 10:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 10:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration