LinuxQuestions.org
Visit Jeremy's Blog.
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 09-19-2006, 10:35 AM   #1
sarajevo
Member
 
Registered: Apr 2005
Distribution: Debian, OpenBSD,Fedora,RedHat
Posts: 228
Blog Entries: 1

Rep: Reputation: 31
Port redirection, iptables, apache questions?


Hi all,

I have following situation
comp_A(80.xxx.xxx.xxx)--------crossover-----comp_B (192.168.1.20)
On comp_A I have a rule
iptables -t nat -A OUTPUT -s any/0 -d 80.xxx.xxx.xxx -p tcp --dport 80 -j DNAT --to-destination 192.168.1.20
And when I enter at web browser on comp_A 80.xxx.xxx.xxx I got apache test page served on comp_b.
When I at comp_B change port server listens from default 80 to another, let say 100, and on comp_A change rule to
iptables -t nat -A OUTPUT -s any/0 -d 80.65.170.142 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.20:100 and then refresh page on comp_A I cannot get same result as before. I got
Not Found
The requested URL / was not found on this server.
Apache Server at 80.xxx.xxx.xxx Port 80

With iptables rules I redirected all http request to comp_B.
In first case everything is ok, but why this does not work ( serve me the same apache test page ) when I change port number apache listens on comp_B?

It would be very helpful if someone has a time to explain this for all of us who do not understand this.

Thank you


PS. compA=debian, comp_B=gentoo
 
Old 09-19-2006, 11:37 AM   #2
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Quote:
Originally Posted by sarajevo
iptables -t nat -A OUTPUT -s any/0 -d <x.x.x.x> -p tcp --dport 80 -j DNAT --to-destination 192.168.1.20:100
PS. compA=debian, comp_B=gentoo
That rule is absoultely fine.. nothing wrong with that.
Maybe at your gentoo box, some firewall would be blocking the incoming request at port #100. Check out.

I would suggest you to use any packet logger @ gentoo box to get into the base of this problem.

Last edited by amitsharma_26; 09-19-2006 at 12:56 PM.
 
Old 09-22-2006, 06:02 AM   #3
yongitz
Member
 
Registered: Nov 2005
Location: Davao City, Philippines
Distribution: RHEL, CentOS, Ubuntu, Mint
Posts: 139

Rep: Reputation: 20
why not try changing your --dport "port" to 100 too?! so your rule would now be iptables -t nat -A OUTPUT -s any/0 -d 80.65.170.142 -p tcp --dport 100 -j DNAT --to-destination 192.168.1.20:100
 
  


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
Port 80 redirection omlex Linux - Security 1 02-20-2005 03:22 PM
Help:iptables redirection swmok Linux - Networking 2 11-24-2004 07:47 AM
Port Redirection JonChristmas Linux - Networking 1 09-04-2004 03:19 AM
Apache Log broke using iptables and port forwarding rwyarbrough Linux - Networking 1 01-14-2004 08:32 AM
Iptables, Port redirection... and I'm a nimrod finegan Linux - Networking 3 09-14-2003 01:48 PM

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

All times are GMT -5. The time now is 03:18 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